![]() |
Belle II Software
release-05-01-25
|
Class to contain the payload of MVA weightfiles needed for charged particle identification. More...
#include <ChargedPidMVAWeights.h>
Public Types | |
enum | ChargedPidMVATrainingMode : unsigned int { c_Classification = 0, c_Multiclass = 1, c_ECL_Classification = 2, c_ECL_Multiclass = 3, c_PSD_Classification = 4, c_PSD_Multiclass = 5, c_ECL_PSD_Classification = 6, c_ECL_PSD_Multiclass = 7 } |
A (strongly-typed) enumerator identifier for each valid MVA training mode. More... | |
Public Member Functions | |
ChargedPidMVAWeights () | |
Default constructor, necessary for ROOT to stream the object. | |
~ChargedPidMVAWeights () | |
Destructor. | |
void | setEnergyUnit (const double &unit) |
Set the energy unit to ensure consistency w/ the one used to define the bins grid. | |
void | setAngularUnit (const double &unit) |
Set the angular unit to ensure consistency w/ the one used to define the bins grid. | |
void | setWeightCategories (TH2F *h) |
Set the 2D (clusterTheta, p) grid representing the categories for which weightfiles are defined. More... | |
void | storeMVAWeights (const int pdg, const std::vector< std::string > &filepaths, const std::vector< std::pair< float, float >> &categoryBinCentres) |
Given a particle mass hypothesis' pdgId, store the list of MVA weight files (one for each category) into the payload. More... | |
void | storeMVAWeightsMultiClass (const std::vector< std::string > &filepaths, const std::vector< std::pair< float, float >> &categoryBinCentres) |
For the multi-class mode, store the list of MVA weight files (one for each category) into the payload. More... | |
void | storeCuts (const int pdg, const std::vector< std::string > &cutfiles, const std::vector< std::pair< float, float >> &categoryBinCentres) |
Given a particle mass hypothesis' pdgId, store the list of selection cuts (one for each category) into the payload. More... | |
void | storeCutsMultiClass (const std::vector< std::string > &cutfiles, const std::vector< std::pair< float, float >> &categoryBinCentres) |
For the multi-class mode, store the list of selection cuts (one for each category) into the payload. More... | |
const std::vector< std::string > * | getMVAWeights (const int pdg) const |
Given a particle mass hypothesis' pdgId, get the list of (serialized) MVA weightfiles stored in the payload, one for each (clusterTheta, p) category. More... | |
const std::vector< std::string > * | getMVAWeightsMulticlass () const |
For the multi-class mode, get the list of (serialized) MVA weightfiles stored in the payload, one for each (clusterTheta, p) category. | |
const std::vector< std::string > * | getCuts (const int pdg) const |
Given a particle mass hypothesis' pdgId, get the list of selection cuts stored in the payload, one for each (clusterTheta, p) category. More... | |
const std::vector< std::string > * | getCutsMulticlass () const |
For the multi-class mode, get the list of selection cuts stored in the payload, one for each (clusterTheta, p) category. | |
unsigned int | getMVAWeightIdx (const double &theta, const double &p, int &jth, int &ip) const |
Get the index of the XML weight file, for a given reconstructed pair (clusterTheta, p). More... | |
unsigned int | getMVAWeightIdx (const double &theta, const double &p) const |
Overloaded method, to be used if not interested in knowing the 2D (clusterTheta, p) bin coordinates. | |
void | dumpPayload (const double &theta, const double &p, const int pdg, bool dump_all=false) const |
Read and dump the payload content from the internal 'matrioska' maps into an XML weightfile for the given set of inputs. More... | |
void | dumpPayloadMulticlass (const double &theta, const double &p) const |
Special version for multi-class mode. | |
bool | isValidPdg (const int pdg) const |
Check if the input pdgId is that of a valid charged particle. More... | |
Private Types | |
typedef std::unordered_map< int, std::vector< std::string > > | WeightfilesByParticle |
Typedef. | |
Private Member Functions | |
int | findBin (const TH2F *h, const double &x, const double &y) const |
Find global bin index of a 2D histogram for the given (x, y) values. More... | |
ClassDef (ChargedPidMVAWeights, 5) | |
2: add energy/angular units. More... | |
Private Attributes | |
TParameter< double > | m_energy_unit |
The energy unit used for defining the bins grid. | |
TParameter< double > | m_ang_unit |
The angular unit used for defining the bins grid. | |
TH2F * | m_categories = nullptr |
A 2D (clusterTheta, p) histogram whose bins represent the categories for which XML weight files are defined. More... | |
WeightfilesByParticle | m_weightfiles |
For each charged particle mass hypothesis' pdgId, this map contains a list of (serialized) Weightfile objects to be stored in the payload. More... | |
WeightfilesByParticle | m_cuts |
For each charged particle mass hypothesis' pdgId, this map contains a list of selection cuts to be stored in the payload. More... | |
Class to contain the payload of MVA weightfiles needed for charged particle identification.
Definition at line 48 of file ChargedPidMVAWeights.h.
|
strong |
A (strongly-typed) enumerator identifier for each valid MVA training mode.
Definition at line 71 of file ChargedPidMVAWeights.h.
|
private |
2: add energy/angular units.
|
inline |
Read and dump the payload content from the internal 'matrioska' maps into an XML weightfile for the given set of inputs.
Useful for debugging.
theta | the particle polar angle (from the ECL cluster) in [rad]. |
p | the particle momentum (from the track) in [GeV/c]. |
pdg | the particle mass hypothesis' pdgId. |
dump_all | dump all information |
Definition at line 333 of file ChargedPidMVAWeights.h.
|
inlineprivate |
Find global bin index of a 2D histogram for the given (x, y) values.
This method had to be re-implemented b/c ROOT has no const version of TH1::FindBin() :(
h | 2D histogram |
x | value along the x axis. |
y | value along the y axis. |
Definition at line 409 of file ChargedPidMVAWeights.h.
|
inline |
Given a particle mass hypothesis' pdgId, get the list of selection cuts stored in the payload, one for each (clusterTheta, p) category.
pdg | the particle mass hypothesis' pdgId. |
pdg | the particle mass hypothesis' pdgId. |
Definition at line 267 of file ChargedPidMVAWeights.h.
|
inline |
Get the index of the XML weight file, for a given reconstructed pair (clusterTheta, p).
The index is obtained by linearising the 2D m_categories
histogram. The same index can be used to look up the correct MVAExpert, Dataset and Cut in the application module, hence we believe it's more useful to return the index rather than a pointer to the weightfile itself. The function also retrieves the (clusterTheta, p) bin coordinates.
theta | the particle polar angle (from the ECL cluster) in [rad]. | |
p | the particle momentum (from the track) in [GeV/c]. | |
[out] | jth | the index of the (theta, p) bin along the theta (X) axis. |
[out] | ip | the index of the (theta, p) bin along the p (Y) axis. |
Definition at line 295 of file ChargedPidMVAWeights.h.
|
inline |
Given a particle mass hypothesis' pdgId, get the list of (serialized) MVA weightfiles stored in the payload, one for each (clusterTheta, p) category.
pdg | the particle mass hypothesis' pdgId. |
Definition at line 245 of file ChargedPidMVAWeights.h.
|
inline |
Check if the input pdgId is that of a valid charged particle.
An input value of pdg=0 is considered valid, since it's reserved for multi-class mode.
Definition at line 391 of file ChargedPidMVAWeights.h.
|
inline |
Set the 2D (clusterTheta, p) grid representing the categories for which weightfiles are defined.
h | the 2D histogram. |
Definition at line 107 of file ChargedPidMVAWeights.h.
|
inline |
Given a particle mass hypothesis' pdgId, store the list of selection cuts (one for each category) into the payload.
pdg | the particle mass hypothesis' pdgId. |
cutfiles | a list of text files w/ cut strings, for each (clusterTheta, p) category. The format of the cut must comply with the GeneralCut syntax. |
categoryBinCentres | a list of pair<float, float> representing the (clusterTheta,p) bin centres. Used to check consistency of the xml vector indexing w/ the linearised TH2 category map. |
Definition at line 188 of file ChargedPidMVAWeights.h.
|
inline |
For the multi-class mode, store the list of selection cuts (one for each category) into the payload.
cutfiles | a list of text files w/ cut strings, for each (clusterTheta, p) category. The format of the cut must comply with the GeneralCut syntax. |
categoryBinCentres | a list of pair<float, float> representing the (clusterTheta,p) bin centres. Used to check consistency of the xml vector indexing w/ the linearised TH2 category map. |
Definition at line 234 of file ChargedPidMVAWeights.h.
|
inline |
Given a particle mass hypothesis' pdgId, store the list of MVA weight files (one for each category) into the payload.
pdg | the particle mass hypothesis' pdgId. |
filepaths | a list of xml (root) file paths for several (clusterTheta,p) categories. |
categoryBinCentres | a list of pair<float, float> representing the (clusterTheta,p) bin centres. Used to check consistency of the xml vector indexing w/ the linearised TH2 category map. |
Definition at line 121 of file ChargedPidMVAWeights.h.
|
inline |
For the multi-class mode, store the list of MVA weight files (one for each category) into the payload.
filepaths | a list of xml (root) file paths for several (clusterTheta,p) categories. |
categoryBinCentres | a list of pair<float, float> representing the (clusterTheta,p) bin centres. Used to check consistency of the xml vector indexing w/ the linearised TH2 category map. |
Definition at line 171 of file ChargedPidMVAWeights.h.
|
private |
A 2D (clusterTheta, p) histogram whose bins represent the categories for which XML weight files are defined.
It is used to lookup the correct file in the payload, given a reconstructed pair (clusterTheta, p).
Definition at line 444 of file ChargedPidMVAWeights.h.
|
private |
For each charged particle mass hypothesis' pdgId, this map contains a list of selection cuts to be stored in the payload.
To each Weightfile (i.e., category) corresponds a cut. The indexing in each vector must reflect the one of the corresponding 'linearised' TH2F histogram contained in the m_grids map.
The dummy pdgId=0 key is reserved for multi-class, where a unique signal hypothesis is not defined.
Definition at line 474 of file ChargedPidMVAWeights.h.
|
private |
For each charged particle mass hypothesis' pdgId, this map contains a list of (serialized) Weightfile objects to be stored in the payload.
Each weightfile in the list corresponds to a (clusterTheta, p) category. The indexing in each vector must reflect the one of the corresponding 'linearised' TH2F histogram contained in the m_grids map.
The dummy pdgId=0 key is reserved for multi-class, where a unique signal hypothesis is not defined.
Definition at line 455 of file ChargedPidMVAWeights.h.