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

#include <MuonAnalyser.h>

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

Public Member Functions

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...
 
- 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...
 
virtual bool event (const int &)
 event entry to be readout and processed 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...
 

Protected Attributes

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_
 
- 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...
 

Detailed Description

Definition at line 35 of file MuonAnalyser.h.

Constructor & Destructor Documentation

MuonAnalyser::MuonAnalyser ( )

constructors

Definition at line 19 of file MuonAnalyser.cc.

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

Definition at line 24 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::analysis_, analysis::tools::BaseAnalyser::config_, and muonsanalysis_.

24  : BaseAnalyser(argc,argv)
25 {
26  // Physics objects
27  // Muons
28  muonsanalysis_ = ( analysis_->addTree<Muon> ("Muons",config_->muonsCollection()) != nullptr && config_ -> nMuonsMin() > 0 );
29 
30 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
std::shared_ptr< Analysis > analysis_
Analysis objects.
Definition: BaseAnalyser.h:61
MuonAnalyser::~MuonAnalyser ( )

desctructor

Definition at line 32 of file MuonAnalyser.cc.

33 {
34  // do anything here that needs to be done at desctruction time
35  // (e.g. close files, deallocate resources etc.)
36 }

Member Function Documentation

bool MuonAnalyser::analysisWithMuons ( )
virtual

Definition at line 44 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::analysis_, analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, muons(), muons_, muonsanalysis_, onlineMatchedMuons_, selectedMuons_, analysis::tools::BaseAnalyser::triggerEmulation(), and analysis::tools::BaseAnalyser::weight_.

Referenced by analysis::tools::Analyser::event().

45 {
46  muons_.clear();
47  selectedMuons_.clear();
48  onlineMatchedMuons_.clear();
49 
50  // trigger emulation
51  // L1 muons
52  std::string triggerObjectsL1Muons;
53  if ( config_->triggerObjectsL1Muons() != "" )
54  {
55  triggerObjectsL1Muons = config_->triggerObjectsL1Muons();
56  if ( config_->triggerEmulateL1Muons() != "" && config_->triggerEmulateL1MuonsNMin() > 0 )
57  {
58  int nmin = config_->triggerEmulateL1MuonsNMin();
59  float ptmin = config_->triggerEmulateL1MuonsPtMin();
60  float etamax = config_->triggerEmulateL1MuonsEtaMax();
61  std::string newL1Muons = config_->triggerEmulateL1Muons();
62  triggerEmulation(triggerObjectsL1Muons,nmin,ptmin,etamax,newL1Muons);
63  triggerObjectsL1Muons = newL1Muons;
64  }
65  }
66 
67  // L3 muons
68  std::string triggerObjectsL3Muons;
69  if ( config_->triggerObjectsL3Muons() != "" )
70  {
71  triggerObjectsL3Muons = config_->triggerObjectsL3Muons();
72  if ( config_->triggerEmulateL3Muons() != "" && config_->triggerEmulateL3MuonsNMin() > 0 )
73  {
74  int nmin = config_->triggerEmulateL3MuonsNMin();
75  float ptmin = config_->triggerEmulateL3MuonsPtMin();
76  float etamax = config_->triggerEmulateL3MuonsEtaMax();
77  std::string newL3Muons = config_->triggerEmulateL3Muons();
78  triggerEmulation(triggerObjectsL3Muons,nmin,ptmin,etamax,newL3Muons);
79  triggerObjectsL3Muons = newL3Muons;
80  }
81  }
82 
83 
84  if ( ! muonsanalysis_ ) return false;
85 
86  ++cutflow_;
87  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
88  {
89  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Using Muon collection: %s",(config_->muonsCollection()).c_str()));
90  }
91  h1_["cutflow"] -> Fill(cutflow_,weight_);
92 
93 
94  if ( config_->triggerObjectsL1Muons() != "" )
95  {
96  analysis_->match<Muon,TriggerObject>("Muons",triggerObjectsL1Muons,config_->triggerMatchL1MuonsDrMax());
97 
98  }
99 
100  if ( config_->triggerObjectsL3Muons() != "" )
101  {
102  analysis_->match<Muon,TriggerObject>("Muons",triggerObjectsL3Muons,config_->triggerMatchL3MuonsDrMax());
103  }
104 
105  auto muons = analysis_->collection<Muon>("Muons");
106  for ( int j = 0 ; j < muons->size() ; ++j ) muons_.push_back(std::make_shared<Muon>(muons->at(j)));
107 
109 
110  return true;
111 }
std::vector< std::shared_ptr< Muon > > muons_
Definition: MuonAnalyser.h:46
std::vector< std::shared_ptr< Muon > > muons()
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
std::shared_ptr< Analysis > analysis_
Analysis objects.
Definition: BaseAnalyser.h:61
std::vector< std::shared_ptr< Muon > > onlineMatchedMuons_
Definition: MuonAnalyser.h:48
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
virtual bool triggerEmulation(const std::string &, const int &, const float &, const float &, const std::string &)
emulate l1 trigger
float analysis::tools::MuonAnalyser::btag ( const Muon ,
const std::string &   
)
void MuonAnalyser::fillMuonHistograms ( )
virtual

Definition at line 406 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::h1_, and selectedMuons_.

407 {
408  int n = config_->nMuonsMin();
409 
410  for ( int j = 0; j < n; ++j )
411  {
412  h1_[Form("pt_muon%d",j+1)] -> Fill(selectedMuons_[j]->pt());
413  h1_[Form("eta_muon%d",j+1)] -> Fill(selectedMuons_[j]->eta());
414  h1_[Form("phi_muon%d",j+1)] -> Fill(selectedMuons_[j]->phi());
415  }
416 
417 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
void MuonAnalyser::muonHistograms ( const std::string &  obj,
const int &  n = 1 
)
virtual

Definition at line 133 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::h1_.

134 {
135  if ( obj == "muon" )
136  {
137  for ( int j = 0; j < n; ++j )
138  {
139  h1_[Form("pt_%s%d" , obj.c_str(),j+1)] = std::make_shared<TH1F>(Form("pt_%s%d" , obj.c_str(),j+1) , "" ,100 , 0 , 1000 );
140  h1_[Form("eta_%s%d" , obj.c_str(),j+1)] = std::make_shared<TH1F>(Form("eta_%s%d" , obj.c_str(),j+1) , "" , 60 , -3, 3 );
141  h1_[Form("phi_%s%d" , obj.c_str(),j+1)] = std::make_shared<TH1F>(Form("phi_%s%d" , obj.c_str(),j+1) , "" , 64 , -3.2, 3.2 );
142  }
143 
144  }
145 }
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
std::vector< std::shared_ptr< Muon > > MuonAnalyser::muons ( )

Definition at line 114 of file MuonAnalyser.cc.

References muons_.

Referenced by analysisWithMuons().

115 {
116  return muons_;
117 }
std::vector< std::shared_ptr< Muon > > muons_
Definition: MuonAnalyser.h:46
bool MuonAnalyser::onlineL1MuonMatching ( const int &  r)
virtual

Definition at line 335 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

336 {
337  int j = r-1;
338  if ( config_->triggerObjectsL1Muons() == "" ) return true;
339 
340  ++cutflow_;
341 
342  std::string triggerObjectsL1Muons = config_->triggerObjectsL1Muons();
343  if ( config_->triggerEmulateL1Muons() != "" && config_->triggerEmulateL1MuonsNMin() > 0 )
344  {
345  triggerObjectsL1Muons = config_->triggerEmulateL1Muons();
346  }
347 
348 
349  if ( r > config_->nMuonsMin() )
350  {
351  std::cout << "*Warning* MuonAnalyser::onlineL1MuonMatching(): asking for matching of unselected muon. Returning false!" << std::endl;
352  return false; // asking for a match beyond the selection, that's wrong, therefore false
353  }
354  if ( selectedMuons_.size() == 0 )
355  {
356  std::cout << "*Warning* MuonAnalyser::onlineL1MuonMatching(): selectedMuons is empty. Returning false!" << std::endl;
357  return false; // asking for a match beyond the selection, that's wrong, therefore false
358  }
359 
360  if ( ! selectedMuons_[j]->matched(triggerObjectsL1Muons) ) return false;
361 
362  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
363  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muon %d: L1 muon match (deltaR < %4.3f)",r,config_-> triggerMatchL1MuonsDrMax()));
364 
365  h1_["cutflow"] -> Fill(cutflow_,weight_);
366 
367  return true;
368 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
bool MuonAnalyser::onlineL3MuonMatching ( const int &  r)
virtual

Definition at line 370 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

371 {
372  int j = r-1;
373  if ( config_->triggerObjectsL3Muons() == "" ) return true;
374 
375  ++cutflow_;
376 
377  std::string triggerObjectsL3Muons = config_->triggerObjectsL3Muons();
378  if ( config_->triggerEmulateL3Muons() != "" && config_->triggerEmulateL3MuonsNMin() > 0 )
379  {
380  triggerObjectsL3Muons = config_->triggerEmulateL3Muons();
381  }
382 
383  if ( r > config_->nMuonsMin() )
384  {
385  std::cout << "*Warning* MuonAnalyser::onlineL3MuonMatching(): asking for matching of unselected muon. Returning false!" << std::endl;
386  return false; // asking for a match beyond the selection, that's wrong, therefore false
387  }
388  if ( selectedMuons_.size() == 0 )
389  {
390  std::cout << "*Warning* MuonAnalyser::onlineL3MuonMatching(): selectedMuons is empty. Returning false!" << std::endl;
391  return false; // asking for a match beyond the selection, that's wrong, therefore false
392  }
393 
394  if ( ! selectedMuons_[j]->matched(triggerObjectsL3Muons) ) return false;
395 
396  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
397  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muon %d: L3 muon match (deltaR < %4.3f)",r,config_-> triggerMatchL3MuonsDrMax()));
398 
399  h1_["cutflow"] -> Fill(cutflow_,weight_);
400 
401  return true;
402 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
std::vector< std::shared_ptr< Muon > > MuonAnalyser::onlineMatchedMuons ( )

Definition at line 124 of file MuonAnalyser.cc.

References onlineMatchedMuons_.

125 {
126  return onlineMatchedMuons_;
127 }
std::vector< std::shared_ptr< Muon > > onlineMatchedMuons_
Definition: MuonAnalyser.h:48
bool MuonAnalyser::onlineMuonMatching ( )
virtual

Definition at line 309 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, muonsanalysis_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

Referenced by main(), and analysis::mssmhbb::MssmHbbAnalyser::muonSelection().

310 {
311  if ( ! muonsanalysis_ ) return true; // will skip this selection
312 
313  if ( config_->triggerObjectsL1Muons() == "" && config_->triggerObjectsL3Muons() == "" ) return true;
314 
315  ++cutflow_;
316  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
317  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muons selected: Online muon matching: L1 (deltaR < %4.3f) and L3 (deltaR < %4.3f)",config_-> triggerMatchL1MuonsDrMax(),config_-> triggerMatchL3MuonsDrMax()));
318 
319  auto muon = std::begin(selectedMuons_);
320  while ( muon != std::end(selectedMuons_) )
321  {
322  if ( !((*muon)->matched(config_->triggerObjectsL1Muons()) && (*muon)->matched(config_->triggerObjectsL3Muons()) ))
323  muon = selectedMuons_.erase(muon);
324  else
325  ++muon;
326  }
327 
328  if ( (int)selectedMuons_.size() < config_->nMuonsMin() ) return false;
329 
330  h1_["cutflow"] -> Fill(cutflow_,weight_);
331 
332  return true;
333 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
std::vector< std::shared_ptr< Muon > > MuonAnalyser::selectedMuons ( )

Definition at line 119 of file MuonAnalyser.cc.

References selectedMuons_.

120 {
121  return selectedMuons_;
122 }
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
bool MuonAnalyser::selectionMuon ( const int &  r)
virtual

Definition at line 148 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

149 {
150  bool isgood = true;
151  ++cutflow_;
152  int m = r-1;
153 
154  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
155  {
156  if ( config_->muonsPtMax().size() > 0 && config_->muonsPtMax()[m] > config_->muonsPtMin()[m] )
157  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muon %d: pt > %5.1f GeV and pt < %5.1f GeV and |eta| < %3.1f",r,config_->muonsPtMin()[m], config_->muonsPtMax()[m],config_->muonsEtaMax()[m] ));
158  else
159  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muon %d: pt > %5.1f GeV and |eta| < %3.1f",r,config_->muonsPtMin()[m], config_->muonsEtaMax()[m] ));
160  }
161 
162  // kinematic selection
163  if ( selectedMuons_[m] -> pt() < config_->muonsPtMin()[m] && !(config_->muonsPtMin()[m] < 0) ) return false;
164  if ( fabs(selectedMuons_[m] -> eta()) > config_->muonsEtaMax()[m] && !(config_->muonsEtaMax()[m] < 0) ) return false;
165 
166  h1_["cutflow"] -> Fill(cutflow_,weight_);
167 
168  return isgood;
169 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
bool MuonAnalyser::selectionMuonDr ( const int &  r1,
const int &  r2 
)
virtual

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.

Definition at line 285 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_.

286 {
287  bool ok = true;
288  if (config_->muonsDrMax() < 0 )
289  {
290  ok = ok && true;
291  }
292  else
293  {
294  ok = ok && selectionMuonDr(r1,r2,config_->muonsDrMax());
295  }
296 
297  if (config_->muonsDrMin() < 0 )
298  {
299  ok = ok && true;
300  }
301  else
302  {
303  ok = ok && selectionMuonDr(r1,r2,-1*config_->muonsDrMin());
304  }
305  return ok;
306 }
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; t...
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
bool MuonAnalyser::selectionMuonDr ( const int &  r1,
const int &  r2,
const float &  delta 
)
virtual

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 )

Definition at line 261 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow(), and selectedMuons_.

262 {
263  if ( r1 > config_->nMuonsMin() || r2 > config_->nMuonsMin() ) return true;
264 
265  bool isgood = true;
266 
267  std::string label = Form("DR(muon %d, muon %d) < %4.2f",r1,r2,fabs(delta));
268  if ( delta < 0 )
269  label = Form("DR(muon %d, muon %d) > %4.2f",r1,r2,fabs(delta));
270 
271  int m1 = r1-1;
272  int m2 = r2-1;
273 
274  if ( delta > 0 )
275  isgood = ( selectedMuons_[m1]->deltaR(*selectedMuons_[m2]) < fabs(delta) );
276  else
277  isgood = ( selectedMuons_[m1]->deltaR(*selectedMuons_[m2]) > fabs(delta) );
278 
279  cutflow(label,isgood);
280 
281  return isgood;
282 
283 }
int cutflow()
get cutflow index
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
bool MuonAnalyser::selectionMuonId ( )
virtual

Definition at line 217 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, muonsanalysis_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

Referenced by main(), and analysis::tools::Analyser::preselection().

218 {
219  if ( ! muonsanalysis_ ) return true; // will skip this selection
220 
221  ++cutflow_;
222 
223  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
224  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("MuonId: %s",config_->muonsId().c_str()));
225 
226 // if ( ! muonsanalysis_ ) return false;
227 
228  auto muon = std::begin(selectedMuons_);
229  while ( muon != std::end(selectedMuons_) )
230  {
231  if ( ! (*muon)->id(config_->muonsId() ) )
232  muon = selectedMuons_.erase(muon);
233  else
234  ++muon;
235  }
236  if ( selectedMuons_.size() == 0 ) return false;
237 
238 
239  h1_["cutflow"] -> Fill(cutflow_,weight_);
240 
241  return true;
242 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
bool MuonAnalyser::selectionMuons ( )
virtual

Definition at line 171 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, muonsanalysis_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

Referenced by main(), and analysis::mssmhbb::MssmHbbAnalyser::muonSelection().

172 {
173  // selectedMuons will be composed of muons with the lowest pt threshold
174 
175  if ( ! muonsanalysis_ ) return true; // will skip this selection
176 
177 
178  bool isgood = true;
179  ++cutflow_;
180 //
181  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
182  {
183  if ( config_->muonsPtMax().size() > 0 && config_->muonsPtMax().back() > config_->muonsPtMin().back() )
184  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muons selected: pt > %5.1f GeV and pt < %5.1f GeV and |eta| < %3.1f", config_->muonsPtMin().back(), config_->muonsPtMax().back(), config_->muonsEtaMax().back() ));
185  else
186  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("Muons selected: pt > %5.1f GeV and |eta| < %3.1f", config_->muonsPtMin().back(), config_->muonsEtaMax().back() ));
187  }
188 
189  // kinematic selection
190  auto muon = std::begin(selectedMuons_);
191  while ( muon != std::end(selectedMuons_) )
192  {
193  if ( config_->muonsPtMax().size() > 0 && config_->muonsPtMax().back() > config_->muonsPtMin().back() )
194  {
195  if ( (*muon)->pt() < config_->muonsPtMin().back() || (*muon)->pt() > config_->muonsPtMax().back() || fabs((*muon)->eta()) > config_->muonsEtaMax().back() )
196  muon = selectedMuons_.erase(muon);
197  else
198  ++muon;
199  }
200  else
201  {
202  if ( (*muon)->pt() < config_->muonsPtMin().back() || fabs((*muon)->eta()) > config_->muonsEtaMax().back() )
203  muon = selectedMuons_.erase(muon);
204  else
205  ++muon;
206  }
207  }
208  if ( (int)selectedMuons_.size() < config_->nMuonsMin() ) return false;
209 
210  h1_["cutflow"] -> Fill(cutflow_,weight_);
211 //
212  return isgood;
213 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66
bool MuonAnalyser::selectionNMuons ( )
virtual

Definition at line 244 of file MuonAnalyser.cc.

References analysis::tools::BaseAnalyser::config_, analysis::tools::BaseAnalyser::cutflow_, analysis::tools::BaseAnalyser::h1_, muonsanalysis_, selectedMuons_, and analysis::tools::BaseAnalyser::weight_.

Referenced by main(), and analysis::mssmhbb::MssmHbbAnalyser::muonSelection().

245 {
246  if ( ! muonsanalysis_ ) return true; // will skip this selection
247 
248 
249  ++cutflow_;
250 
251  if ((int)selectedMuons_.size() < config_->nMuonsMin()) return false;
252 
253  if ( std::string(h1_["cutflow"] -> GetXaxis()-> GetBinLabel(cutflow_+1)) == "" )
254  h1_["cutflow"] -> GetXaxis()-> SetBinLabel(cutflow_+1,Form("NMuons >= %d",config_->nMuonsMin()));
255 
256  h1_["cutflow"] -> Fill(cutflow_,weight_);
257 
258  return true;
259 
260 }
std::shared_ptr< Config > config_
Config objects.
Definition: BaseAnalyser.h:63
float weight_
event weight
Definition: BaseAnalyser.h:72
std::vector< std::shared_ptr< Muon > > selectedMuons_
Definition: MuonAnalyser.h:47
std::map< std::string, std::shared_ptr< TH1F > > h1_
1D histograms mapping
Definition: BaseAnalyser.h:80
int cutflow_
Cutflow index.
Definition: BaseAnalyser.h:66

Member Data Documentation

std::map<std::string, std::shared_ptr<BTagCalibrationReader> > analysis::tools::MuonAnalyser::bsf_reader_
protected

Definition at line 52 of file MuonAnalyser.h.

std::vector< std::shared_ptr<Muon> > analysis::tools::MuonAnalyser::muons_
protected

Definition at line 46 of file MuonAnalyser.h.

Referenced by analysisWithMuons(), and muons().

bool analysis::tools::MuonAnalyser::muonsanalysis_
protected
std::vector< std::shared_ptr<Muon> > analysis::tools::MuonAnalyser::onlineMatchedMuons_
protected

Definition at line 48 of file MuonAnalyser.h.

Referenced by analysisWithMuons(), and onlineMatchedMuons().

std::vector< std::shared_ptr<Muon> > analysis::tools::MuonAnalyser::selectedMuons_
protected

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