DAS  3.0
Das Analysis System
IDApplier

Description

Guesses the selection from the histogram name in the maps, and applies it by setting the weights to 0 to muons that don't pass the selection.

Note: tuned for Run 2 UL

+ Inheritance diagram for IDApplier:
+ Collaboration diagram for IDApplier:

Public Member Functions

 IDApplier (const fs::path &filePath, TString histname, bool correction, bool uncertainties)
 
- Public Member Functions inherited from GenericSFApplier< DAS::RecMuon >
 GenericSFApplier (const std::filesystem::path &filePath, bool correction, bool uncertainties)
 
virtual ~GenericSFApplier () noexcept=default
 
void operator() (DAS::RecMuon &object, const Context &... ctx) const
 
void operator() (std::vector< DAS::RecMuon > &objects, const Context &... ctx) const
 
std::vector< std::string > weightNames () const
 

Public Attributes

TString name
 
TString NUM
 
TString DEN
 

Protected Member Functions

bool passes (const RecMuon &muon) const override
 
int binIndex (const RecMuon &muon, const std::unique_ptr< TH1 > &hist) const override
 
- Protected Member Functions inherited from GenericSFApplier< DAS::RecMuon >
void loadNominal (const std::string &histPath)
 
void loadBinWiseUnc (const std::string &name, const std::string &histPath, Interpretation intp=UseBinContent)
 
void loadGlobalUnc (const std::string &name, const std::string &histPath, Interpretation intp=UseBinContent)
 
virtual bool passes (const DAS::RecMuon &obj, const Context &... ctx) const=0
 
virtual int binIndex (const DAS::RecMuon &obj, const Context &... ctx, const std::unique_ptr< TH1 > &hist) const=0
 

Static Private Member Functions

static Selector getMask (const string &s)
 

Private Attributes

const bool abseta
 
const bool charge
 
const bool IPCut
 
Selector num
 
Selector den
 

Additional Inherited Members

- Protected Types inherited from GenericSFApplier< DAS::RecMuon >
enum  Interpretation
 

Constructor & Destructor Documentation

◆ IDApplier()

IDApplier ( const fs::path &  filePath,
TString  histname,
bool  correction,
bool  uncertainties 
)
inline
110  : GenericSFApplier(filePath, correction, uncertainties)
111  , abseta(!histname.Contains("_eta_pt" )) // default is to take $|\eta|$
112  , charge( histname.Contains("_charge" ))
113  , IPCut ( histname.Contains("andIPCut"))
114  , name ( histname )
115  {
116  loadNominal(histname.Data());
117  auto var = histname + "_stat";
118  loadBinWiseUnc(var.Data(), var.Data(), UseBinError);
119  var = histname + "_syst";
120  loadGlobalUnc(var.Data(), var.Data(), UseBinError);
121 
122  histname.ReplaceAll("_eta_pt", "");
123  histname.ReplaceAll("_abseta_pt", "");
124  histname.ReplaceAll("_charge", "");
125  histname.ReplaceAll("andIPCut", "");
126 
127  DEN = histname(TRegexp("_DEN_.*"));
128  histname.ReplaceAll(DEN, "");
129  DEN.ReplaceAll("_DEN_", "");
130  den = getMask(DEN.Data());
131 
132  NUM = histname;
133  NUM.ReplaceAll("NUM_", "");
134  num = getMask(NUM.Data());
135 
136  cout << "Initialisation of " << __func__ << " done" << endl;
137  }

Member Function Documentation

◆ binIndex()

int binIndex ( const RecMuon muon,
const std::unique_ptr< TH1 > &  hist 
) const
inlineoverrideprotected
149  {
150  const float eta = abseta ? fabsf(muon.p4.Eta()) : muon.p4.Eta();
151  if (charge) {
152  // 3D: Q eta pT
153  const float maxpt = hist->GetZaxis()->GetXmax() - 1;
154  const float pt = min(muon.p4.Pt(), maxpt);
155  return hist->FindBin(muon.Q, eta, pt);
156  } else {
157  // 2D: eta pT
158  const float maxpt = hist->GetYaxis()->GetXmax() - 1;
159  const float pt = min(muon.p4.Pt(), maxpt);
160  return hist->FindBin(eta, pt);
161  }
162  }

◆ getMask()

static Selector getMask ( const string &  s)
inlinestaticprivate

Translate table name from Muon POG ROOT file into selector.

81  {
82  // RECO
83  if (s == "TrackerMuons") return Selector::None;
84  if (s == "genTracks" ) return Selector::None;
85 
86  // Muon ID
87  if (s == "LooseID") return Selector::CutBasedIdLoose ;
88  if (s == "MediumID") return Selector::CutBasedIdMedium ;
89  if (s == "MediumPromptID") return Selector::CutBasedIdMediumPrompt;
90  if (s == "SoftID") return Selector::SoftCutBasedId ;
91  if (s == "TightID") return Selector::CutBasedIdTight ; // andIPCut?
92  if (s == "HighPtID") return Selector::CutBasedIdGlobalHighPt; // andIPCut?
93  if (s == "TrkHighPtID") return Selector::CutBasedIdTrkHighPt ; // andIPCut?
94 
95  // Muon ISO
96  if (s == "VeryLooseRelIso") return Selector::PFIsoVeryLoose;
97  if (s == "LooseRelIso") return Selector::PFIsoLoose ;
98  if (s == "MediumRelIso") return Selector::PFIsoMedium ;
99  if (s == "TightRelIso") return Selector::PFIsoTight ;
100  if (s == "VeryTightRelIso") return Selector::PFIsoVeryTight;
101  if (s == "LooseRelTkIso") return Selector::TkIsoLoose ;
102  if (s == "TightRelTkIso") return Selector::TkIsoTight ;
103 
104  BOOST_THROW_EXCEPTION( invalid_argument(s + " is not recognised.") );
105  }

