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 59 of file HLTInfo.h.

Constructor & Destructor Documentation

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

Definition at line 122 of file HLTInfo.h.

124  :
125  HLTInfo(pset, iC, module) {
126 }
HLTInfo()
Definition: HLTInfo.cc:22
Definition: vlib.h:208
template<typename T >
HLTInfo::HLTInfo ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 129 of file HLTInfo.h.

References hltPrescaleProvider_.

131  :
132  HLTInfo() {
134 }
HLTInfo()
Definition: HLTInfo.cc:22
Definition: vlib.h:208
std::unique_ptr< HLTPrescaleProvider > hltPrescaleProvider_
Definition: HLTInfo.h:100
HLTInfo::HLTInfo ( )
private

Definition at line 22 of file HLTInfo.cc.

References _Debug, _OR_BXes, and UnpackBxInEvent.

22  {
23 
24  //set parameter defaults
25  _Debug=false;
26  _OR_BXes=false;
28 }
bool _Debug
Definition: HLTInfo.h:116
int UnpackBxInEvent
Definition: HLTInfo.h:104
bool _OR_BXes
Definition: HLTInfo.h:103

Member Function Documentation

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 93 of file HLTInfo.cc.

References _Debug, accept(), edm::HLTGlobalStatus::accept(), algoBitToName, L1GtUtils::AlgorithmTrigger, BXVector< T >::at(), MessageLogger_cfi::cerr, gather_cfg::cout, data, dummyBranches_, edm::EventSetup::get(), GlobalAlgBlk::getAlgoDecisionFinal(), L1TUtmTriggerMenu::getAlgorithmMap(), HltEvtCnt, hltPrescaleProvider_, iErrorCode, diffTreeTool::index, edm::HandleBase::isValid(), L1EvtCnt, l1flag, l1Prescl, GlobalAlgBlk::maxPhysicsTriggers, L1GtUtils::prescaleFactor(), L1GtUtils::prescaleFactorSetIndex(), mps_fire::result, edm::HLTGlobalStatus::size(), BXVector< T >::size(), AlCaHLTBitMon_QueryRunRegistry::string, trigflag, edm::TriggerNames::triggerName(), edm::Event::triggerNames(), and trigPrescl.

Referenced by HLTBitAnalyzer::analyze().

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

Definition at line 30 of file HLTInfo.cc.

References gather_cfg::cout, hltPrescaleProvider_, and processName_.

Referenced by HLTBitAnalyzer::beginRun().

30  {
31 
32 
33  bool changed(true);
34  if (hltPrescaleProvider_->init(run,c,processName_,changed)) {
35  // if init returns TRUE, initialisation has succeeded!
36  if (changed) {
37  // The HLT config has actually changed wrt the previous Run, hence rebook your
38  // histograms or do anything else dependent on the revised HLT config
39  std::cout << "Initalizing HLTConfigProvider" << std::endl;
40  }
41  } else {
42  // if init returns FALSE, initialisation has NOT succeeded, which indicates a problem
43  // with the file and/or code and needs to be investigated!
44  std::cout << " HLT config extraction failure with process name " << processName_ << std::endl;
45  // In this case, all access methods will return empty values!
46  }
47 
48 
49 
50 }
std::string processName_
Definition: HLTInfo.h:101
std::unique_ptr< HLTPrescaleProvider > hltPrescaleProvider_
Definition: HLTInfo.h:100
void HLTInfo::setup ( const edm::ParameterSet pSet,
TTree *  tree 
)

Definition at line 53 of file HLTInfo.cc.

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().

