DESY Hbb Analysis Framework
AnalyserSimpleExample.cc
Go to the documentation of this file.
2 
3 // this example is a dijet analysis in which the leading jet
4 // is required to have a muon, and both of the leading
5 // jets are btagged
6 
7 using namespace std;
8 using namespace analysis;
9 using namespace analysis::tools;
10 
11 int main(int argc, char ** argv)
12 {
13  TH1::SetDefaultSumw2(); // proper treatment of errors when scaling histograms
14 
15  Analyser analyser(argc,argv);
16 
17 // HISTOGRAMS
18  // create some predefined jet histograms
19  analyser.jetHistograms(2,"initial");
20  analyser.jetHistograms(2,"final");
21  // create some predefined muon histograms
22  // muon histograms still not available
23 
24  for ( int i = 0 ; i < analyser.nEvents() ; ++i )
25  {
26  if ( ! analyser.event(i) ) continue;
27 
28 // MUONS pre-selection
29  // muon identification selection
30  if ( ! analyser.selectionMuonId() ) continue;
31  if ( ! analyser.selectionNMuons() ) continue;
32 
33 // JETS pre-selection
34  // jet identification selection
35  if ( ! analyser.selectionJetId() ) continue;
36  if ( ! analyser.selectionJetPileupId() ) continue;
37  if ( ! analyser.selectionNJets() ) continue;
38 
39  analyser.fillJetHistograms("initial");
40 
41 // CORRECTIONS
42  // b energy regression
43  if ( analyser.config()->bRegression() ) analyser.actionApplyBjetRegression();
44  // Jet energy resolution smearing
45  analyser.actionApplyJER();
46 
47 // MAIN SELECTION
48  // JETS
49  // 1st and 2nd jet kinematic selection, pt and eta
50  if ( ! analyser.selectionJet(1) ) continue;
51  if ( ! analyser.selectionJet(2) ) continue;
52  // delta R jet selection
53  if ( ! analyser.selectionJetDr(1,2) ) continue;
54  // btag of two leading jets
55  if ( ! analyser.selectionBJet(1) ) continue; analyser.actionApplyBtagSF(1);
56  if ( ! analyser.selectionBJet(2) ) continue; analyser.actionApplyBtagSF(2);
57 
58  // MUON
59  // muon kinematic selection
60  if ( ! analyser.selectionMuons() ) continue;
61 
62 // TRIGGER selection
63  if ( ! analyser.selectionL1 () ) continue; // to be used mainly in case of "OR" of seeds
64  if ( ! analyser.selectionHLT() ) continue;
65  // jets 1 and 2 matching to online jets and btag
66  if ( ! analyser.onlineJetMatching(1) ) continue;
67  if ( ! analyser.onlineBJetMatching(1) ) continue;
68  if ( ! analyser.onlineJetMatching(2) ) continue;
69  if ( ! analyser.onlineBJetMatching(2) ) continue;
70  // muon trigger matching
71  if ( ! analyser.onlineMuonMatching() ) continue;
72 
73 // HISTOGRAMS
74  analyser.fillJetHistograms("final");
75 
76  } //end event loop
77 } // end main
78 
std::shared_ptr< Config > config()
returns pointer to Config object
virtual bool selectionJet(const int &r)
Given the ranking &#39;r&#39; of a jet, it returns whether the jet passes the pt_min and |eta_max|, optionally pt_max, where the values of the thresholds pt_min and |eta_max|, pt_max are passed by configuration file.
Definition: JetAnalyser.cc:378
int main(int argc, char **argv)
virtual void fillJetHistograms(const std::string &label="x")
Fill the pre-defined histograms created by the jetHistograms() method.
Definition: JetAnalyser.cc:795
virtual bool onlineJetMatching(const int &)
Definition: JetAnalyser.cc:746
virtual bool onlineBJetMatching(const int &)
Definition: JetAnalyser.cc:778
virtual bool selectionBJet(const int &)
Definition: JetAnalyser.cc:708
virtual void jetHistograms(const int &n, const std::string &label="x")
Creates pre-defined histograms in directory &#39;label&#39; for analysis with &#39;n&#39; jets.
Definition: JetAnalyser.cc:172
virtual bool selectionJetDr(const int &r1, const int &r2)
Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_R selection; t...
Definition: JetAnalyser.cc:541
virtual float actionApplyBtagSF(const int &, const bool &global_weight=true)
virtual bool event(const int &)
Read event and perform basic selections and actions.
Definition: Analyser.cc:42
int nEvents()
number of events to be processed
virtual void actionApplyBjetRegression()
virtual bool selectionJetPileupId()
Definition: JetAnalyser.cc:646