CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HLTInfo Class Reference

#include <HLTInfo.h>

Public Member Functions

void analyze (const edm::Handle< edm::TriggerResults > &hltresults, const edm::Handle< GlobalAlgBlkBxCollection > &l1results, edm::EventSetup const &eventSetup, edm::Event const &iEvent, TTree *tree)
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 
template<typename T >
 HLTInfo (edm::ParameterSet const &pset, edm::ConsumesCollector &&iC, T &module)
 
template<typename T >
 HLTInfo (edm::ParameterSet const &pset, edm::ConsumesCollector &iC, T &module)
 
void setup (const edm::ParameterSet &pSet, TTree *tree)
 

Private Member Functions

 HLTInfo ()
 

Private Attributes

bool _Debug
 
bool _OR_BXes
 
TString * algoBitToName
 
unsigned long long cache_id_
 
std::vector< std::string > dummyBranches_
 
int HltEvtCnt
 
float * hltpeta
 
float * hltppt
 
std::unique_ptr< HLTPrescaleProviderhltPrescaleProvider_
 
int L1EvtCnt
 
int * l1flag
 
int * l1flag5Bx
 
int * l1Prescl
 
int * l1techflag
 
int * l1techPrescl
 
int nhltpart
 
std::string processName_
 
TString * techBitToName
 
int * trigflag
 
int * trigPrescl
 
int UnpackBxInEvent
 

Detailed Description

$Date: November 2006 $Revision:

Author
P. Bargassa - Rice U. $Date: April 2016
$Revision:
G. Karapostoli - ULB

Definition at line 52 of file HLTInfo.h.

Constructor & Destructor Documentation

◆ HLTInfo() [1/3]

template<typename T >
HLTInfo::HLTInfo ( edm::ParameterSet const &  pset,
edm::ConsumesCollector &&  iC,
T module 
)

Definition at line 108 of file HLTInfo.h.

108 : HLTInfo(pset, iC, module) {}

◆ HLTInfo() [2/3]

template<typename T >
HLTInfo::HLTInfo ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 111 of file HLTInfo.h.

111  : HLTInfo() {
113 }

References hltPrescaleProvider_, and muonDTDigis_cfi::pset.

◆ HLTInfo() [3/3]

HLTInfo::HLTInfo ( )
private

Definition at line 22 of file HLTInfo.cc.

22  {
23  //set parameter defaults
24  _Debug = false;
25  _OR_BXes = false;
26  UnpackBxInEvent = 1;
27 }

References _Debug, _OR_BXes, and UnpackBxInEvent.

Member Function Documentation

◆ analyze()

void HLTInfo::analyze ( const edm::Handle< edm::TriggerResults > &  hltresults,
const edm::Handle< GlobalAlgBlkBxCollection > &  l1results,
edm::EventSetup const &  eventSetup,
edm::Event const &  iEvent,
TTree *  tree 
)

Analyze the Data

Definition at line 84 of file HLTInfo.cc.

