DESY Hbb Analysis Framework
Public Member Functions | List of all members
analysis::tools::Analyser Class Reference

inheritance More...

#include <Analyser.h>

Inheritance diagram for analysis::tools::Analyser:
analysis::tools::TriggerAnalyser analysis::tools::JetAnalyser analysis::tools::MuonAnalyser analysis::tools::BaseAnalyser analysis::tools::BaseAnalyser analysis::tools::BaseAnalyser analysis::mssmhbb::MssmHbbAnalyser

Public Member Functions

 Analyser ()
 default constructor More...
 
 Analyser (int argc, char *argv[])
 main constructor More...
 
virtual bool event (const int &)
 Read event and perform basic selections and actions. More...
 
virtual bool muonJet (const int &)
 Assign muon to jet. More...
 
virtual bool preselection ()
 multiple actions: perform muon Id, jet Id and jet pileup Id selections More...
 
 ~Analyser ()
 desctructor More...
 
- Public Member Functions inherited from analysis::tools::TriggerAnalyser
virtual bool analysisWithTrigger ()
 
bool l1tJetsAnalysis () const
 
bool l1tMuonsAnalysis () const
 
virtual bool selectionHLT ()
 
virtual bool selectionL1 ()
 
virtual bool selectionTrigger ()
 
virtual bool selectionTriggerEmulated (const bool &, const bool &, const std::string &, const int &, const float &, const float &)
 
 TriggerAnalyser ()
 constructors More...
 
 TriggerAnalyser (int argc, char *argv[])
 
std::vector< std::shared_ptr< TriggerObject > > triggerObjectsCaloJets ()
 
std::vector< std::shared_ptr< TriggerObject > > triggerObjectsL1Jets ()
 
std::vector< std::shared_ptr< TriggerObject > > triggerObjectsL1Muons ()
 
std::vector< std::shared_ptr< TriggerObject > > triggerObjectsL3Muons ()
 
std::vector< std::shared_ptr< TriggerObject > > triggerObjectsPFJets ()
 
 ~TriggerAnalyser ()
 desctructor More...
 
- Public Member Functions inherited from analysis::tools::BaseAnalyser
void actionApplyPileupWeight (const int &var=0)
 apply pileup weight given a systematic variation More...
 
void analyserTree ()
 root tree More...
 
std::shared_ptr< Analysisanalysis ()
 returns pointer to Analysis object More...
 
 BaseAnalyser ()
 constructor More...
 
 BaseAnalyser (int argc, char *argv[])
 constructor More...
 
std::string basename (const std::string &)
 returns the basename of a path More...
 
std::map< std::string, std::shared_ptr< TGraphAsymmErrors > > btagEfficiencies () const
 
std::shared_ptr< Configconfig ()
 returns pointer to Config object More...
 
float crossSection () const
 returns cross section More...
 
int cutflow ()
 get cutflow index More...
 
void cutflow (const int &)
 set cutflow index More...
 
void cutflow (const std::string &label, const bool &ok=true)
 create and update cutflow entry in the cutflow histogram More...
 
void fillAnalyserTree ()
 fill root tree More...
 
void fillPileupHistogram ()
 fills pileup histogram More...
 
void generatorWeight ()
 generator weight More...
 
bool genJetsAnalysis () const
 returns whether analysis of gen jets can be done More...
 
bool genParticlesAnalysis () const
 returns whether analysis of gen particles can be done More...
 
std::shared_ptr< TH1F > histogram (const std::string &)
 returns a given 1D histogram More...
 
std::map< std::string, std::shared_ptr< TH1F > > histograms ()
 returns all 1D histograms More...
 
virtual void histograms (const std::string &, const int &)
 create n histograms of a given type More...
 
int nEvents ()
 number of events to be processed More...
 
std::shared_ptr< TFile > output ()
 returns pointer to output root file More...
 
void pileupHistogram ()
 creates pileup histogram More...
 
