示例#1
0
process.load("RecoEcal.EgammaClusterProducers.ecalClusteringSequence_cff")

process.load(
    "CalibCalorimetry.EcalLaserCorrection.ecalLaserCorrectionService_cfi")

process.load(
    "SimCalorimetry.EcalTrigPrimProducers.ecalTriggerPrimitiveDigis_cfi")

from RecoLocalCalo.EcalRecProducers.ecalFixedAlphaBetaFitUncalibRecHit_cfi import ecalFixedAlphaBetaFitUncalibRecHit

process.ecalLaserLedUncalibRecHit = ecalFixedAlphaBetaFitUncalibRecHit.clone()

from RecoLocalCalo.EcalRecProducers.ecalMaxSampleUncalibRecHit_cfi import ecalMaxSampleUncalibRecHit

process.ecalTestPulseUncalibRecHit = ecalMaxSampleUncalibRecHit.clone()

### ECAL DQM MODULES ###

process.load("DQM.EcalCommon.EcalDQMBinningService_cfi")

process.load("DQM.EcalBarrelMonitorTasks.EcalCalibMonitorTasks_cfi")
process.load("DQM.EcalBarrelMonitorClient.EcalCalibMonitorClient_cfi")

### DQM COMMON MODULES ###

process.load("DQMServices.Core.DQM_cfg")

process.load("DQM.Integration.test.environment_cfi")