53  {
54 
55  processName_ = pSet.getParameter<std::string>("HLTProcessName") ;
56 
57  edm::ParameterSet myHltParams = pSet.getParameter<edm::ParameterSet>("RunParameters") ;
58  std::vector<std::string> parameterNames = myHltParams.getParameterNames() ;
59 
60  for ( std::vector<std::string>::iterator iParam = parameterNames.begin();
61  iParam != parameterNames.end(); iParam++ ){
62  if ( (*iParam) == "Debug" ) _Debug = myHltParams.getParameter<bool>( *iParam );
63  }
64 
65  dummyBranches_ = pSet.getUntrackedParameter<std::vector<std::string> >("dummyBranches",std::vector<std::string>(0));
66 
67  HltEvtCnt = 0;
68  const int kMaxTrigFlag = 10000;
69  trigflag = new int[kMaxTrigFlag];
70  trigPrescl = new int[kMaxTrigFlag];
71 
72  L1EvtCnt = 0;
73  const int kMaxL1Flag = 10000;
74  l1flag = new int[kMaxL1Flag];
75  l1flag5Bx = new int[kMaxTrigFlag];
76  l1Prescl = new int[kMaxL1Flag];
77 
78  l1techflag = new int[kMaxL1Flag];
79  // l1techflag5Bx = new int[kMaxTrigFlag];
80  l1techPrescl = new int[kMaxTrigFlag];
81 
82  const int kMaxHLTPart = 10000;
83  hltppt = new float[kMaxHLTPart];
84  hltpeta = new float[kMaxHLTPart];
85 
86  algoBitToName = new TString[512];
87  techBitToName = new TString[512];
88 
89 
90 }
bool _Debug
Definition: HLTInfo.h:116
int L1EvtCnt
Definition: HLTInfo.h:89
T getParameter(std::string const &) const
std::vector< std::string > dummyBranches_
Definition: HLTInfo.h:96
T getUntrackedParameter(std::string const &, T const &) const
int * l1Prescl
Definition: HLTInfo.h:92
int * l1techPrescl
Definition: HLTInfo.h:92
float * hltpeta
Definition: HLTInfo.h:88
std::string processName_
Definition: HLTInfo.h:101
TString * algoBitToName
Definition: HLTInfo.h:94
int HltEvtCnt
Definition: HLTInfo.h:89
std::vector< std::string > getParameterNames() const
int * l1flag
Definition: HLTInfo.h:91
TString * techBitToName
Definition: HLTInfo.h:95
int * trigPrescl
Definition: HLTInfo.h:92
int * l1techflag
Definition: HLTInfo.h:91
int * trigflag
Definition: HLTInfo.h:91
int * l1flag5Bx
Definition: HLTInfo.h:91
float * hltppt
Definition: HLTInfo.h:88

Member Data Documentation

bool HLTInfo::_Debug
private

Definition at line 116 of file HLTInfo.h.

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

bool HLTInfo::_OR_BXes
private

Definition at line 103 of file HLTInfo.h.

Referenced by HLTInfo().

TString* HLTInfo::algoBitToName
private

Definition at line 94 of file HLTInfo.h.

Referenced by analyze(), and setup().

unsigned long long HLTInfo::cache_id_
private

Definition at line 109 of file HLTInfo.h.

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

Definition at line 96 of file HLTInfo.h.

Referenced by analyze(), and setup().

int HLTInfo::HltEvtCnt
private

Definition at line 89 of file HLTInfo.h.

Referenced by analyze(), and setup().

float * HLTInfo::hltpeta
private

Definition at line 88 of file HLTInfo.h.

Referenced by setup().

float* HLTInfo::hltppt
private

Definition at line 88 of file HLTInfo.h.

Referenced by setup().

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

Definition at line 100 of file HLTInfo.h.

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

int HLTInfo::L1EvtCnt
private

Definition at line 89 of file HLTInfo.h.

Referenced by analyze(), and setup().

int * HLTInfo::l1flag
private

Definition at line 91 of file HLTInfo.h.

Referenced by analyze(), and setup().

int * HLTInfo::l1flag5Bx
private

Definition at line 91 of file HLTInfo.h.

Referenced by setup().

int * HLTInfo::l1Prescl
private

Definition at line 92 of file HLTInfo.h.

Referenced by analyze(), and setup().

int * HLTInfo::l1techflag
private

Definition at line 91 of file HLTInfo.h.

Referenced by setup().

int * HLTInfo::l1techPrescl
private

Definition at line 92 of file HLTInfo.h.

Referenced by setup().

int HLTInfo::nhltpart
private

Definition at line 89 of file HLTInfo.h.

std::string HLTInfo::processName_
private

Definition at line 101 of file HLTInfo.h.

Referenced by beginRun(), and setup().

TString* HLTInfo::techBitToName
private

Definition at line 95 of file HLTInfo.h.

Referenced by setup().

int* HLTInfo::trigflag
private

Definition at line 91 of file HLTInfo.h.

Referenced by analyze(), and setup().

int* HLTInfo::trigPrescl
private

Definition at line 92 of file HLTInfo.h.

Referenced by analyze(), and setup().

int HLTInfo::UnpackBxInEvent
private

Definition at line 104 of file HLTInfo.h.

Referenced by HLTInfo().