DESY Hbb Analysis Framework
AnalyserTriggerExample.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace analysis;
5 using namespace analysis::tools;
6 
7 int main(int argc, char ** argv)
8 {
9  TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histograms
10 
11  Analyser trigger(argc,argv);
12 
13  auto analysis = trigger.analysis(); // that's the usual Analysis class
14 
15  for ( int i = 0 ; i < trigger.nEvents() ; ++i )
16  {
17  if ( ! trigger.event(i) ) continue;
18  // trigger selection
19  if ( ! trigger.selectionHLT() ) continue;
20  if ( ! trigger.selectionL1 () ) continue; // to be used in case of "OR" of seeds
21 
22  // One can always use the usual Analysis to retrieve some information
23  auto l1jets_ana = analysis->collection<TriggerObject>(trigger.config()->triggerObjectsL1Jets());
24  for ( int j = 0 ; j < l1jets_ana->size() ; ++j )
25  {
26  TriggerObject l1jet = l1jets_ana->at(j);
27  std::cout << "L1 Jet (Analysis): pT = " << l1jet.pt() << ", " << l1jet.eta() << ", " << l1jet.phi() << std::endl;
28  }
29  std::cout << "----" << std::endl;
30 
31  // But sometimes there is a method in the analyser one can use directly
32  // L1 jets trigger objects
33  auto l1jets = trigger.triggerObjectsL1Jets();
34  for ( auto jet : l1jets )
35  {
36  std::cout << "L1 Jet (Analyser): pT = " << jet->pt() << ", " << jet->eta() << ", " << jet->phi() << std::endl;
37  }
38  std::cout << "====" << std::endl;
39  }
40 
41  return 0;
42 }
float eta() const
returns the pseudorapidity
Definition: Candidate.cc:134
std::shared_ptr< Config > config()
returns pointer to Config object
float phi() const
returns the azimuthal angle
Definition: Candidate.cc:135
int main(int argc, char **argv)
float pt() const
returns the transverse momentum
Definition: Candidate.cc:133
std::vector< std::shared_ptr< TriggerObject > > triggerObjectsL1Jets()
virtual bool event(const int &)
Read event and perform basic selections and actions.
Definition: Analyser.cc:42
std::shared_ptr< Analysis > analysis()
returns pointer to Analysis object
int nEvents()
number of events to be processed