Mēnsūra
|
Service to accesses b-tagging efficiencies stored in a ROOT file. More...
#include <BTagEffService.hpp>
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. | |
BTagEffService & | operator= (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 Service * | Clone () 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. | |
![]() | |
Service (std::string const &name) | |
Constructor. More... | |
Service (Service const &)=default | |
Default copy constructor. | |
Service (Service &&)=default | |
Default move constructor. | |
Service & | operator= (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... | |
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.
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.
|
overridevirtual |
|
overridevirtual |
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.