CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
EgammaHLTValidationUtils.EgammaDQMModuleMaker Class Reference

Public Member Functions

def __init__ (self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection=None)
 

Public Attributes

 path
 
 pathName
 
 process
 
 processName
 

Private Attributes

 __result
 

Detailed Description

a class which can be used to produce an analysis path
    for the EmDQM analyzer 

Definition at line 125 of file EgammaHLTValidationUtils.py.

Constructor & Destructor Documentation

def EgammaHLTValidationUtils.EgammaDQMModuleMaker.__init__ (   self,
  process,
  pathName,
  pdgGen,
  requiredNumberOfGeneratedObjects,
  cutCollection = None 
)
pathName is the HLT path to be validated.

pdgGen is the PDG id of the corersponding generated particles
  (11 for electrons, 22 for photons)

requiredNumberOfGeneratedObjects should be 1 for single triggers,
and 2 for double triggers (e.g. double photon triggers)

cutCollection is the name of the collection which should be used
  to define the acceptance region (at reconstruction level ?).
  typical values are 'fiducialZee'. If this is set to None,
  will be determined automatically from pdgGen and requiredNumberOfGeneratedObjects

Definition at line 131 of file EgammaHLTValidationUtils.py.

131  def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection = None):
132  """
133  pathName is the HLT path to be validated.
134 
135  pdgGen is the PDG id of the corersponding generated particles
136  (11 for electrons, 22 for photons)
137 
138  requiredNumberOfGeneratedObjects should be 1 for single triggers,
139  and 2 for double triggers (e.g. double photon triggers)
140 
141  cutCollection is the name of the collection which should be used
142  to define the acceptance region (at reconstruction level ?).
143  typical values are 'fiducialZee'. If this is set to None,
144  will be determined automatically from pdgGen and requiredNumberOfGeneratedObjects
145 
146  """
147 
148  self.process = process
149  self.pathName = pathName
150 
151  self.path = getattr(process,pathName)
152 
153  # the process whose products should be analyzed
154  self.processName = "HLT"
155 
156  #--------------------
157  # guess the collection for the fiducial volume cut
158  #--------------------
159 
160  if cutCollection == None:
161  cutCollection = "fiducial" + getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
162 
163  #--------------------
164  # find Et threshold of primary object
165  #--------------------
166  mo = re.match("HLT_.*?(\d+).*",pathName)
167 
168  if mo != None:
169  etThreshold = float(mo.group(1))
170  else:
171  etThreshold = -1.0
172 
173  #--------------------
174  # initialize the analyzer we put together here
175  #--------------------
176  from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
177  self.__result = DQMEDAnalyzer('EmDQM',
178  triggerobject = cms.InputTag("hltTriggerSummaryRAW","","HLT"),
179  genEtaAcc = cms.double(2.5),
180  genEtAcc = cms.double(2.0),
181  reqNum = cms.uint32(requiredNumberOfGeneratedObjects),
182  filters = cms.VPSet(), # will be added later
183  PtMax = cms.untracked.double(100.0),
184  genEtMin = cms.untracked.double(etThreshold),
185  pdgGen = cms.int32(pdgGen),
186  cutcollection = cms.InputTag(cutCollection),
187 
188  # is this a requirement on reconstructed or generated number of objects ?
189  cutnum = cms.int32(requiredNumberOfGeneratedObjects),
190 
191 
192 
193  )
194 
195  #--------------------
196  # get all modules of this path.
197  # dirty hack: assumes that all modules
198  # are concatenated by '+'
199  # but easier than to use a node visitor
200  # and order the modules ourselves afterwards..
201 
202  moduleNames = str(self.path).split('+')
203 
204  # now find out which of these are EDFilters
205  # and what CMSSW class type they are
206 
207  # example:
208  #
209  # CMSSW type module name
210  # --------------------------------------------------------------------------------------------------------------------
211  # HLTTriggerTypeFilter hltTriggerType
212  # HLTLevel1GTSeed hltL1sL1SingleEG8
213  # HLTPrescaler hltPreEle17SWTighterEleIdIsolL1R
214  # HLTEgammaL1MatchFilterRegional hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolL1MatchFilterRegional
215  # HLTEgammaEtFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolEtFilter
216  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolR9ShapeFilter
217  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolClusterShapeFilter
218  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TIghterEleIdIsolEcalIsolFilter
219  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHEFilter
220  # HLTEgammaGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolHcalIsolFilter
221  # HLTElectronPixelMatchFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolPixelMatchFilter
222  # HLTElectronOneOEMinusOneOPFilterRegional hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolOneOEMinusOneOPFilter
223  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDetaFilter
224  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolDphiFilter
225  # HLTElectronGenericFilter hltL1NonIsoHLTNonIsoSingleElectronEt17TighterEleIdIsolTrackIsolFilter
226  # HLTBool hltBoolEnd
227 
228  # it looks like in the MC menu, all modules have a name containing 'L1NonIso' and then
229  # have a parameter IsoCollections (which is mostly cms.Input("none")...)
230 
231  import FWCore.ParameterSet.Modules
232 
233  for moduleName in moduleNames:
234 
235  # add protection to avoid accessing non-existing modules
236  # (not understood why this is needed but happens
237  # in some cases...).
238  #
239  # should also cover the special cases listed afterwards
240  # (i.e. the check after this one could be removed
241  # at some point)
242  if not hasattr(self.process, moduleName):
243  continue
244 
245  # protection for FastSim HLT menu
246  # which seems to reference certain modules in some
247  # paths but these modules are not defined when just
248  # loading the HLT menu into a process object.
249  #
250  # this seems not to happen for the fullsim menu for some
251  # reason...
252  if moduleName in ('simulation',
253  'offlineBeamSpot',
254  'HLTEndSequence'):
255  continue
256 
257 
258 
259  module = getattr(self.process,moduleName)
260 
261  if not isinstance(module, FWCore.ParameterSet.Modules.EDFilter):
262  continue
263 
264  # ignore certain EDFilters
265  if module.type_() in ('HLTTriggerTypeFilter',
266  'HLTPrescaler',
267  'HLTBool'):
268  continue
269 
270  # print "XX", module.type_(), moduleName
271 
272  #--------------------
273  if module.type_() == 'HLTLevel1GTSeed':
274  # L1 seed
275  self.__result.filters.append(self.makePSetForL1SeedFilter(moduleName))
276  continue
277 
278  #--------------------
279  if module.type_() == 'HLTEgammaL1MatchFilterRegional':
280  # L1 seed to supercluster match
281  self.__result.filters.append(self.makePSetForL1SeedToSuperClusterMatchFilter(moduleName))
282  continue
283 
284  #--------------------
285 
286  if module.type_() == "HLTEgammaEtFilter":
287  # minimum Et requirement
288  self.__result.filters.append(self.makePSetForEtFilter(moduleName))
289  continue
290 
291  #--------------------
292 
293  if module.type_() == "HLTElectronOneOEMinusOneOPFilterRegional":
294  self.__result.filters.append(self.makePSetForOneOEMinusOneOPFilter(moduleName))
295  continue
296 
297  #--------------------
298  if module.type_() == "HLTElectronPixelMatchFilter":
299  self.__result.filters.append(self.makePSetForPixelMatchFilter(moduleName))
300  continue
301 
302  #--------------------
303  # generic filters: the module types
304  # aren't enough, we must check on which
305  # input collections they filter on
306  #--------------------
307 
308  if module.type_() == "HLTEgammaGenericFilter":
309 
310  pset = self.makePSetForEgammaGenericFilter(module, moduleName)
311  if pset != None:
312  self.__result.filters.append(pset)
313  continue
314 
315  #--------------------
316 
317  if module.type_() == "HLTElectronGenericFilter":
318 
319  pset = self.makePSetForElectronGenericFilter(module, moduleName)
320  if pset != None:
321  self.__result.filters.append(pset)
322  continue
323 
324  #--------------------
325 
def __init__(self, process, pathName, pdgGen, requiredNumberOfGeneratedObjects, cutCollection=None)
def getProcessName(pdgGen, requiredNumberOfGeneratedObjects)
double split
Definition: MVATrainer.cc:139

Member Data Documentation

EgammaHLTValidationUtils.EgammaDQMModuleMaker.__result
private
EgammaHLTValidationUtils.EgammaDQMModuleMaker.path
EgammaHLTValidationUtils.EgammaDQMModuleMaker.pathName

Definition at line 149 of file EgammaHLTValidationUtils.py.

EgammaHLTValidationUtils.EgammaDQMModuleMaker.process
EgammaHLTValidationUtils.EgammaDQMModuleMaker.processName