### FILTERS ###
示例#2
0
def buildEcalDQMModules(process, options):
    """
    Build a standalone cms.Process that can be used for (quasi-)online DQM and local testing
    """

    ### SET OPTION FLAGS ###
    
    if options.environment not in ['CMSLive', 'PrivLive', 'PrivOffline', 'LocalLive', 'LocalOffline']:
        raise RuntimeError("environment value " + options.environment + " not correct")
    
    if options.cfgType not in ['Physics', 'Calibration', 'CalibrationStandalone', 'Laser']:
        raise RuntimeError("cfgType value " + options.cfgType + " not correct")

    if not options.rawDataCollection:
        raise RuntimeError("rawDataCollection name not given")

    isSource = ('source' in options.steps)
    isClient = ('client' in options.steps)

    if not isSource and not isClient:
        raise RuntimeError("job is neither source nor client")

    central = (options.environment == 'CMSLive')
    privEcal = ('Priv' in options.environment)
    local = ('Local' in options.environment)
    live = ('Live' in options.environment)

    p5 = privEcal or central
           
    physics = (options.cfgType == 'Physics')
    calib = (options.cfgType == 'Calibration' or options.cfgType == 'CalibrationStandalone')
    laser = (options.cfgType == 'Laser')

    verbosity = options.verbosity
    if verbosity < 0:
        if local: verbosity = 2
        else: verbosity = 0


    ### RECONSTRUCTION MODULES ###

    if isSource:
        process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
        #process.load("Geometry.CaloEventSetup.CaloGeometry_cfi")
        #process.load("Geometry.CaloEventSetup.CaloTopology_cfi")
        #process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi")
        #process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
        #process.load("Geometry.EcalMapping.EcalMapping_cfi")
        #process.load("Geometry.EcalMapping.EcalMappingRecord_cfi")
        
        if not laser:
            from EventFilter.EcalRawToDigi.EcalUnpackerData_cfi import ecalEBunpacker
            process.ecalDigis = ecalEBunpacker.clone(
                InputLabel = cms.InputTag(options.rawDataCollection)
            )
        
            process.load("RecoLocalCalo.EcalRecProducers.ecalGlobalUncalibRecHit_cfi")
            process.load("RecoLocalCalo.EcalRecProducers.ecalDetIdToBeRecovered_cfi")
            process.load("RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi")
            process.ecalRecHit.EBuncalibRecHitCollection = "ecalGlobalUncalibRecHit:EcalUncalibRecHitsEB"
            process.ecalRecHit.EEuncalibRecHitCollection = "ecalGlobalUncalibRecHit:EcalUncalibRecHitsEE"
            process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi")
            process.load("CalibCalorimetry.EcalLaserCorrection.ecalLaserCorrectionService_cfi")
    
        if physics:
            if options.useGEDClusters:
                process.load('Configuration.StandardSequences.MagneticField_38T_cff')
                process.load("Configuration.Geometry.GeometryIdeal_cff")
                process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
                process.load("EventFilter.SiPixelRawToDigi.SiPixelRawToDigi_cfi")
                process.load("EventFilter.SiStripRawToDigi.SiStripDigis_cfi")
                process.siPixelDigis.InputLabel = 'rawDataCollector'
                process.load("RecoLocalTracker.Configuration.RecoLocalTracker_cff")
                process.load("RecoPixelVertexing.Configuration.RecoPixelVertexing_cff")
                process.load("RecoTracker.Configuration.RecoTracker_cff")
                process.load("RecoVertex.PrimaryVertexProducer.OfflinePrimaryVertices_cfi")
                process.load("RecoParticleFlow.PFClusterProducer.particleFlowRecHitECAL_cfi")
                process.load("RecoParticleFlow.PFClusterProducer.particleFlowRecHitPS_cfi")
                process.load("RecoParticleFlow.PFClusterProducer.particleFlowClusterECAL_cfi")
                process.load("RecoParticleFlow.PFClusterProducer.particleFlowClusterPS_cfi")
                process.load("RecoEcal.EgammaClusterProducers.particleFlowSuperClusterECAL_cfi")
                from EventFilter.ESRawToDigi.esRawToDigi_cfi import esRawToDigi
                process.ecalPreshowerDigis = esRawToDigi.clone()
                process.load("RecoLocalCalo.EcalRecProducers.ecalPreshowerRecHit_cfi")
            else:
                process.load("RecoEcal.EgammaClusterProducers.ecalClusteringSequence_cff")

            process.load("SimCalorimetry.EcalTrigPrimProducers.ecalTriggerPrimitiveDigis_cfi")
            process.simEcalTriggerPrimitiveDigis.Label = "ecalDigis"
            process.simEcalTriggerPrimitiveDigis.InstanceEB = "ebDigis"
            process.simEcalTriggerPrimitiveDigis.InstanceEE = "eeDigis"

            process.load("RecoLuminosity.LumiProducer.bunchSpacingProducer_cfi")
            process.load("L1Trigger.Configuration.L1RawToDigi_cff")

            if not live: # for RecoSummaryTask and ClusterExtraTask
                process.load("RecoEcal.EgammaCoreTools.EcalNextToDeadChannelESProducer_cff")
                process.load("RecoEcal.EgammaClusterProducers.reducedRecHitsSequence_cff")
                if options.useGEDClusters:
                    process.reducedEcalRecHitsEB.interestingDetIdCollections = [cms.InputTag("interestingEcalDetIdPFEB")]
                    process.reducedEcalRecHitsEE.interestingDetIdCollections = [cms.InputTag("interestingEcalDetIdPFEE")]
                else:
                    process.reducedEcalRecHitsEB.interestingDetIdCollections = [cms.InputTag("interestingEcalDetIdEB")]
                    process.reducedEcalRecHitsEE.interestingDetIdCollections = [cms.InputTag("interestingEcalDetIdEE")]
    
        elif calib:
            from RecoLocalCalo.EcalRecProducers.ecalFixedAlphaBetaFitUncalibRecHit_cfi import ecalFixedAlphaBetaFitUncalibRecHit
            process.ecalLaserLedUncalibRecHit = ecalFixedAlphaBetaFitUncalibRecHit.clone(
                algoPSet= cms.PSet(
                    MinAmplBarrel = cms.double(12.),
                    MinAmplEndcap = cms.double(16.)
                )
            )
         #   process.ecalLaserLedUncalibRecHit.algoPSet.MinAmplBarrel = 12.
         #   process.ecalLaserLedUncalibRecHit.algoPSet.MinAmplEndcap = 16.
            from RecoLocalCalo.EcalRecProducers.ecalMaxSampleUncalibRecHit_cfi import ecalMaxSampleUncalibRecHit
            process.ecalTestPulseUncalibRecHit = ecalMaxSampleUncalibRecHit.clone(
                EBdigiCollection = "ecalDigis:ebDigis",
                EEdigiCollection = "ecalDigis:eeDigis"
            )

   
    ### ECAL DQM MODULES ###

    if physics:
        if isSource:
            process.load("DQM.EcalMonitorTasks.EcalMonitorTask_cfi")
            if live:
                process.ecalMonitorTask.workers = ["ClusterTask", "EnergyTask", "IntegrityTask", "OccupancyTask", "RawDataTask", "TimingTask", "TrigPrimTask", "PresampleTask", "SelectiveReadoutTask"]
                process.ecalMonitorTask.workerParameters.TrigPrimTask.params.runOnEmul = True
                process.ecalMonitorTask.collectionTags.Source = options.rawDataCollection
                process.ecalMonitorTask.verbosity = verbosity
                process.ecalMonitorTask.commonParameters.onlineMode = True
            if not options.useGEDClusters:
                process.ecalMonitorTask.collectionTags.EBBasicCluster = "hybridSuperClusters:hybridBarrelBasicClusters"
                process.ecalMonitorTask.collectionTags.EEBasicCluster = "multi5x5SuperClusters:multi5x5EndcapBasicClusters"
                process.ecalMonitorTask.collectionTags.EBSuperCluster = "correctedHybridSuperClusters"
                process.ecalMonitorTask.collectionTags.EESuperCluster = "multi5x5SuperClusters:multi5x5EndcapSuperClusters"

            process.ecalMonitorTask.collectionTags.EBUncalibRecHit = "ecalGlobalUncalibRecHit:EcalUncalibRecHitsEB"
            process.ecalMonitorTask.collectionTags.EEUncalibRecHit = "ecalGlobalUncalibRecHit:EcalUncalibRecHitsEE"
            process.ecalMonitorTask.collectionTags.TrigPrimEmulDigi = 'simEcalTriggerPrimitiveDigis'

            if options.outputMode != 2:
                process.ecalMonitorTask.commonParameters.willConvertToEDM = False

        if isClient:
            process.load("DQM.EcalMonitorClient.EcalMonitorClient_cfi")
            process.ecalMonitorClient.verbosity = verbosity
            if live:
                process.ecalMonitorClient.workers = ["IntegrityClient", "OccupancyClient", "PresampleClient", "RawDataClient", "TimingClient", "SelectiveReadoutClient", "TrigPrimClient", "SummaryClient"]