88  {
89  // std::cout << " Beginning HLTInfo " << std::endl;
90 
92  if (hltresults.isValid()) {
93  int ntrigs = hltresults->size();
94  if (ntrigs == 0) {
95  std::cout << "%HLTInfo -- No trigger name given in TriggerResults of the input " << std::endl;
96  }
97 
98  edm::TriggerNames const& triggerNames = iEvent.triggerNames(*hltresults);
99 
100  // 1st event : Book as many branches as trigger paths provided in the input...
101  if (HltEvtCnt == 0) {
102  for (int itrig = 0; itrig != ntrigs; ++itrig) {
103  TString trigName = triggerNames.triggerName(itrig);
104  HltTree->Branch(trigName, trigflag + itrig, trigName + "/I");
105  HltTree->Branch(trigName + "_Prescl", trigPrescl + itrig, trigName + "_Prescl/I");
106  }
107 
108  int itdum = ntrigs;
109  for (auto& dummyBranche : dummyBranches_) {
110  TString trigName(dummyBranche.data());
111  bool addThisBranch = true;
112  for (int itrig = 0; itrig != ntrigs; ++itrig) {
113  TString realTrigName = triggerNames.triggerName(itrig);
114  if (trigName == realTrigName)
115  addThisBranch = false;
116  }
117  if (addThisBranch) {
118  HltTree->Branch(trigName, trigflag + itdum, trigName + "/I");
119  HltTree->Branch(trigName + "_Prescl", trigPrescl + itdum, trigName + "_Prescl/I");
120  trigflag[itdum] = 0;
121  trigPrescl[itdum] = 0;
122  ++itdum;
123  }
124  }
125 
126  HltEvtCnt++;
127  }
128  // ...Fill the corresponding accepts in branch-variables
129 
130  //std::cout << "Number of prescale sets: " << hltConfig_.prescaleSize() << std::endl;
131  //std::cout << "Number of HLT paths: " << hltConfig_.size() << std::endl;
132  //int presclSet = hltConfig_.prescaleSet(iEvent, eventSetup);
133  //std::cout<<"\tPrescale set number: "<< presclSet <<std::endl;
134 
135  for (int itrig = 0; itrig != ntrigs; ++itrig) {
136  const std::string& trigName = triggerNames.triggerName(itrig);
137  bool accept = hltresults->accept(itrig);
138 
139  //trigPrescl[itrig] = hltConfig_.prescaleValue(iEvent, eventSetup, trigName);
140  trigPrescl[itrig] = hltPrescaleProvider_->prescaleValue(iEvent, eventSetup, trigName);
141 
142  if (accept) {
143  trigflag[itrig] = 1;
144  } else {
145  trigflag[itrig] = 0;
146  }
147 
148  if (_Debug) {
149  if (_Debug)
150  std::cout << "%HLTInfo -- Number of HLT Triggers: " << ntrigs << std::endl;
151  std::cout << "%HLTInfo -- HLTTrigger(" << itrig << "): " << trigName << " = " << accept << std::endl;
152  }
153  }
154  } else {
155  if (_Debug)
156  std::cout << "%HLTInfo -- No Trigger Result" << std::endl;
157  }
158 
159  //==============L1 information=======================================
160 
161  // L1 Triggers from Menu
162  L1GtUtils const& l1GtUtils = hltPrescaleProvider_->l1GtUtils();
163 
164  // m_l1GtUtils.retrieveL1EventSetup(eventSetup);
165  //m_l1GtUtils.getL1GtRunCache(iEvent,eventSetup,useL1EventSetup,useL1GtTriggerMenuLite);
166  /*
167  unsigned long long id = eventSetup.get<L1TUtmTriggerMenuRcd>().cacheIdentifier();
168 
169  if (id != cache_id_) {
170  cache_id_ = id;
171  */
173  eventSetup.get<L1TUtmTriggerMenuRcd>().get(menu);
174  //std::map<std::string, L1TUtmAlgorithm> const & algorithmMap_ = &(menu->getAlgorithmMap());
175  /*
176  // get the bit/name association
177  for (auto const & keyval: menu->getAlgorithmMap()) {
178  std::string const & name = keyval.second.getName();
179  unsigned int index = keyval.second.getIndex();
180  std::cerr << "bit: " << index << "\tname: " << name << std::endl;
181  }
182  */
183  //} // end get menu
184 
185  int iErrorCode = -1;
187  const int pfSetIndexAlgorithmTrigger = l1GtUtils.prescaleFactorSetIndex(iEvent, trigCategory, iErrorCode);
188  if (iErrorCode == 0) {
189  if (_Debug)
190  std::cout << "%Prescale set index: " << pfSetIndexAlgorithmTrigger << std::endl;
191  } else {
192  std::cout << "%Could not extract Prescale set index from event record. Error code: " << iErrorCode << std::endl;
193  }
194 
195  // 1st event : Book as many branches as trigger paths provided in the input...
196  if (l1results.isValid()) {
197  int ntrigs = l1results->size();
198  if (ntrigs == 0) {
199  std::cout << "%L1Results -- No trigger name given in TriggerResults of the input " << std::endl;
200  }
201  /*
202  edm::TriggerNames const& triggerNames = iEvent.triggerNames(&results);
203  // 1st event : Book as many branches as trigger paths provided in the input...
204  */
205  if (L1EvtCnt == 0) {
206  // get the bit/name association
207  for (auto const& keyval : menu->getAlgorithmMap()) {
208  std::string const& trigName = keyval.second.getName();
209  unsigned int index = keyval.second.getIndex();
210  if (_Debug)
211  std::cerr << "bit: " << index << "\tname: " << trigName << std::endl;
212 
213  int itrig = index;
214  algoBitToName[itrig] = TString(trigName);
215 
216  TString l1trigName = static_cast<const char*>(algoBitToName[itrig]);
217  std::string l1triggername = static_cast<const char*>(algoBitToName[itrig]);
218 
219  HltTree->Branch(l1trigName, l1flag + itrig, l1trigName + "/I");
220  HltTree->Branch(l1trigName + "_Prescl", l1Prescl + itrig, l1trigName + "_Prescl/I");
221 
222  } // end algo Map
223 
224  L1EvtCnt++;
225  } // end l1evtCnt=0
226 
227  GlobalAlgBlk const& result = l1results->at(0, 0);
228 
229  // get the individual decisions from the GlobalAlgBlk
230  for (unsigned int itrig = 0; itrig < result.maxPhysicsTriggers; ++itrig) {
231  // std::cerr << "bit: " << itrig << "\tresult: " << results.getAlgoDecisionFinal(itrig) << std::endl;
232 
233  bool myflag = result.getAlgoDecisionFinal(itrig);
234  if (myflag) {
235  l1flag[itrig] = 1;
236  } else {
237  l1flag[itrig] = 0;
238  }
239 
240  std::string l1triggername = static_cast<const char*>(algoBitToName[itrig]);
241  l1Prescl[itrig] = l1GtUtils.prescaleFactor(iEvent, l1triggername, iErrorCode);
242 
243  if (_Debug)
244  std::cout << "L1 TD: " << itrig << " " << algoBitToName[itrig] << " " << l1flag[itrig] << " " << l1Prescl[itrig]
245  << std::endl;
246  }
247 
248  // L1EvtCnt++;
249  if (_Debug)
250  std::cout << "%L1Info -- Done with routine" << std::endl;
251 
252  } // l1results.isValid
253  else {
254  if (_Debug)
255  std::cout << "%L1Results -- No Trigger Result" << std::endl;
256  }
257 }

