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 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
import FWCore.ParameterSet.Config as cms

import sys
if 'runkey=hi_run' in sys.argv:
  from Configuration.Eras.Era_Run3_pp_on_PbPb_cff import Run3_pp_on_PbPb
  process = cms.Process("SiStripApproxMonitor", Run3_pp_on_PbPb)
else:
  from Configuration.Eras.Era_Run3_cff import Run3
  process = cms.Process("SiStripApproxMonitor", Run3)

process.load('FWCore.MessageService.MessageLogger_cfi')
process.MessageLogger.debugModules = cms.untracked.vstring('siStripDigis',
                                                           'siStripClusters',
                                                           'siStripZeroSuppression',
                                                           'SiStripClusterizer',
                                                           'siStripApproximateClusterComparator')
process.MessageLogger.cout = cms.untracked.PSet(threshold = cms.untracked.string('ERROR'))

live=True
unitTest=False

if 'unitTest=True' in sys.argv:
    live=False
    unitTest=True

# uncomment for running on lxplus
#live=False
offlineTesting=not live
#print "live: "+str(live)+" ==> offlineTesting: "+str(offlineTesting)

#----------------------------
# Event Source
#-----------------------------
# for live online DQM in P5
if (unitTest):
  process.load("DQM.Integration.config.unitteststreamerinputsource_cfi")
  from DQM.Integration.config.unitteststreamerinputsource_cfi import options
elif (live):
  process.load("DQM.Integration.config.inputsource_cfi")
  from DQM.Integration.config.inputsource_cfi import options
# for testing in lxplus
elif(offlineTesting):
  process.load("DQM.Integration.config.fileinputsource_cfi")
  from DQM.Integration.config.fileinputsource_cfi import options

#----------------------------
# DQM Live Environment
#-----------------------------

process.load("DQM.Integration.config.environment_cfi")
process.DQM.filter = '^(SiStripApproximateClusters)(/[^/]+){0,5}$'

process.dqmEnv.subSystemFolder    = "SiStripApproximateClusters"
process.dqmSaver.tag = "SiStripApproximateClusters"
process.dqmSaver.backupLumiCount = 30
process.dqmSaver.runNumber = options.runNumber
# process.dqmSaverPB.tag = "SiStripApproximateClusters"
# process.dqmSaverPB.runNumber = options.runNumber

from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
process.dqmEnvTr = DQMEDAnalyzer('DQMEventInfo',
                                 subSystemFolder = cms.untracked.string('SiStripApproximateClusters'),
                                 eventRateWindow = cms.untracked.double(0.5),
                                 eventInfoFolder = cms.untracked.string('EventInfo'))

#-----------------------------
# Magnetic Field
#-----------------------------
process.load('Configuration.StandardSequences.MagneticField_cff')

#-------------------------------------------------
# GEOMETRY
#-------------------------------------------------
process.load("Configuration.StandardSequences.GeometryRecoDB_cff")

#--------------------------
# Calibration
#--------------------------
# Condition for P5 cluster
if (live):
    process.load("DQM.Integration.config.FrontierCondition_GT_cfi")
# Condition for lxplus: change and possibly customise the GT
elif(offlineTesting):
    process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
    from Configuration.AlCa.GlobalTag import GlobalTag as gtCustomise
    #you may need to set manually the GT in the line below
    process.GlobalTag = gtCustomise(process.GlobalTag, 'auto:run3_hlt', '')

print("Will process with GlobalTag: %s" % process.GlobalTag.globaltag.value())

#--------------------------------------------
# Patch to avoid using Run Info information in reconstruction
#--------------------------------------------
process.siStripQualityESProducer.ListOfRecordToMerge = cms.VPSet(
   cms.PSet( record = cms.string("SiStripDetVOffRcd"),    tag    = cms.string("") ),
   cms.PSet( record = cms.string("SiStripDetCablingRcd"), tag    = cms.string("") ),
   cms.PSet( record = cms.string("SiStripBadChannelRcd"), tag    = cms.string("") ),
   cms.PSet( record = cms.string("SiStripBadFiberRcd"),   tag    = cms.string("") ),
   cms.PSet( record = cms.string("SiStripBadModuleRcd"),  tag    = cms.string("") )
   )
#-------------------------------------------

