Belle II Software development
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
37
38 public:
39
44
49
53 virtual void initialize() override;
54
58 virtual void event() override;
59
63 virtual void terminate() override;
64
65 private:
66
71 static constexpr float c_PID = 0.5;
72
77 static constexpr unsigned int c_chargedStableHypos = 2 * Const::ChargedStable::c_SetSize;
78
83 std::vector<int> m_inputPdgIdList;
84
89 std::vector<unsigned int> m_mergeChargeOfPdgIds;
90
94 std::map<Const::ChargedStable, bool> m_mergeChargeFlagByHypo;
95
100 std::set<int> m_inputPdgIdSet;
101
107 std::vector<TFile*> m_outputFile = std::vector<TFile*>(c_chargedStableHypos);
108
113 std::string m_outputFileName;
114
120
126 std::vector<TTree*> m_tree = std::vector<TTree*>(c_chargedStableHypos);
127
135 std::vector<float> m_p = std::vector<float>(c_chargedStableHypos);
136
144 std::vector<float> m_pt = std::vector<float>(c_chargedStableHypos);
145
153 std::vector<float> m_trkTheta = std::vector<float>(c_chargedStableHypos);
154
162 std::vector<float> m_trkPhi = std::vector<float>(c_chargedStableHypos);
163
172 std::vector<float> m_clusterTheta = std::vector<float>(c_chargedStableHypos);
173
182 std::vector<float> m_clusterReg = std::vector<float>(c_chargedStableHypos);
183
192 std::vector<float> m_clusterPhi = std::vector<float>(c_chargedStableHypos);
193
199 std::vector<float> m_trackClusterMatch = std::vector<float>(c_chargedStableHypos);
200
208 std::vector<float> m_logl_sig = std::vector<float>(c_chargedStableHypos);
209
219 std::vector<float> m_logl_bkg = std::vector<float>(c_chargedStableHypos);
220
235 std::vector<float> m_deltalogl_sig_bkg = std::vector<float>(c_chargedStableHypos);
236
248 std::vector<std::vector<float>> m_pids_glob = std::vector<std::vector<float>>(c_chargedStableHypos,
249 std::vector<float>(Const::ChargedStable::c_SetSize));
250
255 std::vector<float> m_p_binedges = {0.0, 0.5, 0.75, 1.0, 3.0, 5.0};
256
261 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};
262
267
271 static void dumpPIDVars(TTree* sampleTree, const Const::ChargedStable& sigHypo, const int sigCharge,
272 const Const::ChargedStable& bkgHypo,
273 bool mergeSigCharge = false);
274
286 void dumpPIDEfficiencyFakeRate(TTree* sampleTree, const Const::ChargedStable& sampleHypo, const int sampleCharge,
287 const Const::ChargedStable& sigHypo, bool mergeSampleCharge = false);
288
298 void dumpTrkClusMatchingEfficiency(TTree* sampleTree, const Const::ChargedStable& sampleHypo, const int sampleCharge,
299 bool mergeSampleCharge = false);
300
304 static bool isValidChargedPdg(const int pdg)
305 {
307 }
308
312 static void paintUnderOverflow(TH1F* h);
313
314 };
315
316}
Provides a type-safe way to pass members of the chargedStableSet set.
Definition Const.h:590
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition Const.h:616
static const ParticleSet chargedStableSet
set of charged stable particles
Definition Const.h:619
static const ParticleType invalidParticle
Invalid particle, used internally.
Definition Const.h:682
static bool isValidChargedPdg(const int pdg)
Check if the input pdgId is that of a valid charged stable particle.
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.
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.
static 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.
virtual ~ECLChargedPIDDataAnalysisValidationModule() override
Destructor of the module.
std::vector< float > m_logl_bkg
Log-likelihood for the "background" particle hypothesis.
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 ...
static 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.