CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Static Public Attributes
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer Class Reference
Inheritance diagram for core.TriggerMatchAnalyzer.TriggerMatchAnalyzer:

Public Member Functions

def __init__ (self, cfg_ana, cfg_comp, looperName)
 
def beginLoop (self, setup)
 
def declareHandles (self)
 
def process (self, event)
 

Public Attributes

 fallbackName
 
 match1To1
 

Static Public Attributes

 collMatchDRCut
 
 collMatchSelectors
 
 collToMatch
 
 fallbackProcessName
 
 label
 
 name
 
 processName
 
 trgObjSelectors
 
 TriggerMatchAnalyzer
 
 univoqueMatching
 
 unpackPathNames
 
 verbose
 

Detailed Description

Definition at line 10 of file TriggerMatchAnalyzer.py.

Constructor & Destructor Documentation

def core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.__init__ (   self,
  cfg_ana,
  cfg_comp,
  looperName 
)

Definition at line 11 of file TriggerMatchAnalyzer.py.

References analyzer.Analyzer.cfg_ana, core.TriggerBitFilter.TriggerBitFilter.processName, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.processName, core.TriggerBitAnalyzer.TriggerBitAnalyzer.processName, EgammaHLTValidationUtils.EgammaDQMModuleMaker.processName, and Types.InputTag.processName.

11  def __init__(self, cfg_ana, cfg_comp, looperName ):
12  super(TriggerMatchAnalyzer,self).__init__(cfg_ana,cfg_comp,looperName)
13  self.processName = getattr(self.cfg_ana,"processName","PAT")
14  self.fallbackName = getattr(self.cfg_ana,"fallbackProcessName","RECO")
15  self.unpackPathNames = getattr(self.cfg_ana,"unpackPathNames",True)
16  self.label = self.cfg_ana.label
17  self.trgObjSelectors = []
18  self.trgObjSelectors.extend(getattr(self.cfg_ana,"trgObjSelectors",[]))
19  self.collToMatch = getattr(self.cfg_ana,"collToMatch",None)
20  self.collMatchSelectors = []
21  self.collMatchSelectors.extend(getattr(self.cfg_ana,"collMatchSelectors",[]))
22  self.collMatchDRCut = getattr(self.cfg_ana,"collMatchDRCut",0.3)
23  if self.collToMatch and not hasattr(self.cfg_ana,"univoqueMatching"): raise RuntimeError("Please specify if the matching to trigger objects should be 1-to-1 or 1-to-many")
24  self.match1To1 = getattr(self.cfg_ana,"univoqueMatching",True)
25 
def __init__(self, cfg_ana, cfg_comp, looperName)

Member Function Documentation

def core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.beginLoop (   self,
  setup 
)

Definition at line 32 of file TriggerMatchAnalyzer.py.

32  def beginLoop(self, setup):
33  super(TriggerMatchAnalyzer,self).beginLoop(setup)
34 
def core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.declareHandles (   self)

Definition at line 26 of file TriggerMatchAnalyzer.py.

References core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.fallbackName, core.TriggerBitAnalyzer.TriggerBitAnalyzer.fallbackName, core.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, core.TriggerBitFilter.TriggerBitFilter.processName, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.processName, core.TriggerBitAnalyzer.TriggerBitAnalyzer.processName, EgammaHLTValidationUtils.EgammaDQMModuleMaker.processName, and Types.InputTag.processName.

26  def declareHandles(self):
27  super(TriggerMatchAnalyzer, self).declareHandles()
28  self.handles['TriggerBits'] = AutoHandle( ('TriggerResults','','HLT'), 'edm::TriggerResults' )
29  fallback = ( 'selectedPatTrigger','', self.fallbackName) if self.fallbackName else None
30  self.handles['TriggerObjects'] = AutoHandle( ('selectedPatTrigger','',self.processName), 'std::vector<pat::TriggerObjectStandAlone>', fallbackLabel=fallback )
31 
def core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.process (   self,
  event 
)

Definition at line 35 of file TriggerMatchAnalyzer.py.