#-----------------------
#  Reconstruction Modules
#-----------------------
## Collision Reconstruction
process.load("Configuration.StandardSequences.RawToDigi_Data_cff")
process.load("Configuration.StandardSequences.Reconstruction_cff")

import RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi
process.offlineBeamSpot = RecoVertex.BeamSpotProducer.BeamSpotOnline_cfi.onlineBeamSpotProducer.clone()

#
# Strip FED check
#
rawDataCollectorLabel = 'rawDataCollector'

#--------------------------
# Service
#--------------------------
process.AdaptorConfig = cms.Service("AdaptorConfig")

# Simple filter for event
process.eventFilter = cms.EDFilter("SimpleEventFilter",
#                   EventsToSkip = cms.untracked.int32(3)
                   EventsToSkip = cms.untracked.int32(100)
)

#--------------------------
# Producers
#--------------------------
# Event History Producer
process.load("DPGAnalysis.SiStripTools.eventwithhistoryproducerfroml1abc_cfi")

# APV Phase Producer
process.load("DPGAnalysis.SiStripTools.apvcyclephaseproducerfroml1tsDB_cfi")

#--------------------------
# Filters
#--------------------------
# HLT Filter
# 0=random, 1=physics, 2=calibration, 3=technical
process.hltTriggerTypeFilter = cms.EDFilter("HLTTriggerTypeFilter",
    SelectedTriggerType = cms.int32(1)
)

# L1 Trigger Bit Selection (bit 40 and 41 for BSC trigger)
process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskTechTrigConfig_cff')
process.load('HLTrigger/HLTfilters/hltLevel1GTSeed_cfi')
process.hltLevel1GTSeed.L1TechTriggerSeeding = True
process.hltLevel1GTSeed.L1SeedsLogicalExpression = 'NOT (36 OR 37 OR 38 OR 39)'

# HLT trigger selection (HLT_ZeroBias)
# modified for 0 Tesla HLT menu (no ZeroBias_*)
process.load('HLTrigger.HLTfilters.hltHighLevel_cfi')
if (process.runType.getRunType() == process.runType.hi_run):
    #--------------------------
    # HI Runs HLT path
    #--------------------------
    process.hltHighLevel.HLTPaths = ['HLT_ZeroBias_*' , 'HLT_HIZeroBias*' , 'HLT_ZeroBias1_*' , 'HLT_PAZeroBias_*' , 'HLT_PAZeroBias1_*', 'HLT_PAL1MinimumBiasHF_OR_SinglePixelTrack_*' , 'HLT_HICentralityVeto*','HLT_HIMinimumBias*', 'HLT_HIPhysics*']
else:
    process.hltHighLevel.HLTPaths = ['HLT_ZeroBias_*' , 'HLT_ZeroBias1_*' , 'HLT_PAZeroBias_*' , 'HLT_PAZeroBias1_*', 'HLT_PAL1MinimumBiasHF_OR_SinglePixelTrack_*']
process.hltHighLevel.andOr = True
process.hltHighLevel.throw = False

if (process.runType.getRunType() == process.runType.hi_run):
    process.RecoForDQM_LocalReco     = cms.Sequence(process.siPixelDigis*process.siStripDigis*process.trackerlocalreco)
else :
    process.RecoForDQM_LocalReco     = cms.Sequence(process.siPixelDigis*process.siStripDigis*process.gtDigis*process.trackerlocalreco)

process.DQMCommon = cms.Sequence(process.dqmEnv*process.dqmEnvTr*process.dqmSaver)#*process.dqmSaverPB)

print("Running with run type = ", process.runType.getRunTypeName())

