DAS  3.0
Das Analysis System
BTagCalibration

Description

BTagCalibration

The 'hierarchy' of stored information is this:

  • by tagger (BTagCalibration)
    • by operating point or reshape bin
      • by jet parton flavor
        • by type of measurement
          • by systematic
            • by eta bin
              • as 1D-function dependent of pt or discriminant

#include <BTagCalibration.h>

+ Collaboration diagram for BTagCalibration:

Public Member Functions

 BTagCalibration ()
 
 BTagCalibration (const std::string &tagger)
 
 BTagCalibration (const std::string &tagger, const std::string &filename)
 
 ~BTagCalibration ()
 
std::string tagger () const
 
void addEntry (const BTagEntry &entry)
 
const std::vector< BTagEntry > & getEntries (const BTagEntry::Parameters &par) const
 
void readCSV (std::istream &s)
 
void readCSV (const std::string &s)
 
void makeCSV (std::ostream &s) const
 
std::string makeCSV () const
 

Static Protected Member Functions

static std::string token (const BTagEntry::Parameters &par)
 

Protected Attributes

std::string tagger_
 
std::map< std::string, std::vector< BTagEntry > > data_
 

Constructor & Destructor Documentation

◆ BTagCalibration() [1/3]

BTagCalibration ( )
inline
111 {}

◆ BTagCalibration() [2/3]

BTagCalibration ( const std::string &  tagger)
277  :
278  tagger_(taggr)
279 {}

◆ BTagCalibration() [3/3]

BTagCalibration ( const std::string &  tagger,
const std::string &  filename 
)
282  :
283  tagger_(taggr)
284 {
285  std::ifstream ifs(filename);
286  if (!ifs.good()) {
287 std::cerr << "ERROR in BTagCalibration: "
288  << "input file not available: "
289  << filename;
290 throw std::exception();
291  }
292  readCSV(ifs);
293  ifs.close();
294 }

◆ ~BTagCalibration()

~BTagCalibration ( )
inline
114 {}

Member Function Documentation

◆ addEntry()

void addEntry ( const BTagEntry entry)
297 {
298  data_[token(entry.params)].push_back(entry);
299 }

◆ getEntries()

const std::vector< BTagEntry > & getEntries ( const BTagEntry::Parameters par) const
303 {
304  std::string tok = token(par);
305  if (!data_.count(tok)) {
306 std::cerr << "ERROR in BTagCalibration: "
307  << "(OperatingPoint, measurementType, sysType) not available: "
308  << tok;
309 throw std::exception();
310  }
311  return data_.at(tok);
312 }

◆ makeCSV() [1/2]

std::string makeCSV ( ) const
353 {
354  std::stringstream buff;
355  makeCSV(buff);
356  return buff.str();
357 }

◆ makeCSV() [2/2]

void makeCSV ( std::ostream &  s) const
340 {
341  s << tagger_ << ";" << BTagEntry::makeCSVHeader();
342  for (std::map<std::string, std::vector<BTagEntry> >::const_iterator i
343  = data_.cbegin(); i != data_.cend(); ++i) {
344  const std::vector<BTagEntry> &vec = i->second;
345  for (std::vector<BTagEntry>::const_iterator j
346  = vec.cbegin(); j != vec.cend(); ++j) {
347  s << j->makeCSVLine();
348  }
349  }
350 }

◆ readCSV() [1/2]

void readCSV ( const std::string &  s)
315 {
316  std::stringstream buff(s);
317  readCSV(buff);
318 }

◆ readCSV() [2/2]

void readCSV ( std::istream &  s)
321 {
322  std::string line;
323 
324  // firstline might be the header
325  getline(s,line);
326  if (line.find("OperatingPoint") == std::string::npos) {
327  addEntry(BTagEntry(line));
328  }
329 
330  while (getline(s,line)) {
331  line = BTagEntry::trimStr(line);
332  if (line.empty()) { // skip empty lines
333  continue;
334  }
335  addEntry(BTagEntry(line));
336  }
337 }

◆ tagger()

std::string tagger ( ) const
inline
116 {return tagger_;}

◆ token()

std::string token ( const BTagEntry::Parameters par)
staticprotected
360 {
361  std::stringstream buff;
362  buff << par.operatingPoint << ", "
363  << par.measurementType << ", "
364  << par.sysType;
365  return buff.str();
366 }

Member Data Documentation

◆ data_

std::map<std::string, std::vector<BTagEntry> > data_
protected

◆ tagger_

std::string tagger_
protected

The documentation for this class was generated from the following files:
BTagEntry::Parameters::measurementType
std::string measurementType
Definition: BTagCalibration.h:39
Ntupliser_cfg.cerr
cerr
Definition: Ntupliser_cfg.py:93
BTagEntry::Parameters::operatingPoint
OperatingPoint operatingPoint
Definition: BTagCalibration.h:38
BTagEntry
Definition: BTagCalibration.h:24
BTagCalibration::tagger_
std::string tagger_
Definition: BTagCalibration.h:129
BTagEntry::Parameters::sysType
std::string sysType
Definition: BTagCalibration.h:40
BTagCalibration::data_
std::map< std::string, std::vector< BTagEntry > > data_
Definition: BTagCalibration.h:130
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
BTagCalibration::makeCSV
std::string makeCSV() const
Definition: BTagCalibration.cc:352
BTagEntry::trimStr
static std::string trimStr(std::string str)
Definition: BTagCalibration.cc:261
BTagEntry::makeCSVHeader
static std::string makeCSVHeader()
Definition: BTagCalibration.cc:228
BTagCalibration::readCSV
void readCSV(std::istream &s)
Definition: BTagCalibration.cc:320