00001 import FWCore.ParameterSet.Config as cms
00002
00003
00004
00005
00006 use_new_method = False
00007
00008
00009 if not use_new_method:
00010
00011
00012
00013
00014 class dummy:
00015 pass
00016
00017 samples=dummy()
00018 paths=dummy()
00019
00020
00021
00022
00023
00024 samples.names = ['Wenu',
00025 'Zee',
00026 'GammaJet',
00027 'DiGamma']
00028 samples.pdgid = [ 11,
00029 11,
00030 22,
00031 22]
00032 samples.num = [1,
00033 2,
00034 1,
00035 2]
00036
00037
00038
00039 paths.Wenu = [
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 ]
00057
00058 paths.Zee = paths.Wenu + [
00059
00060
00061
00062
00063 ]
00064
00065 paths.GammaJet = [
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 ]
00080
00081 paths.DiGamma = [
00082
00083
00084 ]
00085
00086 pathlumi = { 'HLT_Ele17_SW_TighterEleIdIsol_L1RDQM': '8e29',
00087 'HLT_Ele10_LW_L1RDQM':'8e29',
00088 'HLT_Ele15_SW_L1RDQM':'1e31',
00089 'HLT_Ele10_LW_EleId_L1RDQM':'8e29',
00090 'HLT_Ele15_SiStrip_L1RDQM':'8e29',
00091 'HLT_DoubleEle5_SW_L1RDQM':'8e29',
00092 'HLT_Photon10_L1R_DQM':'8e29',
00093 'HLT_Photon15_TrackIso_L1R_DQM':'8e29',
00094 'HLT_Photon15_LooseEcalIso_L1R_DQM':'8e29',
00095 'HLT_Photon20_Cleaned_L1R_DQM':'8e29',
00096 'HLT_DoublePhoton10_L1R_DQM':'8e29',
00097 'HLT_Photon25_L1R_DQM':'1e31',
00098 'HLT_Photon25_LooseEcalIso_TrackIso_L1R_DQM':'1e31'}
00099
00100
00101 for path in paths.Wenu + paths.Zee + paths.GammaJet + paths.DiGamma:
00102 pathlumi[path] = '8e29'
00103
00104 lumiprocess = { '8e29':'HLT',
00105 '1e31':'HLT'
00106 }
00107
00108
00109
00110
00111
00112
00113 genp = cms.EDFilter("PdgIdAndStatusCandViewSelector",
00114 status = cms.vint32(3),
00115 src = cms.InputTag("genParticles"),
00116 pdgId = cms.vint32(11)
00117 )
00118
00119 fiducial = cms.EDFilter("EtaPtMinCandViewSelector",
00120 src = cms.InputTag("genp"),
00121 etaMin = cms.double(-2.5),
00122 etaMax = cms.double(2.5),
00123 ptMin = cms.double(2.0)
00124 )
00125
00126
00127
00128
00129
00130 tmp = cms.SequencePlaceholder("tmp")
00131 egammaSelectors = cms.Sequence(tmp)
00132 egammaValidators= cms.Sequence(tmp)
00133
00134
00135 for samplenum in range(len(samples.names)):
00136
00137
00138 genpartname = "genpart"+samples.names[samplenum]
00139 globals()[genpartname] = genp.clone()
00140 setattr(globals()[genpartname],"pdgId",cms.vint32(samples.pdgid[samplenum]) )
00141 egammaSelectors *= globals()[genpartname]
00142
00143
00144 fiducialname = "fiducial"+samples.names[samplenum]
00145 globals()[fiducialname] = fiducial.clone()
00146 setattr(globals()[fiducialname],"src",cms.InputTag(genpartname) )
00147 egammaSelectors *= globals()[fiducialname]
00148
00149
00150 for trig in getattr(paths,samples.names[samplenum]):
00151 trigname = trig + samples.names[samplenum]
00152
00153 filename = "HLTriggerOffline.Egamma."+trig+"_cfi"
00154 trigdef =__import__( filename )
00155 import sys
00156 globals()[trigname] = getattr(sys.modules[filename],trig).clone()
00157 setattr(globals()[trigname],"cutcollection",cms.InputTag(fiducialname))
00158 setattr(globals()[trigname],"cutnum",cms.int32( samples.num[samplenum] ))
00159 setattr(globals()[trigname],"pdgGen",cms.int32( samples.pdgid[samplenum]))
00160 getattr(globals()[trigname],'triggerobject').setProcessName( lumiprocess[pathlumi[trig]] )
00161 for filterpset in getattr(globals()[trigname],'filters'):
00162 getattr(filterpset,'HLTCollectionLabels').setProcessName( lumiprocess[pathlumi[trig]] )
00163 for isocollections in getattr(filterpset,'IsoCollections'):
00164 isocollections.setProcessName( lumiprocess[pathlumi[trig]])
00165
00166 egammaValidators *= globals()[trigname]
00167
00168
00169 egammaSelectors.remove(tmp)
00170 egammaValidators.remove(tmp)
00171
00172
00173 egammaValidationSequence = cms.Sequence( egammaValidators )
00174 egammaValidationSequenceFS = cms.Sequence( egammaValidators )
00175
00176 else:
00177
00178
00179
00180
00181 import sys, os
00182
00183
00184 msgPrefix = "[" + os.path.basename(__file__) + "]"
00185
00186 import HLTriggerOffline.Egamma.EgammaHLTValidationUtils as EgammaHLTValidationUtils
00187
00188
00189
00190
00191 configData = {
00192 "singleElectron": { "genPid" : 11, "numGenerated" : 1,},
00193 "doubleElectron": { "genPid" : 11, "numGenerated" : 2 },
00194 "singlePhoton": { "genPid" : 22, "numGenerated" : 1 },
00195 "doublePhoton": { "genPid" : 22, "numGenerated" : 2 },
00196 }
00197
00198
00199
00200
00201
00202
00203
00204 egammaSelectors = []
00205
00206 for hltPathCategory, thisCategoryData in configData.iteritems():
00207
00208
00209
00210
00211
00212 generatorRequirementSequence = EgammaHLTValidationUtils.makeGeneratedParticleAndFiducialVolumeFilter(None,
00213 thisCategoryData['genPid'],
00214 thisCategoryData['numGenerated'])
00215
00216
00217
00218
00219 for module in EgammaHLTValidationUtils.getModulesOfSequence(generatorRequirementSequence):
00220 globals()[module.label_()] = module
00221
00222
00223
00224
00225 del module
00226
00227 egammaSelectors.append(generatorRequirementSequence)
00228
00229
00230
00231
00232
00233 egammaValidators = []
00234 egammaValidatorsFS = []
00235
00236 for isFastSim, validators in (
00237 (False, egammaValidators),
00238 (True, egammaValidatorsFS),
00239 ):
00240
00241
00242
00243
00244 refProcess = cms.Process("REF")
00245
00246 if isFastSim:
00247 refProcess.load("FastSimulation.Configuration.HLT_GRun_cff")
00248 else:
00249 refProcess.load("HLTrigger.Configuration.HLT_GRun_cff")
00250
00251
00252
00253 pathsByCategory = EgammaHLTValidationUtils.findEgammaPaths(refProcess)
00254
00255 for hltPathCategory, thisCategoryData in configData.iteritems():
00256
00257
00258 paths = pathsByCategory[hltPathCategory]
00259
00260
00261
00262
00263 path = None
00264 dqmModule = None
00265
00266 for path in paths:
00267
00268
00269 pathName = path.label_()
00270
00271
00272
00273
00274
00275
00276
00277 moduleCXXtypes = EgammaHLTValidationUtils.getCXXTypesOfPath(refProcess,path)
00278
00279
00280 hasProblematicType = False
00281
00282 for problematicType in [
00283
00284 'HLTEgammaTriggerFilterObjectWrapper',
00285 'EgammaHLTPhotonTrackIsolationProducersRegional',
00286 ]:
00287
00288 if problematicType in moduleCXXtypes:
00289
00290 hasProblematicType = True
00291 break
00292
00293 if hasProblematicType:
00294 continue
00295
00296
00297
00298 dqmModuleName = pathName
00299 if isFastSim:
00300 dqmModuleName = dqmModuleName + "FastSim"
00301
00302 dqmModuleName = dqmModuleName + "_DQM"
00303
00304 dqmModule = EgammaHLTValidationUtils.EgammaDQMModuleMaker(refProcess, pathName,
00305 thisCategoryData['genPid'],
00306 thisCategoryData['numGenerated']
00307 ).getResult()
00308
00309
00310 globals()[dqmModuleName] = dqmModule
00311
00312
00313 validators.append(dqmModule)
00314
00315
00316
00317
00318
00319 del path
00320 del dqmModule
00321
00322
00323
00324
00325
00326 del refProcess
00327
00328
00329
00330
00331
00332
00333 import operator
00334
00335 egammaSelectors = cms.Sequence(reduce(operator.mul, egammaSelectors))
00336
00337
00338 egammaValidationSequence = cms.Sequence(reduce(operator.mul, egammaValidators))
00339 egammaValidationSequenceFS = cms.Sequence(reduce(operator.mul, egammaValidatorsFS))
00340
00341
00342