#                process.ecalMonitorClient.workerParameters.SummaryClient.params.activeSources = ["Integrity", "RawData", "Presample", "TriggerPrimitives", "Timing", "HotCell"]
# removing Timing from the list of summary client sources during commissioning & until DQM can do run-typing
                process.ecalMonitorClient.workerParameters.SummaryClient.params.activeSources = ["Integrity", "RawData", "Presample", "TriggerPrimitives", "HotCell"]

                process.ecalMonitorClient.commonParameters.onlineMode = True

    elif calib:
        from DQM.EcalCommon.CommonParams_cfi import ecaldqmLaserWavelengths, ecaldqmMGPAGains, ecaldqmMGPAGainsPN
        for wl in options.laserWavelengths:
            if wl not in ecaldqmLaserWavelengths:
                ecaldqmLaserWavelengths.append(wl)
        for gain in options.MGPAGains:
            if gain not in ecaldqmMGPAGains:
                ecaldqmMGPAGains.append(gain)
        for gain in options.MGPAGainsPN:
            if gain not in ecaldqmMGPAGainsPN:
                ecaldqmMGPAGainsPN.append(gain)

        if isSource:
            process.load("DQM.EcalMonitorTasks.EcalCalibMonitorTasks_cfi")
            process.ecalLaserLedMonitorTask.verbosity = verbosity
            process.ecalPedestalMonitorTask.verbosity = verbosity
            process.ecalTestPulseMonitorTask.verbosity = verbosity
            process.ecalPNDiodeMonitorTask.verbosity = verbosity

            if live:
                process.ecalLaserLedMonitorTask.commonParameters.onlineMode = True
                process.ecalPedestalMonitorTask.commonParameters.onlineMode = True
                process.ecalTestPulseMonitorTask.commonParameters.onlineMode = True
                process.ecalPNDiodeMonitorTask.commonParameters.onlineMode = True

            if options.cfgType == 'CalibrationStandalone':
                process.load("DQM.EcalMonitorTasks.EcalMonitorTask_cfi")
                process.ecalMonitorTask.workers = ["IntegrityTask", "RawDataTask","PresampleTask"]
                process.ecalMonitorTask.collectionTags.Source = options.rawDataCollection

            process.ecalLaserLedMonitorTask.collectionTags.EBLaserLedUncalibRecHit = 'ecalLaserLedUncalibRecHit:EcalUncalibRecHitsEB'
            process.ecalLaserLedMonitorTask.collectionTags.EELaserLedUncalibRecHit = 'ecalLaserLedUncalibRecHit:EcalUncalibRecHitsEE'

        if isClient:
            #add the 1st line to enable noise plots
            process.load("DQM.EcalMonitorClient.EcalCalibMonitorClient_cfi")
            process.ecalCalibMonitorClient.verbosity = verbosity

            if live:
                process.ecalCalibMonitorClient.commonParameters.onlineMode = True
            
            if options.cfgType == 'CalibrationStandalone':
                process.ecalCalibMonitorClient.workerParameters.SummaryClient.params.activeSources = ["Integrity", "RawData","Presample"]
                if options.calibType == 'PEDESTAL':
                    process.ecalCalibMonitorClient.workers = ["IntegrityClient", "RawDataClient", "PedestalClient", "PNIntegrityClient", "SummaryClient", "CalibrationSummaryClient"]
                elif options.calibType == 'TEST_PULSE':
                    process.ecalCalibMonitorClient.workers = ["IntegrityClient", "RawDataClient", "TestPulseClient", "PNIntegrityClient", "SummaryClient", "CalibrationSummaryClient"]
                else:
                    process.ecalCalibMonitorClient.workers = ["IntegrityClient", "RawDataClient","PedestalClient", "TestPulseClient", "LaserClient", "LedClient", "PNIntegrityClient", "SummaryClient", "CalibrationSummaryClient", "PresampleClient"]



        #Need to configure the source for calib summary!!
    elif laser:
        # load laser monitor client