### HEAVY ION SETTING
if process.runType.getRunType() == process.runType.hi_run:
    rawDataRepackerLabel = 'rawDataRepacker'
    process.castorDigis.InputLabel = rawDataRepackerLabel
    process.csctfDigis.producer = rawDataRepackerLabel
    process.dttfDigis.DTTF_FED_Source = rawDataRepackerLabel
    process.ecalDigisCPU.InputLabel = rawDataRepackerLabel
    process.ecalPreshowerDigis.sourceTag = rawDataRepackerLabel
    process.gctDigis.inputLabel = rawDataRepackerLabel
    process.hcalDigis.InputLabel = rawDataRepackerLabel
    process.muonCSCDigis.InputObjects = rawDataRepackerLabel
    process.muonDTDigis.inputLabel = rawDataRepackerLabel
    process.muonRPCDigis.InputLabel = rawDataRepackerLabel
    process.scalersRawToDigi.scalersInputTag = rawDataRepackerLabel
    process.siPixelDigis.InputLabel = rawDataRepackerLabel
    process.siStripDigis.ProductLabel = rawDataRepackerLabel
    process.tcdsDigis.InputLabel = rawDataRepackerLabel

    if ((process.runType.getRunType() == process.runType.hi_run) and live):
        process.source.SelectEvents = [
#            'HLT_HICentralityVeto*', # present in 2018 and 2022 HIon menus
            'HLT_HIMinimumBias*',     # replaced HLT_HICentralityVeto starting from the 2023 HIon menu
#            'HLT_HIZeroBias*',       # present in DQM stream of HIon menu, but not used in this client
            'HLT_HIPhysics*'
        ]

    process.load('RecoTracker.IterativeTracking.InitialStepPreSplitting_cff')
    process.InitialStepPreSplittingTask.remove(process.initialStepTrackRefsForJetsPreSplitting)
    process.InitialStepPreSplittingTask.remove(process.caloTowerForTrkPreSplitting)
    process.InitialStepPreSplittingTask.remove(process.ak4CaloJetsForTrkPreSplitting)
    process.InitialStepPreSplittingTask.remove(process.jetsForCoreTrackingPreSplitting)
    process.InitialStepPreSplittingTask.remove(process.siPixelClusters)
    process.InitialStepPreSplittingTask.remove(process.siPixelRecHits)
    process.InitialStepPreSplittingTask.remove(process.MeasurementTrackerEvent)

    # Redefinition of siPixelClusters: has to be after RecoTracker.IterativeTracking.InitialStepPreSplitting_cff
    from RecoLocalTracker.SiPixelClusterizer.SiPixelClusterizer_cfi import siPixelClusters as _siPixelClusters
    process.siPixelClusters = _siPixelClusters.clone()

    # Select events based on the pixel cluster multiplicity
    import  HLTrigger.special.hltPixelActivityFilter_cfi
    process.multFilter = HLTrigger.special.hltPixelActivityFilter_cfi.hltPixelActivityFilter.clone(
        inputTag = 'siPixelClusters',
        minClusters = 1,
        maxClusters = 50000
    )

    from RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import *
    process.PixelLayerTriplets.BPix.HitProducer = 'siPixelRecHitsPreSplitting'
    process.PixelLayerTriplets.FPix.HitProducer = 'siPixelRecHitsPreSplitting'
    from RecoTracker.PixelTrackFitting.PixelTracks_cff import *
    process.pixelTracksHitTriplets.SeedComparitorPSet.clusterShapeCacheSrc = 'siPixelClusterShapeCachePreSplitting'

    process.RecoForDQM_TrkReco = cms.Sequence(
        process.offlineBeamSpot
      * process.MeasurementTrackerEventPreSplitting
      * process.siPixelClusterShapeCachePreSplitting
      * process.recopixelvertexing
      * process.InitialStepPreSplitting
    )

    # append the approximate clusters monitoring for the HI run case
    from DQM.SiStripMonitorApproximateCluster.SiStripMonitorApproximateCluster_cfi import SiStripMonitorApproximateCluster
    process.siStripApproximateClusterComparator = SiStripMonitorApproximateCluster.clone(
        compareClusters = True,
        ClustersProducer = "siStripClusters"
    )

    process.p = cms.Path(
        process.scalersRawToDigi*
        process.tcdsDigis*
        process.onlineMetaDataDigis*
        process.APVPhases*
        process.consecutiveHEs*
        process.hltTriggerTypeFilter*
        process.RecoForDQM_LocalReco*
        process.siPixelClusters*
        process.DQMCommon*
        process.multFilter*
        ##### TRIGGER SELECTION #####
        process.hltHighLevel*
        process.RecoForDQM_TrkReco*
        process.siStripApproximateClusterComparator
    )

### process customizations included here
from DQM.Integration.config.online_customizations_cfi import *
process = customise(process)
print("Global Tag used:", process.GlobalTag.globaltag.value())
print("Final Source settings:", process.source)