DAS  3.0
Das Analysis System
BTagCalibration.h
Go to the documentation of this file.
1 #ifndef BTagEntry_H
2 #define BTagEntry_H
3 
18 #include <string>
19 #include <TF1.h>
20 #include <TH1.h>
21 
22 
23 class BTagEntry
24 {
25 public:
31  };
32  enum JetFlavor { // modified from original code to match UL convention
33  FLAV_B=5, // previously 0
34  FLAV_C=4, // previsouly 1
35  FLAV_UDSG=0, // previsouly 2
36  };
37  struct Parameters {
39  std::string measurementType;
40  std::string sysType;
42  float etaMin;
43  float etaMax;
44  float ptMin;
45  float ptMax;
46  float discrMin;
47  float discrMax;
48 
49  // default constructor
50  Parameters(
52  std::string measurement_type="comb",
53  std::string sys_type="central",
54  JetFlavor jf=FLAV_B,
55  float eta_min=-99999.,
56  float eta_max=99999.,
57  float pt_min=0.,
58  float pt_max=99999.,
59  float discr_min=0.,
60  float discr_max=99999.
61  );
62 
63  };
64 
65  BTagEntry() {}
66  BTagEntry(const std::string &csvLine);
67  BTagEntry(const std::string &func, Parameters p);
68  BTagEntry(const TF1* func, Parameters p);
69  BTagEntry(const TH1* histo, Parameters p);
71  static std::string makeCSVHeader();
72  std::string makeCSVLine() const;
73  static std::string trimStr(std::string str);
74 
75  // public, no getters needed
76  std::string formula;
78 
79 };
80 
81 #endif // BTagEntry_H
82 
83 
84 #ifndef BTagCalibration_H
85 #define BTagCalibration_H
86 
101 #include <map>
102 #include <vector>
103 #include <string>
104 #include <istream>
105 #include <ostream>
106 
107 
109 {
110 public:
112  BTagCalibration(const std::string &tagger);
113  BTagCalibration(const std::string &tagger, const std::string &filename);
115 
116  std::string tagger() const {return tagger_;}
117 
118  void addEntry(const BTagEntry &entry);
119  const std::vector<BTagEntry>& getEntries(const BTagEntry::Parameters &par) const;
120 
121  void readCSV(std::istream &s);
122  void readCSV(const std::string &s);
123  void makeCSV(std::ostream &s) const;
124  std::string makeCSV() const;
125 
126 protected:
127  static std::string token(const BTagEntry::Parameters &par);
128 
129  std::string tagger_;
130  std::map<std::string, std::vector<BTagEntry> > data_;
131 
132 };
133 
134 #endif // BTagCalibration_H
135 
136 
137 #ifndef BTagCalibrationReader_H
138 #define BTagCalibrationReader_H
139 
148 #include <memory>
149 #include <string>
150 
151 
152 
154 {
155 public:
157 
160  const std::string & sysType="central",
161  const std::vector<std::string> & otherSysTypes={});
162 
163  void load(const BTagCalibration & c,
165  const std::string & measurementType="comb");
166 
167  double eval(BTagEntry::JetFlavor jf,
168  float eta,
169  float pt,
170  float discr=0.) const;
171 
172  double eval_auto_bounds(const std::string & sys,
174  float eta,
175  float pt,
176  float discr=0.) const;
177 
178  std::pair<float, float> min_max_pt(BTagEntry::JetFlavor jf,
179  float eta,
180  float discr=0.) const;
181 protected:
182  std::shared_ptr<BTagCalibrationReaderImpl> pimpl;
183 };
184 
185 
186 #endif // BTagCalibrationReader_H
187 
188 
BTagEntry::Parameters::measurementType
std::string measurementType
Definition: BTagCalibration.h:39
BTagEntry::Parameters::discrMin
float discrMin
Definition: BTagCalibration.h:46
BTagCalibrationReader::BTagCalibrationReader
BTagCalibrationReader()
Definition: BTagCalibration.h:158
BTagCalibration::tagger
std::string tagger() const
Definition: BTagCalibration.h:116
BTagCalibration::~BTagCalibration
~BTagCalibration()
Definition: BTagCalibration.h:114
jmarExample.pt
pt
Definition: jmarExample.py:19
BTagCalibration::getEntries
const std::vector< BTagEntry > & getEntries(const BTagEntry::Parameters &par) const
Definition: BTagCalibration.cc:301
BTagEntry::Parameters::jetFlavor
JetFlavor jetFlavor
Definition: BTagCalibration.h:41
BTagEntry::~BTagEntry
~BTagEntry()
Definition: BTagCalibration.h:70
BTagCalibration
Definition: BTagCalibration.h:109
BTagEntry::FLAV_C
@ FLAV_C
Definition: BTagCalibration.h:34
BTagEntry::formula
std::string formula
Definition: BTagCalibration.h:76
Ntupliser_cfg.p
p
Definition: Ntupliser_cfg.py:362
BTagEntry::OP_LOOSE
@ OP_LOOSE
Definition: BTagCalibration.h:27
BTagEntry::Parameters::discrMax
float discrMax
Definition: BTagCalibration.h:47
BTagEntry::Parameters::operatingPoint
OperatingPoint operatingPoint
Definition: BTagCalibration.h:38
BTagEntry::OP_MEDIUM
@ OP_MEDIUM
Definition: BTagCalibration.h:28
BTagEntry
Definition: BTagCalibration.h:24
BTagCalibrationReader
Definition: BTagCalibration.h:154
BTagEntry::OperatingPoint
OperatingPoint
Definition: BTagCalibration.h:26
BTagEntry::Parameters::etaMin
float etaMin
Definition: BTagCalibration.h:42
BTagEntry::Parameters
Definition: BTagCalibration.h:37
BTagEntry::BTagEntry
BTagEntry()
Definition: BTagCalibration.h:65
BTagCalibrationReader::min_max_pt
std::pair< float, float > min_max_pt(BTagEntry::JetFlavor jf, float eta, float discr=0.) const
Definition: BTagCalibration.cc:658
BTagCalibrationReader::eval
double eval(BTagEntry::JetFlavor jf, float eta, float pt, float discr=0.) const
Definition: BTagCalibration.cc:641
BTagEntry::makeCSVLine
std::string makeCSVLine() const
Definition: BTagCalibration.cc:243
BTagCalibration::tagger_
std::string tagger_
Definition: BTagCalibration.h:129
BTagEntry::Parameters::sysType
std::string sysType
Definition: BTagCalibration.h:40
BTagCalibrationReader::eval_auto_bounds
double eval_auto_bounds(const std::string &sys, BTagEntry::JetFlavor jf, float eta, float pt, float discr=0.) const
Definition: BTagCalibration.cc:649
BTagCalibrationReader::pimpl
std::shared_ptr< BTagCalibrationReaderImpl > pimpl
Definition: BTagCalibration.h:182
BTagEntry::OP_RESHAPING
@ OP_RESHAPING
Definition: BTagCalibration.h:30
BTagEntry::JetFlavor
JetFlavor
Definition: BTagCalibration.h:32
BTagCalibration::data_
std::map< std::string, std::vector< BTagEntry > > data_
Definition: BTagCalibration.h:130
BTagEntry::Parameters::etaMax
float etaMax
Definition: BTagCalibration.h:43
BTagCalibration::BTagCalibration
BTagCalibration()
Definition: BTagCalibration.h:111
BTagEntry::params
Parameters params
Definition: BTagCalibration.h:77
BTagCalibration::token
static std::string token(const BTagEntry::Parameters &par)
Definition: BTagCalibration.cc:359
BTagCalibration::addEntry
void addEntry(const BTagEntry &entry)
Definition: BTagCalibration.cc:296
BTagCalibrationReader::load
void load(const BTagCalibration &c, BTagEntry::JetFlavor jf, const std::string &measurementType="comb")
Definition: BTagCalibration.cc:634
BTagEntry::OP_TIGHT
@ OP_TIGHT
Definition: BTagCalibration.h:29
BTagCalibration::makeCSV
std::string makeCSV() const
Definition: BTagCalibration.cc:352
BTagEntry::FLAV_B
@ FLAV_B
Definition: BTagCalibration.h:33
BTagEntry::trimStr
static std::string trimStr(std::string str)
Definition: BTagCalibration.cc:261
BTagEntry::makeCSVHeader
static std::string makeCSVHeader()
Definition: BTagCalibration.cc:228
BTagEntry::Parameters::ptMax
float ptMax
Definition: BTagCalibration.h:45
BTagCalibrationReader::BTagCalibrationReaderImpl
Definition: BTagCalibration.cc:372
BTagEntry::FLAV_UDSG
@ FLAV_UDSG
Definition: BTagCalibration.h:35
jmarExample.eta
eta
DeepAK8/ParticleNet tagging.
Definition: jmarExample.py:19
BTagEntry::Parameters::ptMin
float ptMin
Definition: BTagCalibration.h:44
BTagCalibration::readCSV
void readCSV(std::istream &s)
Definition: BTagCalibration.cc:320
BTagEntry::Parameters::Parameters
Parameters(OperatingPoint op=OP_TIGHT, std::string measurement_type="comb", std::string sys_type="central", JetFlavor jf=FLAV_B, float eta_min=-99999., float eta_max=99999., float pt_min=0., float pt_max=99999., float discr_min=0., float discr_max=99999.)
Definition: BTagCalibration.cc:10