References _Debug, accept(), algoBitToName, L1GtUtils::AlgorithmTrigger, beam_dqm_sourceclient-live_cfg::cerr, gather_cfg::cout, dummyBranches_, edm::EventSetup::get(), get, HltEvtCnt, hltPrescaleProvider_, HLTBitAnalyser_cfi::hltresults, iEvent, L1EvtCnt, l1flag, l1Prescl, HLTBitAnalyser_cfi::l1results, optionsL1T::menu, L1GtUtils::prescaleFactor(), L1GtUtils::prescaleFactorSetIndex(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, trigflag, L1TEGammaOffline_cfi::triggerNames, EgHLTOffTrigSelection_cfi::trigName, and trigPrescl.

Referenced by HLTBitAnalyzer::analyze().

◆ beginRun()

void HLTInfo::beginRun ( const edm::Run run,
const edm::EventSetup c 
)

Definition at line 29 of file HLTInfo.cc.

29  {
30  bool changed(true);
31  if (hltPrescaleProvider_->init(run, c, processName_, changed)) {
32  // if init returns TRUE, initialisation has succeeded!
33  if (changed) {
34  // The HLT config has actually changed wrt the previous Run, hence rebook your
35  // histograms or do anything else dependent on the revised HLT config
36  std::cout << "Initalizing HLTConfigProvider" << std::endl;
37  }
38  } else {
39  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
40  // with the file and/or code and needs to be investigated!
41  std::cout << " HLT config extraction failure with process name " << processName_ << std::endl;
42  // In this case, all access methods will return empty values!
43  }
44 }

References HltBtagPostValidation_cff::c, gather_cfg::cout, hltPrescaleProvider_, processName_, and writedatasetfile::run.

Referenced by HLTBitAnalyzer::beginRun().

◆ setup()

void HLTInfo::setup ( const edm::ParameterSet pSet,
TTree *  tree 
)

Definition at line 47 of file HLTInfo.cc.

47  {
48  processName_ = pSet.getParameter<std::string>("HLTProcessName");
49 
50  edm::ParameterSet myHltParams = pSet.getParameter<edm::ParameterSet>("RunParameters");
51  std::vector<std::string> parameterNames = myHltParams.getParameterNames();
52 
53  for (auto& parameterName : parameterNames) {
54  if (parameterName == "Debug")
55  _Debug = myHltParams.getParameter<bool>(parameterName);
56  }
57 
58  dummyBranches_ = pSet.getUntrackedParameter<std::vector<std::string> >("dummyBranches", std::vector<std::string>(0));
59 
60  HltEvtCnt = 0;
61  const int kMaxTrigFlag = 10000;
62  trigflag = new int[kMaxTrigFlag];
63  trigPrescl = new int[kMaxTrigFlag];
64 
65  L1EvtCnt = 0;
66  const int kMaxL1Flag = 10000;
67  l1flag = new int[kMaxL1Flag];
68  l1flag5Bx = new int[kMaxTrigFlag];
69  l1Prescl = new int[kMaxL1Flag];
70 
71  l1techflag = new int[kMaxL1Flag];
72  // l1techflag5Bx = new int[kMaxTrigFlag];
73  l1techPrescl = new int[kMaxTrigFlag];
74 
75  const int kMaxHLTPart = 10000;
76  hltppt = new float[kMaxHLTPart];
77  hltpeta = new float[kMaxHLTPart];
78 
79  algoBitToName = new TString[512];
80  techBitToName = new TString[512];
81 }

References _Debug, algoBitToName, dummyBranches_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), edm::ParameterSet::getUntrackedParameter(), HltEvtCnt, hltpeta, hltppt, L1EvtCnt, l1flag, l1flag5Bx, l1Prescl, l1techflag, l1techPrescl, processName_, AlCaHLTBitMon_QueryRunRegistry::string, techBitToName, trigflag, and trigPrescl.

