Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
import FWCore.ParameterSet.Config as cms
import sys,os

arguments = sys.argv
infile = "Gains.root"
tagname = "CTPPSPixelGainCalibrations_test"
sqlitename = "ctppsgains_test.db"
runnumber = 1
doDummy = False
gainlo = 0.0
gainhi = 100.0
minNp = 3
if len(arguments)<3:
    print ("using default values")
    mystr = "usage: cmsRun write-ctpps-pixel-gainscalibrations_cfg.py "+ infile +" "+ tagname +" "+ sqlitename +" "+ str(runnumber) +" "+ str(doDummy) +" "+ str(gainlo) +" "+ str(gainhi) +" "+ str(minNp)
    print (mystr)
else:
    infile = arguments[2]
    if len(arguments)>3: tagname    = arguments[3]
    if len(arguments)>4: sqlitename = arguments[4]
    if len(arguments)>5:
        runnumber  = int(arguments[5])
        print ("runno = ",runnumber)
    if len(arguments)>6:
        doDummy    = (arguments[6].lower()=="true")
        print ("useDummyValues = ",doDummy)
    if len(arguments)>7:
        gainlo     = float(arguments[7])
        print ("gainLowLimit = ",gainlo)
    if len(arguments)>8:
        gainhi     = float(arguments[8])
        print ("gainHighLimit = ",gainhi)
    if len(arguments)>9:
        minNp      = int(arguments[9])
        print ("minimumNpFit = ",minNp)



process = cms.Process("CTPPSPixelGainDB")

process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1))

process.pixGainDB = cms.EDAnalyzer("WriteCTPPSPixGainCalibrations",
                                   inputrootfile = cms.untracked.string(infile),
                                   record = cms.untracked.string('CTPPSPixelGainCalibrationsRcd'),
                                   useDummyValues = cms.untracked.bool(doDummy),
                                   gainLowLimit = cms.untracked.double(gainlo),
                                   gainHighLimit=cms.untracked.double(gainhi),
                                   minimumNpfit = cms.untracked.int32(minNp)
                                   )


process.source = cms.Source("EmptyIOVSource",
    timetype = cms.string('runnumber'),
    firstValue = cms.uint64(runnumber),
    lastValue = cms.uint64(runnumber),
    interval = cms.uint64(1)
    )

process.PoolDBOutputService = cms.Service("PoolDBOutputService",
    BlobStreamerName = cms.untracked.string('TBufferBlobStreamingService'),
    DBParameters = cms.PSet(
        messageLevel = cms.untracked.int32(10),
        authenticationPath = cms.untracked.string('.')
        ),
    toPut = cms.VPSet(
        cms.PSet(
            record = cms.string('CTPPSPixelGainCalibrationsRcd'),
            tag = cms.string(tagname)
            )
        ),
    connect = cms.string('sqlite_file:'+sqlitename)
)

process.p = cms.Path(process.pixGainDB)