#        process.ecalLaserMonitorClient.clientParameters.LightChecker.matacqPlotsDir = "/data/dqm-data/laser"
        pass

    if options.outputMode == 1 and not isSource and isClient:
        process.load("DQM.EcalCommon.EcalMEFormatter_cfi")


    ### DQM COMMON MODULES ###

    if live:
        process.load('DQM.Integration.config.environment_cfi')
        process.load("DQMServices.Components.DQMFileSaver_cfi")
    else:
        process.load("DQMServices.Core.DQM_cfg")
        process.load("DQMServices.Components.DQMEnvironment_cfi")
        process.DQM = cms.Service("DQM",                                                                                                                                                                           
            debug = cms.untracked.bool(False),
            publishFrequency = cms.untracked.double(5.0),
            collectorPort = cms.untracked.int32(0),
            collectorHost = cms.untracked.string(''),
            filter = cms.untracked.string('')
        )      
    
    if physics:
        if isSource:
            process.dqmEnv.subSystemFolder = cms.untracked.string("Ecal")
#        if isClient:
#            process.dqmQTest = cms.EDAnalyzer("QualityTester",
#                reportThreshold = cms.untracked.string("red"),
#                prescaleFactor = cms.untracked.int32(1),
#                qtList = cms.untracked.FileInPath("DQM/EcalCommon/data/EcalQualityTests.xml"),
#                getQualityTestsFromFile = cms.untracked.bool(True),
#                qtestOnEndLumi = cms.untracked.bool(True),
#                qtestOnEndRun = cms.untracked.bool(True)
#            )
    else:
        if isSource:
            process.dqmEnv.subSystemFolder = cms.untracked.string("EcalCalibration")

    if central:
        referencePath = '/dqmdata/dqm/reference/'
    elif privEcal:
        referencePath = '/data/dqm-data/online-DQM/'
    else:
        referencePath = ''

    if referencePath:
        if physics:
            process.DQMStore.referenceFileName = referencePath + 'ecal_reference.root'
        else:
            process.DQMStore.referenceFileName = referencePath + 'ecalcalib_reference.root'

    if options.outputMode == 1:
        if privEcal:
            if not options.workflow:
                raise RuntimeError('No workflow parameter')

            process.dqmSaver.convention = "Offline"
            process.dqmSaver.referenceHandling = "skip"
            process.dqmSaver.workflow = options.workflow
            process.dqmSaver.dirName = "/data/dqm-data/tmp" 
            process.dqmSaver.producer = 'DQM'

        elif not central:
            process.dqmSaver.referenceHandling = "skip"
            process.dqmSaver.workflow = options.workflow

            if live:
                process.dqmSaver.convention = "Online"
            else:
                process.dqmSaver.convention = "Offline"

        if process.dqmSaver.convention == 'Offline':
            if physics:
                process.dqmSaver.version = 1
            else:
                process.dqmSaver.version = 2

        if options.outputPath:
            process.dqmSaver.dirName = options.outputPath

    if live and privEcal:
        process.DQM.collectorHost = "fu-c2f11-21-02"
        process.DQM.collectorPort = 9190
    elif live and local:
        process.DQM.collectorHost = "localhost"
        process.DQM.collectorPort = 8061
    elif not central:
        process.DQM.collectorHost = ""

    if options.collector:
        process.DQM.collectorHost = options.collector.split(':')[0]
        process.DQM.collectorPort = int(options.collector.split(':')[1])


    ### FILTERS ###

    process.load("FWCore.Modules.preScaler_cfi")
    process.preScaler.prescaleFactor = options.prescaleFactor

    if live:
        if physics:
            process.ecalPhysicsFilter = cms.EDFilter("EcalMonitorPrescaler",
                EcalRawDataCollection = cms.InputTag("ecalDigis"),
                physics = cms.untracked.uint32(1),
                cosmics = cms.untracked.uint32(1)
            )
        elif calib:
            process.ecalLaserLedFilter = cms.EDFilter("EcalMonitorPrescaler",
                EcalRawDataCollection = cms.InputTag("ecalDigis"),
                laser = cms.untracked.uint32(1),
                led = cms.untracked.uint32(1)
            )
            process.ecalTestPulseFilter = cms.EDFilter("EcalMonitorPrescaler",
                EcalRawDataCollection = cms.InputTag("ecalDigis"),
                testPulse = cms.untracked.uint32(1)
            )
            process.ecalPedestalFilter = cms.EDFilter("EcalMonitorPrescaler",
                EcalRawDataCollection = cms.InputTag("ecalDigis"),
                pedestal = cms.untracked.uint32(1)
            )

  
    ### JOB PARAMETERS ###

    if isSource:
        process.maxEvents = cms.untracked.PSet(
          input = cms.untracked.int32(options.maxEvents)
        )
    else:
        process.maxEvents = cms.untracked.PSet(
          input = cms.untracked.int32(1)
        )

    if p5:
        process.load('DQM.Integration.config.FrontierCondition_GT_cfi')
    else:
        process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
        if options.globalTag.startswith('auto:'):
            from Configuration.AlCa.GlobalTag import GlobalTag
            process.GlobalTag = GlobalTag(process.GlobalTag._cmsObject, options.globalTag, '')
        else:
            process.GlobalTag.globaltag = options.globalTag

    connect = process.GlobalTag.connect.value()
   
    process.GlobalTag.toGet = cms.VPSet(
        cms.PSet(
            record = cms.string("EcalDQMChannelStatusRcd"),
            tag = cms.string("EcalDQMChannelStatus_v1_hlt"),
            connect = cms.string(connect.replace('CMS_COND_31X_GLOBALTAG', 'CMS_COND_34X_ECAL'))
        ),
        cms.PSet(
            record = cms.string("EcalDQMTowerStatusRcd"),
            tag = cms.string("EcalDQMTowerStatus_v1_hlt"),
            connect = cms.string(connect.replace('CMS_COND_31X_GLOBALTAG', 'CMS_COND_34X_ECAL'))
        )
    )

    process.MessageLogger = cms.Service("MessageLogger",
        destinations = cms.untracked.vstring('cerr', 'cout'),
        categories = cms.untracked.vstring('EcalDQM', 'EcalLaserDbService'),
        cerr = cms.untracked.PSet(
            threshold = cms.untracked.string("WARNING"),
            noLineBreaks = cms.untracked.bool(True),
            noTimeStamps = cms.untracked.bool(True),
            default = cms.untracked.PSet(
                limit = cms.untracked.int32(0)
            )
        ),
        cout = cms.untracked.PSet(
            threshold = cms.untracked.string('INFO'),
            EcalDQM = cms.untracked.PSet(
                limit = cms.untracked.int32(-1)
            ),
            EcalLaserDbService = cms.untracked.PSet(
                limit = cms.untracked.int32(10)
            ),
            default = cms.untracked.PSet(
                limit = cms.untracked.int32(0)
            )
        )
    )

    ### SOURCE ###
    
    if live:
        process.load("DQM.Integration.config.inputsource_cfi")  # input source uses VarParsing (Jul 2 2014)
        if physics:
            process.source.streamLabel = 'streamLookArea'
        if not central:
            pass