Referenced by HLTBitAnalyzer::HLTBitAnalyzer().

Member Data Documentation

◆ _Debug

bool HLTInfo::_Debug
private

Definition at line 104 of file HLTInfo.h.

Referenced by analyze(), HLTInfo(), and setup().

◆ _OR_BXes

bool HLTInfo::_OR_BXes
private

Definition at line 91 of file HLTInfo.h.

Referenced by HLTInfo().

◆ algoBitToName

TString* HLTInfo::algoBitToName
private

Definition at line 82 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ cache_id_

unsigned long long HLTInfo::cache_id_
private

Definition at line 97 of file HLTInfo.h.

◆ dummyBranches_

std::vector<std::string> HLTInfo::dummyBranches_
private

Definition at line 84 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ HltEvtCnt

int HLTInfo::HltEvtCnt
private

Definition at line 77 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ hltpeta

float * HLTInfo::hltpeta
private

Definition at line 76 of file HLTInfo.h.

Referenced by setup().

◆ hltppt

float* HLTInfo::hltppt
private

Definition at line 76 of file HLTInfo.h.

Referenced by setup().

◆ hltPrescaleProvider_

std::unique_ptr<HLTPrescaleProvider> HLTInfo::hltPrescaleProvider_
private

Definition at line 88 of file HLTInfo.h.

Referenced by analyze(), beginRun(), and HLTInfo().

◆ L1EvtCnt

int HLTInfo::L1EvtCnt
private

Definition at line 77 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ l1flag

int * HLTInfo::l1flag
private

Definition at line 79 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ l1flag5Bx

int * HLTInfo::l1flag5Bx
private

Definition at line 79 of file HLTInfo.h.

Referenced by setup().

◆ l1Prescl

int * HLTInfo::l1Prescl
private

Definition at line 80 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ l1techflag

int * HLTInfo::l1techflag
private

Definition at line 79 of file HLTInfo.h.

Referenced by setup().

◆ l1techPrescl

int * HLTInfo::l1techPrescl
private

Definition at line 80 of file HLTInfo.h.

Referenced by setup().

◆ nhltpart

int HLTInfo::nhltpart
private

Definition at line 77 of file HLTInfo.h.

◆ processName_

std::string HLTInfo::processName_
private

Definition at line 89 of file HLTInfo.h.

Referenced by beginRun(), and setup().

◆ techBitToName

TString* HLTInfo::techBitToName
private

Definition at line 83 of file HLTInfo.h.