References core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.collMatchDRCut, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.collMatchSelectors, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.collToMatch, core.Analyzer.Analyzer.handles, HTTP.RequestManager.handles, join(), core.AutoHandle.AutoHandle.label, L1TriggerKeyExtViewer.label, SubDetParams.label, ElectronLikelihoodCategoryData.label, entry< T >.label, SiPixelFedFillerWordEventNumber.label, classes.PlotData.label, l1t::L1GtBoardTypeStringToEnum.label, TtEvent::HypoClassKeyStringToEnum.label, HcalLutSet.label, L1GtBoardTypeStringToEnum.label, ConverterTester.label, l1t::L1TGtObjectStringToEnum.label, L1GtObjectStringToEnum.label, TaggingVariablePlotter::VariableConfig.label, SiPixelRawToDigi.label, SiPixelQualityESProducer.label, muon::SelectionTypeStringToEnum.label, HLTVertexPerformanceAnalyzer.label, hltPlot.label, FWPSetTableManager::PSetData.label, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.label, L1GtPsbQuadStringToEnum.label, l1t::GtConditionTypeStringToEnum.label, DependencyGraph::node.label, MatrixInjector.MatrixInjector.label, ValidationMisalignedTracker.label, HLTBTagPerformanceAnalyzer.label, l1t::GtConditionCategoryStringToEnum.label, MatrixUtil.InputInfo.label, L1GtConditionTypeStringToEnum.label, cond::payloadInspector::ModuleVersion.label, L1GtConditionCategoryStringToEnum.label, FastTimerService::GroupOfModules.label, JsonOutputProducer::JsonVars.label, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.match1To1, deltar.matchObjectCollection(), deltar.matchObjectCollection3(), edm.print(), core.Analyzer.Analyzer.readCollections(), triggerObjects_cff.sel, str, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.trgObjSelectors, core.SkimAnalyzerCount.SkimAnalyzerCount.verbose, CSCTFanalyzer.verbose, VisualizationOptions.verbose, L1TdeStage2EMTF.verbose, heppy::Davismt2.verbose, L1TStage2uGMTMuon.verbose, DQMGenericTnPClient.verbose, L1TStage2EMTF.verbose, dqmTnP::AbstractFitter.verbose, L1TStage2uGMT.verbose, L1TStage2MuonComp.verbose, L1TStage2RegionalMuonCandComp.verbose, confdbOfflineConverter.OfflineConverter.verbose, L1TStage2OMTF.verbose, MuonMillepedeAlgorithm.verbose, DeviationsFromFileSensor2D.verbose, L1TStage2BMTF.verbose, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.verbose, L1TCaloLayer1.verbose, L1TCaloLayer1RawToDigi.verbose, HIPAlignmentAlgorithm.verbose, L1TCaloLayer1Validator.verbose, FFTJetLookupTableESProducer< CT >.verbose, FFTJetCorrectionESProducer< CT >.verbose, o2olib.O2OJobMgr.verbose, L1TStage2uGTCaloLayer2Comp.verbose, OpticalObject.verbose, L1TdeStage2CaloLayer2.verbose, and HltDiff.verbose.

35  def process(self, event):
36  self.readCollections( event.input )
37  triggerBits = self.handles['TriggerBits'].product()
38  allTriggerObjects = self.handles['TriggerObjects'].product()
39  names = event.input.object().triggerNames(triggerBits)
40  for ob in allTriggerObjects: ob.unpackPathNames(names)
41  triggerObjects = [ob for ob in allTriggerObjects if False not in [sel(ob) for sel in self.trgObjSelectors]]
42 
43  setattr(event,'trgObjects_'+self.label,triggerObjects)
44 
45  if self.collToMatch:
46  tcoll = getattr(event,self.collToMatch)
47  doubleandselector = lambda lep,ob: False if False in [sel(lep,ob) for sel in self.collMatchSelectors] else True
48  pairs = matchObjectCollection3(tcoll,triggerObjects,deltaRMax=self.collMatchDRCut,filter=doubleandselector) if self.match1To1 else matchObjectCollection(tcoll,triggerObjects,self.collMatchDRCut,filter=doubleandselector)
49  for lep in tcoll: setattr(lep,'matchedTrgObj'+self.label,pairs[lep])
50 
51  if self.verbose:
52  print('Verbose debug for triggerMatchAnalyzer %s'%self.label)
53  for ob in getattr(event,'trgObjects_'+self.label):
54  types = ", ".join([str(f) for f in ob.filterIds()])
55  filters = ", ".join([str(f) for f in ob.filterLabels()])
56  paths = ", ".join([("%s***" if f in set(ob.pathNames(True)) else "%s")%f for f in ob.pathNames()]) # asterisks indicate final paths fired by this object, see pat::TriggerObjectStandAlone class
57  print('Trigger object: pt=%.2f, eta=%.2f, phi=%.2f, collection=%s, type_ids=%s, filters=%s, paths=%s'%(ob.pt(),ob.eta(),ob.phi(),ob.collection(),types,filters,paths))
58  if self.collToMatch:
59  for lep in tcoll:
60  mstring = 'None'
61  ob = getattr(lep,'matchedTrgObj'+self.label)
62  if ob: mstring = 'trigger obj with pt=%.2f, eta=%.2f, phi=%.2f, collection=%s'%(ob.pt(),ob.eta(),ob.phi(),ob.collection())
63  print('Lepton pt=%.2f, eta=%.2f, phi=%.2f matched to %s'%(lep.pt(),lep.eta(),lep.phi(),mstring))
64 
65  return True
66 
67 
68 setattr(TriggerMatchAnalyzer,"defaultConfig",cfg.Analyzer(
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def matchObjectCollection
Definition: deltar.py:151
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
#define str(s)
def matchObjectCollection3
Definition: deltar.py:41

Member Data Documentation

core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.collMatchDRCut
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.collMatchSelectors
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.collToMatch
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.fallbackName
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.fallbackProcessName
static

Definition at line 72 of file TriggerMatchAnalyzer.py.

core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.label
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.match1To1
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.processName
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.trgObjSelectors
static
core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.TriggerMatchAnalyzer
static

Definition at line 69 of file TriggerMatchAnalyzer.py.

core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.univoqueMatching
static

Definition at line 78 of file TriggerMatchAnalyzer.py.

core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.unpackPathNames
static

Definition at line 73 of file TriggerMatchAnalyzer.py.

core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.verbose
static