#            process.source.endOfRunKills = False
        if calib and options.cfgType != 'CalibrationStandalone':
#            process.source.streamLabel = 'streamDQMCalibration'
            process.source.streamLabel = 'streamLookArea'

    else:
        if '.dat' in options.inputFiles[0]:
            process.source = cms.Source("NewEventStreamFileReader")
        else:
            process.source = cms.Source("PoolSource")

        if options.inputList:
            inputFiles = []
            with open(options.inputList) as sourceList:
                for line in sourceList:
                    inputFiles.append(line.strip())

            process.source.fileNames = cms.untracked.vstring(inputFiles)

        elif options.inputFiles:
            process.source.fileNames = cms.untracked.vstring(options.inputFiles)
process.load("RecoLocalCalo.EcalRecProducers.ecalRecHit_cfi")

process.load("RecoLocalCalo.EcalRecAlgos.EcalSeverityLevelESProducer_cfi")

process.load("RecoEcal.EgammaClusterProducers.ecalClusteringSequence_cff")

process.load("CalibCalorimetry.EcalLaserCorrection.ecalLaserCorrectionService_cfi")

process.load("SimCalorimetry.EcalTrigPrimProducers.ecalTriggerPrimitiveDigis_cfi")

from RecoLocalCalo.EcalRecProducers.ecalFixedAlphaBetaFitUncalibRecHit_cfi import ecalFixedAlphaBetaFitUncalibRecHit
process.ecalLaserLedUncalibRecHit = ecalFixedAlphaBetaFitUncalibRecHit.clone()

from RecoLocalCalo.EcalRecProducers.ecalMaxSampleUncalibRecHit_cfi import ecalMaxSampleUncalibRecHit
process.ecalTestPulseUncalibRecHit = ecalMaxSampleUncalibRecHit.clone()

    
### ECAL DQM MODULES ###

process.load("DQM.EcalCommon.EcalDQMBinningService_cfi")

process.load("DQM.EcalBarrelMonitorTasks.EcalCalibMonitorTasks_cfi")
process.load("DQM.EcalBarrelMonitorClient.EcalCalibMonitorClient_cfi")


### DQM COMMON MODULES ###

process.load("DQMServices.Core.DQM_cfg")

process.load("DQM.Integration.test.environment_cfi")