◆ passes()

bool passes ( const RecMuon muon) const
inlineoverrideprotected
Todo:
IPCut? (unless it's already included in IPCut?)
141  {
143  return num == 0 // Non standard, tracker SF
144  || (num & muon.selectors) == num;
145  }

Member Data Documentation

◆ abseta

const bool abseta
private

◆ charge

const bool charge
private

◆ den

Selector den
private

◆ DEN

TString DEN

◆ IPCut

const bool IPCut
private

◆ name

TString name

◆ num

Selector num
private

◆ NUM

TString NUM

The documentation for this class was generated from the following file:
DAS::Muon::IDApplier::name
TString name
Definition: applyMuonSelection.cc:74
jmarExample.pt
pt
Definition: jmarExample.py:19
DAS::Muon::TkIsoLoose
@ TkIsoLoose
Definition: applyMuonSelection.cc:52
DAS::Muon::PFIsoVeryTight
@ PFIsoVeryTight
Definition: applyMuonSelection.cc:51
DAS::GenericSFApplier< DAS::RecMuon >::GenericSFApplier
GenericSFApplier(const std::filesystem::path &filePath, bool correction, bool uncertainties)
Constructor.
Definition: GenericSFApplier.h:153
DAS::Muon::IDApplier::charge
const bool charge
Definition: applyMuonSelection.cc:71
DAS::GenericSFApplier< DAS::RecMuon >::loadNominal
void loadNominal(const std::string &histPath)
Loads the histogram with the nominal scale factor. Has no effect when not applying the correction.
Definition: GenericSFApplier.h:259
DAS::Muon::IDApplier::num
Selector num
Definition: applyMuonSelection.cc:72
DAS::Muon::PFIsoTight
@ PFIsoTight
Definition: applyMuonSelection.cc:50
DAS::Muon::CutBasedIdMedium
@ CutBasedIdMedium
Definition: applyMuonSelection.cc:42
DAS::GenericSFApplier< DAS::RecMuon >::loadBinWiseUnc
void loadBinWiseUnc(const std::string &name, const std::string &histPath, Interpretation intp=UseBinContent)
Loads a systematic with bin-by-bin correlations.
Definition: GenericSFApplier.h:275
DAS::Muon::IDApplier::NUM
TString NUM
Definition: applyMuonSelection.cc:74
DAS::Muon::IDApplier::getMask
static Selector getMask(const string &s)
Translate table name from Muon POG ROOT file into selector.
Definition: applyMuonSelection.cc:80
DAS::Muon::PFIsoLoose
@ PFIsoLoose
Definition: applyMuonSelection.cc:48
DAS::MN::maxpt
static const double maxpt
Definition: getMNobservables.cc:42
DAS::Muon::CutBasedIdTrkHighPt
@ CutBasedIdTrkHighPt
Definition: applyMuonSelection.cc:46
DAS::Muon::CutBasedIdTight
@ CutBasedIdTight
Definition: applyMuonSelection.cc:44
DAS::GenericSFApplier< DAS::RecMuon >::UseBinError
@ UseBinError
The histogram errors contain the uncertainty in the scale factors.
Definition: GenericSFApplier.h:115
DAS::Muon::CutBasedIdMediumPrompt
@ CutBasedIdMediumPrompt
Definition: applyMuonSelection.cc:43
DAS::Muon::PFIsoVeryLoose
@ PFIsoVeryLoose
Definition: applyMuonSelection.cc:47
DAS::Muon::CutBasedIdLoose
@ CutBasedIdLoose
Definition: applyMuonSelection.cc:41
DAS::Muon::IDApplier::DEN
TString DEN
Definition: applyMuonSelection.cc:74
DAS::Muon::SoftCutBasedId
@ SoftCutBasedId
Definition: applyMuonSelection.cc:54
DAS::Muon::CutBasedIdGlobalHighPt
@ CutBasedIdGlobalHighPt
Definition: applyMuonSelection.cc:45
DAS::Muon::TkIsoTight
@ TkIsoTight
Definition: applyMuonSelection.cc:53
DAS::Muon::None
@ None
Definition: applyMuonSelection.cc:40
DAS::Muon::IDApplier::abseta
const bool abseta
Definition: applyMuonSelection.cc:71
DAS::GenericSFApplier< DAS::RecMuon >::loadGlobalUnc
void loadGlobalUnc(const std::string &name, const std::string &histPath, Interpretation intp=UseBinContent)
Loads a fully correlated systematic.
Definition: GenericSFApplier.h:295
DAS::Muon::IDApplier::IPCut
const bool IPCut
Definition: applyMuonSelection.cc:71
DAS::Muon::PFIsoMedium
@ PFIsoMedium
Definition: applyMuonSelection.cc:49
jmarExample.eta
eta
DeepAK8/ParticleNet tagging.
Definition: jmarExample.py:19
DAS::Muon::IDApplier::den
Selector den
Definition: applyMuonSelection.cc:72