float pileupWeight (const float &truepu, const int &var) const
 returns pileup weight given the true pileup and uncertainty variation in values of sigma More...
 
std::shared_ptr< PileupWeightpileupWeights () const
 returns pointer to pileup weights (MC-only) More...
 
void scale (const float &)
 sets a scale More...
 
int seed ()
 returns a seed for random number generator More...
 
int seed (const std::string &)
 reads a file containing a seed and returns the seed or -1 if fails More...
 
void seed (const int &)
 sets a seed for random number generators More...
 
bool triggerEmulated (const std::string &)
 return status of an emulated l1 trigger More...
 
virtual bool triggerEmulation (const std::string &, const int &, const float &, const float &, const std::string &)
 emulate l1 trigger More...
 
std::map< std::string, bool > triggersEmulated ()
 return status of all emulated l1 triggers More...
 
float trueInteractions () const
 returns true number of interactions More...
 
float weight ()
 returns event weight More...
 
void weight (const float &)
 sets event weight More...
 
virtual ~BaseAnalyser ()
 desctructor More...
 
- Public Member Functions inherited from analysis::tools::JetAnalyser
virtual void actionApplyBjetRegression ()
 
virtual void actionApplyBjetRegression (const int &)
 
virtual float actionApplyBtagSF (const int &, const bool &global_weight=true)
 
virtual void actionApplyJER ()
 
virtual bool analysisWithJets ()
 
float btag (const Jet &jet, const std::string &algo)
 Returns the btag value of the jet for a given btag algorithm. More...
 
virtual ScaleFactors btagSF (const int &, const std::string &)
 
virtual void fillJetHistograms (const std::string &label="x")
 Fill the pre-defined histograms created by the jetHistograms() method. More...
 
virtual void fillJetHistograms (const int &r=-1, const std::string &label="x", const float &sf=1., const bool &workflow=false)
 For experts only (fills pre-defined histograms for a specific jet, applying weights) More...
 
virtual float getBtagSF (const int &)
 
 JetAnalyser ()
 constructors More...
 
 JetAnalyser (int argc, char *argv[])
 
virtual bool jetCorrections ()
 multiple actions: apply JER and b-tag regression corrections More...
 
virtual void jetHistograms (const int &n, const std::string &label="x")
 Creates pre-defined histograms in directory 'label' for analysis with 'n' jets. More...
 
virtual void jetHistograms (const std::string &label="x")
 Creates pre-defined histograms in directory 'label' for analysis with config->nJetsMin() More...
 
std::vector< std::shared_ptr< Jet > > jets ()
 vector of pointers of all jets from the "Jets" collection More...
 
void jets (const std::string &col)
 Creates the "Jets" collection. More...
 
virtual void jetSwap (const int &, const int &)
 
virtual bool onlineBJetMatching (const int &)
 
virtual bool onlineJetMatching (const int &)
 
std::vector< std::shared_ptr< Jet > > selectedJets ()
 vector of pointers of the selectedJets More...
 
virtual bool selectionBJet (const int &)
 
virtual bool selectionBJetProbB (const int &)
 
virtual bool selectionBJetProbBB (const int &)
 
virtual bool selectionBJetProbC (const int &)
 
virtual bool selectionBJetProbG (const int &)
 
virtual bool selectionBJetProbLepB (const int &)
 
virtual bool selectionBJetProbLight (const int &)
 
virtual bool selectionDiJetMass (const int &, const int &)
 
virtual bool selectionJet (const int &r)
 Given the ranking 'r' 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. More...
 
virtual bool selectionJet (const int &r, const float &pt_min, const float &eta_max, const float &pt_max=-1.)
 Given the ranking 'r' 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 (opt) are passed as arguments. More...
 
virtual bool selectionJetDeta (const int &r1, const int &r2)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_eta selection; the threshold delta is passed by the configuration file. More...
 
