Belle II Software prerelease-10-00-00a
ECLChargedPIDDataAnalysisValidationModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11// Belle 2
12#include <mdst/dataobjects/MCParticle.h>
13
14// ROOT
15#include <TFile.h>
16#include <TH1F.h>
17#include <TTree.h>
18
19// FRAMEWORK
20#include <framework/core/Module.h>
21#include <framework/datastore/StoreArray.h>
22#include <framework/gearbox/Const.h>
23
24#include <set>
25
26namespace Belle2 {
31
40
41 public:
42
47
52
56 virtual void initialize() override;
57
61 virtual void beginRun() override;
62
66 virtual void event() override;
67
71 virtual void endRun() override;
72
76 virtual void terminate() override;
77
78 private:
79
84 static constexpr float c_PID = 0.5;
85
90 static constexpr unsigned int c_chargedStableHypos = 2 * Const::ChargedStable::c_SetSize;
91
96 std::vector<int> m_inputPdgIdList;
97
102 std::vector<unsigned int> m_mergeChargeOfPdgIds;
103
107 std::map<Const::ChargedStable, bool> m_mergeChargeFlagByHypo;
108
113 std::set<int> m_inputPdgIdSet;
114
120 std::vector<TFile*> m_outputFile = std::vector<TFile*>(c_chargedStableHypos);
121
126 std::string m_outputFileName;
127
133
139 std::vector<TTree*> m_tree = std::vector<TTree*>(c_chargedStableHypos);
140
148 std::vector<float> m_p = std::vector<float>(c_chargedStableHypos);
149
157 std::vector<float> m_pt = std::vector<float>(c_chargedStableHypos);
158
166 std::vector<float> m_trkTheta = std::vector<float>(c_chargedStableHypos);
167
175 std::vector<float> m_trkPhi = std::vector<float>(c_chargedStableHypos);
176
185 std::vector<float> m_clusterTheta = std::vector<float>(c_chargedStableHypos);
186
195 std::vector<float> m_clusterReg = std::vector<float>(c_chargedStableHypos);
196
205 std::vector<float> m_clusterPhi = std::vector<float>(c_chargedStableHypos);
206
212 std::vector<float> m_trackClusterMatch = std::vector<float>(c_chargedStableHypos);
213
221 std::vector<float> m_logl_sig = std::vector<float>(c_chargedStableHypos);
222
232 std::vector<float> m_logl_bkg = std::vector<float>(c_chargedStableHypos);
233
248 std::vector<float> m_deltalogl_sig_bkg = std::vector<float>(c_chargedStableHypos);
249
261 std::vector<std::vector<float>> m_pids_glob = std::vector<std::vector<float>>(c_chargedStableHypos,
262 std::vector<float>(Const::ChargedStable::c_SetSize));
263
268 std::vector<float> m_p_binedges = {0.0, 0.5, 0.75, 1.0, 3.0, 5.0};
269
274 std::vector<float> m_th_binedges = {0.0, 0.2164208, 0.385, 0.561996, 1.13, 1.57, 1.88, 2.2462387, 2.47, 2.7070057, 3.1415926};
275
280
284 void dumpPIDVars(TTree* sampleTree, const Const::ChargedStable& sigHypo, const int sigCharge, const Const::ChargedStable& bkgHypo,
285 bool mergeSigCharge = false);
286
298 void dumpPIDEfficiencyFakeRate(TTree* sampleTree, const Const::ChargedStable& sampleHypo, const int sampleCharge,
299 const Const::ChargedStable& sigHypo, bool mergeSampleCharge = false);
300
310 void dumpTrkClusMatchingEfficiency(TTree* sampleTree, const Const::ChargedStable& sampleHypo, const int sampleCharge,
311 bool mergeSampleCharge = false);
312
316 inline bool isValidChargedPdg(const int pdg) const
317 {
319 }
320
324 void paintUnderOverflow(TH1F* h);
325
326 };
327
328}
Provides a type-safe way to pass members of the chargedStableSet set.
Definition Const.h:589
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition Const.h:615
static const ParticleSet chargedStableSet
set of charged stable particles
Definition Const.h:618
static const ParticleType invalidParticle
Invalid particle, used internally.
Definition Const.h:681
static constexpr unsigned int c_chargedStableHypos
The maximal number of charged stable particle hypotheses.
std::vector< float > m_trackClusterMatch
Flag for track-cluster matching condition.
bool isValidChargedPdg(const int pdg) const
Check if the input pdgId is that of a valid charged stable particle.
std::vector< float > m_th_binedges
Binning w/ variable bin size for track polar angle (in [rad]).
std::set< int > m_inputPdgIdSet
The pdgId set of the charged stable particles of interest.
std::vector< float > m_deltalogl_sig_bkg
Delta Log-likelihood "signal" vs.
void paintUnderOverflow(TH1F *h)
Draw u/oflow content on top of first/last visible bin.
std::vector< float > m_p_binedges
Binning w/ variable bin size for track momentum (in [GeV/c]).
static constexpr float c_PID
Definition of the PID cut threshold to compute the efficiency.
std::vector< float > m_pt
Track transverse momentum in [GeV/c].
void dumpPIDEfficiencyFakeRate(TTree *sampleTree, const Const::ChargedStable &sampleHypo, const int sampleCharge, const Const::ChargedStable &sigHypo, bool mergeSampleCharge=false)
Dump PID efficiency / fake rate vs clusterTheta, clusterPhi, p... for a fixed cut on PID as previousl...
bool m_saveValidationTree
Save the TTree in the output file alongside the histograms.
std::vector< float > m_logl_bkg
Log-likelihood for the "background" particle hypothesis.
virtual void beginRun() override
Called once before a new run begins.
std::vector< float > m_clusterPhi
Cluster azimuthal angle in [rad].
std::vector< TFile * > m_outputFile
Output ROOT::TFile that contains the info to plot.
std::vector< float > m_clusterTheta
Cluster polar angle in [rad].
std::map< Const::ChargedStable, bool > m_mergeChargeFlagByHypo
A map to tell for each charged stable particle hypothesis whether particle and antiparticle should be...
std::vector< TTree * > m_tree
A ROOT::TTree filled with the info to make control plots.
std::vector< unsigned int > m_mergeChargeOfPdgIds
The (unsigned) pdgId list of the charged stable particles for which particle and antiparticle should ...
void dumpPIDVars(TTree *sampleTree, const Const::ChargedStable &sigHypo, const int sigCharge, const Const::ChargedStable &bkgHypo, bool mergeSigCharge=false)
Dump PID vars.
std::vector< std::vector< float > > m_pids_glob
List of global PIDs, defined by the likelihood ratio:
void dumpTrkClusMatchingEfficiency(TTree *sampleTree, const Const::ChargedStable &sampleHypo, const int sampleCharge, bool mergeSampleCharge=false)
Dump track-to-ECL-cluster matching efficiency vs clusterTheta, clusterPhi, pt....
std::vector< float > m_trkPhi
Track azimuthal angle in [rad].
std::vector< float > m_logl_sig
Log-likelihood for the "signal" particle hypothesis.
std::vector< int > m_inputPdgIdList
The pdgId list of the charged stable particles of interest.
Module()
Constructor.
Definition Module.cc:30
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
Abstract base class for different kinds of events.