Mēnsūra
Public Member Functions | List of all members
BTagEffService Class Reference

Service to accesses b-tagging efficiencies stored in a ROOT file. More...

#include <BTagEffService.hpp>

Inheritance diagram for BTagEffService:
Service

Public Member Functions

 BTagEffService (std::string const &name, std::string const &path)
 Creates a service with the given name. More...
 
 BTagEffService (std::string const &path)
 A short-cut for the above version with a default name "BTagEff".
 
 BTagEffService (BTagEffService &&)=default
 Default move constructor.
 
BTagEffServiceoperator= (BTagEffService const &)=delete
 Assignment operator is deleted.
 
virtual void BeginRun (Dataset const &dataset) override
 Updates efficiency label for the new dataset and resets the map with efficiency histograms if needed. More...
 
virtual ServiceClone () const override
 Creates a newly configured clone. More...
 
double GetEfficiency (BTagger const &bTagger, double pt, double eta, unsigned flavour) const
 Returns b-tagging efficiency for the given b tagger and given jet properties. More...
 
double GetEfficiency (BTagger const &bTagger, Jet const &jet) const
 Short-cut for the overloaded version above.
 
void SetEffLabel (std::string const &datasetIdMask, std::string const &label)
 Specifies an efficiency label to be used with datasets whose ID match the given mask. More...
 
void SetEffLabel (std::initializer_list< std::pair< std::string, std::string >> const &rules)
 Repeatedly calls the overloaded version for each (mask, label) pair.
 
void SetDefaultEffLabel (std::string const &label)
 Sets the default label to be used when the current dataset does not match any rules.
 
- Public Member Functions inherited from Service
 Service (std::string const &name)
 Constructor. More...
 
 Service (Service const &)=default
 Default copy constructor.
 
 Service (Service &&)=default
 Default move constructor.
 
Serviceoperator= (Service const &)=default
 Default assignment operator.
 
virtual ~Service ()=default
 Default destructor.
 
virtual void EndRun ()
 Performs necessary actions needed after processing of a dataset is finished. More...
 
Processor const & GetMaster () const
 Returns a reference to the master. More...
 
std::string const & GetName () const
 Returns name of the plugin.
 
void SetMaster (Processor const *processor)
 Provides a pointer to an instance of Processor class that owns the service. More...
 

Detailed Description

Service to accesses b-tagging efficiencies stored in a ROOT file.

This class implements access to b-tagging efficiencies in a generic way. The efficiencies are stored in a ROOT file in the form of 2D histograms in jet transverse momentum and pseudorapidity. Supported format of the file is described below.

Histograms are organized in directories named after b tagger codes (as returned by BTagger::GetTextCode). They are named following the pattern {label}_{flavour}. The efficiency label is an arbitrary string that allows to distinguish between different physics processes or datasets. The correspondence between dataset ID, as returned by Dataset::GetSourceDatasetID, is defined using methods SetEffLabel and SetDefaultEffLabel. The last part of the histogram name is the jet flavour label, which can take values "b", "c", or "udsg".

Histograms with efficiencies may be placed in in-file directories. This is useful to store efficiencies for multiple versions of event selection.

Constructor & Destructor Documentation

BTagEffService::BTagEffService ( std::string const &  name,
std::string const &  path 
)

Creates a service with the given name.

The path to the ROOT file containing b-tagging efficiencies may include names of in-file directories separated from the rest of the path with a colon. The path is resolved with the help of FileInPath class adding a postfix "BTag/" to the standard location. If the file is not found or the provided path is misformatted, an exception is thrown.

Member Function Documentation

void BTagEffService::BeginRun ( Dataset const &  dataset)
overridevirtual

Updates efficiency label for the new dataset and resets the map with efficiency histograms if needed.

Reimplemented from Service.

Reimplemented from Service.

Service * BTagEffService::Clone ( ) const
overridevirtual

Creates a newly configured clone.

Implemented from Service.

Implements Service.

double BTagEffService::GetEfficiency ( BTagger const &  bTagger,
double  pt,
double  eta,
unsigned  flavour 
) const

Returns b-tagging efficiency for the given b tagger and given jet properties.

Loads histograms for the given b tagger if needed. If the histogram with efficiencies is not found, an exception is thrown.

void BTagEffService::SetEffLabel ( std::string const &  datasetIdMask,
std::string const &  label 
)

Specifies an efficiency label to be used with datasets whose ID match the given mask.

The efficiency label is used to identify histograms in the input file as described in the class documentation. The mask must be a valid regular expression. Each call to this method creates a new rule that matches an efficiency label to a mask.

When a new dataset is opened, its source dataset ID will be matched to masks in the rules in the order of their specification. The first match found will provide the label to be used with the dataset.


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