virtual bool selectionJetDeta (const int &r1, const int &r2, const float &delta)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_eta selection; the threshold delta is passed as an argument (if delta <= 0, |delta| = delta_min; else |delta| = delta_max ) More...
 
virtual bool selectionJetDphi (const int &r1, const int &r2)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_phi selection; the threshold delta is passed by the configuration file. More...
 
virtual bool selectionJetDphi (const int &r1, const int &r2, const float &delta)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_phi selection; the threshold delta is passed as an argument (if delta <= 0, |delta| = delta_min; else |delta| = delta_max ) More...
 
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; the threshold delta is passed by the configuration file. More...
 
virtual bool selectionJetDr (const int &r1, const int &r2, const float &delta)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_R selection; the threshold delta is passed as an argument (if delta <= 0, |delta| = delta_min; else |delta| = delta_max ) More...
 
virtual bool selectionJetId ()
 
virtual bool selectionJetPileupId ()
 
virtual bool selectionJetPtImbalance (const int &r1, const int &r2)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the pt imbalance selection; the threshold delta is passed by the configuration file. More...
 
virtual bool selectionJetPtImbalance (const int &r1, const int &r2, const float &delta)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the pt imbalance selection; the threshold delta is passed as an argument (if delta <= 0, |delta| = delta_min; else |delta| = delta_max ) More...
 
virtual bool selectionJetQGlikelihood (const int &, const float &)
 
virtual bool selectionJetQGlikelihood (const int &)
 
virtual bool selectionNJets ()
 
virtual bool selectionNonBJet (const int &)
 
 ~JetAnalyser ()
 desctructor More...
 
- Public Member Functions inherited from analysis::tools::MuonAnalyser
virtual bool analysisWithMuons ()
 
float btag (const Muon &, const std::string &)
 
virtual void fillMuonHistograms ()
 
 MuonAnalyser ()
 constructors More...
 
 MuonAnalyser (int argc, char *argv[])
 
virtual void muonHistograms (const std::string &, const int &n=1)
 
std::vector< std::shared_ptr< Muon > > muons ()
 
virtual bool onlineL1MuonMatching (const int &)
 
virtual bool onlineL3MuonMatching (const int &)
 
std::vector< std::shared_ptr< Muon > > onlineMatchedMuons ()
 
virtual bool onlineMuonMatching ()
 
std::vector< std::shared_ptr< Muon > > selectedMuons ()
 
virtual bool selectionMuon (const int &)
 