Referenced by setup().

◆ trigflag

int* HLTInfo::trigflag
private

Definition at line 79 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ trigPrescl

int* HLTInfo::trigPrescl
private

Definition at line 80 of file HLTInfo.h.

Referenced by analyze(), and setup().

◆ UnpackBxInEvent

int HLTInfo::UnpackBxInEvent
private

Definition at line 92 of file HLTInfo.h.

Referenced by HLTInfo().

HLTInfo::UnpackBxInEvent
int UnpackBxInEvent
Definition: HLTInfo.h:92
L1TUtmTriggerMenuRcd
Definition: L1TUtmTriggerMenuRcd.h:11
HLTBitAnalyser_cfi.hltresults
hltresults
Definition: HLTBitAnalyser_cfi.py:13
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HLTInfo::_OR_BXes
bool _OR_BXes
Definition: HLTInfo.h:91
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
HLTInfo::hltppt
float * hltppt
Definition: HLTInfo.h:76
HLTInfo::dummyBranches_
std::vector< std::string > dummyBranches_
Definition: HLTInfo.h:84
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
L1GtUtils::TriggerCategory
TriggerCategory
Definition: L1GtUtils.h:140
edm::ESHandle
Definition: DTSurvey.h:22
L1GtUtils
Definition: L1GtUtils.h:66
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EgHLTOffTrigSelection_cfi.trigName
trigName
Definition: EgHLTOffTrigSelection_cfi.py:8
HLTInfo::l1techflag
int * l1techflag
Definition: HLTInfo.h:79
optionsL1T.menu
menu
Definition: optionsL1T.py:29
edm::ParameterSet
Definition: ParameterSet.h:36
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
edm::ParameterSet::getParameterNames
std::vector< std::string > getParameterNames() const
Definition: ParameterSet.cc:656
iEvent
int iEvent
Definition: GenABIO.cc:224
HLTPrescaleProvider
Definition: HLTPrescaleProvider.h:37
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HLTInfo::trigPrescl
int * trigPrescl
Definition: HLTInfo.h:80
module
Definition: vlib.h:198
HLTInfo::techBitToName
TString * techBitToName
Definition: HLTInfo.h:83
get
#define get
HLTInfo::l1flag5Bx
int * l1flag5Bx
Definition: HLTInfo.h:79
L1GtUtils::AlgorithmTrigger
Definition: L1GtUtils.h:140
HLTBitAnalyser_cfi.l1results
l1results
Definition: HLTBitAnalyser_cfi.py:8
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HLTInfo::hltpeta
float * hltpeta
Definition: HLTInfo.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
HLTInfo::L1EvtCnt
int L1EvtCnt
Definition: HLTInfo.h:77
HLTInfo::algoBitToName
TString * algoBitToName
Definition: HLTInfo.h:82
HLTInfo::hltPrescaleProvider_
std::unique_ptr< HLTPrescaleProvider > hltPrescaleProvider_
Definition: HLTInfo.h:88
HLTInfo::processName_
std::string processName_
Definition: HLTInfo.h:89
L1GtUtils::prescaleFactorSetIndex
const int prescaleFactorSetIndex(const edm::Event &iEvent, const TriggerCategory &trigCategory, int &errorCode) const
Definition: L1GtUtils.cc:1274
HLTInfo::_Debug
bool _Debug
Definition: HLTInfo.h:104
edm::TriggerNames
Definition: TriggerNames.h:55
HLTInfo::HLTInfo
HLTInfo()
Definition: HLTInfo.cc:22
HLTInfo::l1techPrescl
int * l1techPrescl
Definition: HLTInfo.h:80
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
HLTInfo::l1flag
int * l1flag
Definition: HLTInfo.h:79
HLTInfo::l1Prescl
int * l1Prescl
Definition: HLTInfo.h:80
mps_fire.result
result
Definition: mps_fire.py:303
HLTInfo::HltEvtCnt
int HltEvtCnt
Definition: HLTInfo.h:77
HLTInfo::trigflag
int * trigflag
Definition: HLTInfo.h:79
GlobalAlgBlk
Definition: GlobalAlgBlk.h:41
L1GtUtils::prescaleFactor
const int prescaleFactor(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
Definition: L1GtUtils.cc:1083
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27