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
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing

process = cms.Process('XMLFILERETRIEVER')

####################################################################
# Set the options
####################################################################
options = VarParsing('analysis')
options.register('unitTest',
                 False,
                 VarParsing.multiplicity.singleton,
                 VarParsing.varType.bool,
                 'Run the unit test',
                 )

options.parseArguments()

####################################################################
# Get the GlobalTag
####################################################################
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run3_data_prompt', '')
#process.GlobalTag.DumpStat = cms.untracked.bool(True)  # optional if you want it to be verbose

# import of standard configurations
process.load("DQMServices.Core.DQMStore_cfg")
process.DQMStore.verbose   = cms.untracked.int32(1)
process.DQMStore.verboseQT = cms.untracked.int32(0)

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

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

if options.unitTest:
    print("running configuration in UnitTest Mode")
    process.load("CondCore.CondDB.CondDB_cfi")
    process.CondDB.connect = "sqlite_file:./testXML.db"

    process.XmlRetrieval_1 = cms.ESSource("PoolDBESSource",
                                          process.CondDB,
                                          toGet = cms.VPSet(cms.PSet(record = cms.string('DQMXMLFileRcd'),
                                                                     tag = cms.string('XML_test'),
                                                                     label=cms.untracked.string('XML_label')
                                                                 )
                                                        )
                                      )

    process.RecordDataGetter = cms.EDAnalyzer("EventSetupRecordDataGetter",
                                              toGet = cms.VPSet(cms.PSet(record = cms.string('DQMXMLFileRcd'),
                                                                         data = cms.vstring('FileBlob/XML_label'))),
                                              verbose = cms.untracked.bool(True)
                                              )

                                      
process.load('CondTools.DQM.DQMXMLFileEventSetupAnalyzer_cfi')
if(options.unitTest):
    process.dqmXMLFileGetter.labelToGet = cms.string('XML_label')
    process.path = cms.Path(process.RecordDataGetter+process.dqmXMLFileGetter)

else:
    process.dqmXMLFileGetter.labelToGet = cms.string('SiPixelDQMQTests')
    process.path = cms.Path(process.dqmXMLFileGetter)