virtual bool selectionMuonDr (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; the threshold delta is passed by the configuration file. More...
 
virtual bool selectionMuonDr (const int &r1, const int &r2, const float &delta)
 Given the rankings r1 and r2 of two jets, it returns whether the jets passes the delta_R selection; the threshold delta is passed as an argument (if delta <= 0, |delta| = delta_min; else |delta| = delta_max ) More...
 
virtual bool selectionMuonId ()
 
virtual bool selectionMuons ()
 
virtual bool selectionNMuons ()
 
 ~MuonAnalyser ()
 desctructor More...
 

Additional Inherited Members

- Protected Attributes inherited from analysis::tools::TriggerAnalyser
bool l1tjetsanalysis_
 
bool l1tmuonsanalysis_
 
bool triggeranalysis_
 
- Protected Attributes inherited from analysis::tools::BaseAnalyser
std::shared_ptr< TTree > analyser_tree_
 output tree More...
 
std::shared_ptr< Analysisanalysis_
 Analysis objects. More...
 
std::map< std::string, std::shared_ptr< TGraphAsymmErrors > > btageff_
 
std::shared_ptr< Configconfig_
 Config objects. More...
 
int cutflow_
 Cutflow index. More...
 
bool genjetsanalysis_
 
bool genpartsanalysis_
 
std::map< std::string, std::shared_ptr< TH1F > > h1_
 1D histograms mapping More...
 
std::map< std::string, std::shared_ptr< TH2F > > h2_
 2D histograms mapping More...
 
std::shared_ptr< TFile > hout_
 output root file More...
 
bool isData_
 flag for DATA sample More...
 
bool isMC_
 flag for MC sample More...
 
bool istruepu_
 true pileup More...
 
std::string puw_label_
 pileup weight label More...
 
std::shared_ptr< PileupWeightpuweights_
 pileup weight More...
 
float scale_
 overall scaling More...
 
int seed_
 seed value More...
 
std::map< std::string, bool > trg_emul_
 emulated triggers More...
 
float weight_
 event weight More...
 
float xsection_
 cross section More...
 
- Protected Attributes inherited from analysis::tools::JetAnalyser
bool applyjer_
 
std::map< std::string, std::shared_ptr< BTagCalibrationReader > > bsf_reader_
 
std::vector< std::string > flavours_
 
std::shared_ptr< JetResolutionInfojerinfo_
 
std::vector< std::shared_ptr< Jet > > jets_
 
bool jetsanalysis_
 
int n_hjets_
 
std::vector< std::shared_ptr< Jet > > selectedJets_
 
- Protected Attributes inherited from analysis::tools::MuonAnalyser
std::map< std::string, std::shared_ptr< BTagCalibrationReader > > bsf_reader_
 
std::vector< std::shared_ptr< Muon > > muons_
 
bool muonsanalysis_
 
std::vector< std::shared_ptr< Muon > > onlineMatchedMuons_
 
std::vector< std::shared_ptr< Muon > > selectedMuons_
 

Detailed Description

inheritance

Definition at line 41 of file Analyser.h.

Constructor & Destructor Documentation

Analyser::Analyser ( )

default constructor

Definition at line 19 of file Analyser.cc.

20 {
21 }
Analyser::Analyser ( int  argc,
char *  argv[] 
)

main constructor

Definition at line 24 of file Analyser.cc.

References analysis::tools::BaseAnalyser::pileupHistogram().

24  : BaseAnalyser(argc,argv), // not sure the BaseAnalyser should be called here
25  TriggerAnalyser(argc,argv),
26  JetAnalyser(argc,argv),
27  MuonAnalyser(argc,argv)
28 {
29  this -> pileupHistogram();
30 }
void pileupHistogram()
creates pileup histogram
Analyser::~Analyser ( )

desctructor

Definition at line 32 of file Analyser.cc.

33 {
34 }

Member Function Documentation

bool Analyser::event ( const int &  i)
virtual

Read event and perform basic selections and actions.

Reimplemented from analysis::tools::BaseAnalyser.

Reimplemented in analysis::mssmhbb::MssmHbbAnalyser.

Definition at line 42 of file Analyser.cc.

References analysis::tools::BaseAnalyser::actionApplyPileupWeight(), analysis::tools::BaseAnalyser::analysis_, analysis::tools::JetAnalyser::analysisWithJets(), analysis::tools::MuonAnalyser::analysisWithMuons(), analysis::tools::BaseAnalyser::basename(), analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow(), analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::generatorWeight(), analysis::tools::BaseAnalyser::genJetsAnalysis(), analysis::tools::BaseAnalyser::genParticlesAnalysis(), analysis::tools::BaseAnalyser::isMC_, naf_mult_submit::json, analysis::tools::TriggerAnalyser::l1tJetsAnalysis(), analysis::tools::TriggerAnalyser::l1tMuonsAnalysis(), and analysis::tools::BaseAnalyser::weight_.

Referenced by main().

43 {
44  bool ok = true;
45  analysis_->event(i);
46  cutflow_ = -1;
47  weight_ = 1.; // reset weight at the beginning of the event analysis
48 
49  cutflow("Total events read");
50 
51  // Generator weight
52  if ( isMC_ )
53  {
54  this -> generatorWeight();
55  std::string genweight_type = "sign of weights";
56  if ( config_->fullGenWeight() ) genweight_type = "full weights";
57 
58  cutflow(Form("Generated weighted events (%s)",genweight_type.c_str()));
59  }
60 
61  if ( config_->runmin_ > 0 && analysis_->run() < config_->runmin_ ) return false;
62  if ( config_->runmax_ > 0 && analysis_->run() > config_->runmax_ ) return false;
63 
64  if (! config_->isMC() )
65  {
66  auto json = basename(config_->json());
67  ok = analysis_->selectJson();
68  cutflow(Form("Certified data: %s",json.c_str()),ok);
69  if ( ! ok ) return false;
70 
71  }
72 
73  if ( this->genParticlesAnalysis() )
74  cutflow(Form("Using GenParticles collection: %s",(config_->genParticlesCollection()).c_str()));
75 
76  if ( this->genJetsAnalysis() )
77  cutflow(Form("Using GenJets collection: %s",(config_->genJetsCollection()).c_str()));
78 
79  if ( this -> l1tJetsAnalysis() )
80  cutflow(Form("Using L1TJet collection: %s", (config_->l1tJetsCollection()).c_str()));
81 
82  if ( this -> l1tMuonsAnalysis() )
83  cutflow(Form("Using L1TMuon collection: %s", (config_->l1tMuonsCollection()).c_str()));
84 
87 
88  // PILEUP RE-WEIGHT
89  this->actionApplyPileupWeight();
90 
91  return ok;
92 
93 }
int cutflow()
get cutflow index
void actionApplyPileupWeight(const int &var=0)
apply pileup weight given a systematic variation
virtual bool analysisWithJets()
Definition: JetAnalyser.cc:72
bool genParticlesAnalysis() const
returns whether analysis of gen particles can be done
bool isMC_
flag for MC sample
Definition: BaseAnalyser.h:102
bool genJetsAnalysis() const
returns whether analysis of gen jets can be done
std::string basename(const std::string &)
returns the basename of a path
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
void generatorWeight()
generator weight
std::shared_ptr< Analysis > analysis_
Analysis objects.
Definition: BaseAnalyser.h:61
float weight_
event weight
Definition: BaseAnalyser.h:72
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
virtual bool analysisWithMuons()
Definition: MuonAnalyser.cc:44
bool Analyser::muonJet ( const int &  r)
virtual

Assign muon to jet.

Definition at line 95 of file Analyser.cc.

References analysis::tools::BaseAnalyser::cutflow(), analysis::tools::MuonAnalyser::muonsanalysis_, analysis::tools::JetAnalyser::selectedJets_, and analysis::tools::MuonAnalyser::selectedMuons_.

96 {
97 
98  if ( ! muonsanalysis_ ) return true; // will skip this selection
99 
100  int j = r-1;
101  auto jet = selectedJets_[j];
102  jet -> addMuon(selectedMuons_);
103  bool isMuonJet = (jet -> muon() != nullptr);
104  cutflow(Form("Jet %d: Jet-muon association",r),isMuonJet);
105 
106  return isMuonJet;
107 
108 }
int cutflow()
get cutflow index
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::vector< std::shared_ptr< Jet > > selectedJets_
Definition: JetAnalyser.h:47
bool Analyser::preselection ( )
virtual

multiple actions: perform muon Id, jet Id and jet pileup Id selections

Definition at line 110 of file Analyser.cc.

References analysis::tools::JetAnalyser::selectionJetId(), analysis::tools::JetAnalyser::selectionJetPileupId(), and analysis::tools::MuonAnalyser::selectionMuonId().

Referenced by main().

111 {
112 // IDENTIFICATIONS
113  if ( ! this->selectionMuonId() ) return false;
114  if ( ! this->selectionJetId() ) return false;
115  if ( ! this->selectionJetPileupId() ) return false;
116  return true;
117 
118 }
virtual bool selectionJetPileupId()
Definition: JetAnalyser.cc:646

The documentation for this class was generated from the following files: