Belle II Software  release-05-02-19
ECLChargedPIDDataAnalysisValidationModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Marco Milesi *
7  * Contact: marco.milesi@unimelb.edu.au *
8  * *
9  * This software is provided "as is" without any warranty. *
10  *************************************************************************/
11 
12 #pragma once
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/gearbox/Const.h>
22 
23 namespace Belle2 {
33  class ECLChargedPIDDataAnalysisValidationModule : public Module {
34 
35  public:
36 
41 
46 
50  virtual void initialize() override;
51 
55  virtual void beginRun() override;
56 
60  virtual void event() override;
61 
65  virtual void endRun() override;
66 
70  virtual void terminate() override;
71 
72  private:
73 
78  static constexpr float c_PID = 0.5;
79 
84  static constexpr unsigned int c_chargedStableHypos = 2 * Const::ChargedStable::c_SetSize;
85 
90  std::vector<int> m_inputPdgIdList;
91 
96  std::vector<unsigned int> m_mergeChargeOfPdgIds;
97 
101  std::map<Const::ChargedStable, bool> m_mergeChargeFlagByHypo;
102 
107  std::set<int> m_inputPdgIdSet;
108 
114  std::vector<TFile*> m_outputFile = std::vector<TFile*>(c_chargedStableHypos);
115 
120  std::string m_outputFileName;
121 
127 
133  std::vector<TTree*> m_tree = std::vector<TTree*>(c_chargedStableHypos);
134 
142  std::vector<float> m_p = std::vector<float>(c_chargedStableHypos);
143 
151  std::vector<float> m_pt = std::vector<float>(c_chargedStableHypos);
152 
160  std::vector<float> m_trkTheta = std::vector<float>(c_chargedStableHypos);
161 
169  std::vector<float> m_trkPhi = std::vector<float>(c_chargedStableHypos);
170 
179  std::vector<float> m_clusterTheta = std::vector<float>(c_chargedStableHypos);
180 
189  std::vector<float> m_clusterReg = std::vector<float>(c_chargedStableHypos);
190 
199  std::vector<float> m_clusterPhi = std::vector<float>(c_chargedStableHypos);
200 
206  std::vector<float> m_trackClusterMatch = std::vector<float>(c_chargedStableHypos);
207 
215  std::vector<float> m_logl_sig = std::vector<float>(c_chargedStableHypos);
216 
226  std::vector<float> m_logl_bkg = std::vector<float>(c_chargedStableHypos);
227 
242  std::vector<float> m_deltalogl_sig_bkg = std::vector<float>(c_chargedStableHypos);
243 
255  std::vector<std::vector<float>> m_pids_glob = std::vector<std::vector<float>>(c_chargedStableHypos,
256  std::vector<float>(Const::ChargedStable::c_SetSize));
257 
262  std::vector<float> m_p_binedges = {0.0, 0.5, 0.75, 1.0, 3.0, 5.0};
263 
268  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};
269 
273  void dumpPIDVars(TTree* sampleTree, const Const::ChargedStable& sigHypo, const int sigCharge, const Const::ChargedStable& bkgHypo,
274  bool mergeSigCharge = false);
275 
287  void dumpPIDEfficiencyFakeRate(TTree* sampleTree, const Const::ChargedStable& sampleHypo, const int sampleCharge,
288  const Const::ChargedStable& sigHypo, bool mergeSampleCharge = false);
289 
299  void dumpTrkClusMatchingEfficiency(TTree* sampleTree, const Const::ChargedStable& sampleHypo, const int sampleCharge,
300  bool mergeSampleCharge = false);
301 
305  inline bool isValidChargedPdg(const int pdg) const
306  {
307  return (Const::chargedStableSet.find(pdg) != Const::invalidParticle);
308  }
309 
313  void paintUnderOverflow(TH1F* h);
314 
315  };
317 }
Belle2::Const::ChargedStable::c_SetSize
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition: Const.h:491
Belle2::ECLChargedPIDDataAnalysisValidationModule::terminate
virtual void terminate() override
Termination action.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:261
Belle2::Const::invalidParticle
static const ParticleType invalidParticle
Invalid particle, used internally.
Definition: Const.h:554
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_mergeChargeFlagByHypo
std::map< Const::ChargedStable, bool > m_mergeChargeFlagByHypo
A map to tell for each charged stable particle hypothesis whether particle and antiparticle should be...
Definition: ECLChargedPIDDataAnalysisValidationModule.h:110
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_outputFile
std::vector< TFile * > m_outputFile
Output ROOT::TFile that contains the info to plot.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:123
Belle2::Const::chargedStableSet
static const ParticleSet chargedStableSet
set of charged stable particles
Definition: Const.h:494
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_inputPdgIdList
std::vector< int > m_inputPdgIdList
The pdgId list of the charged stable particles of interest.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:99
Belle2::ECLChargedPIDDataAnalysisValidationModule::event
virtual void event() override
Called once for each event.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:124
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_logl_bkg
std::vector< float > m_logl_bkg
Log-likelihood for the "background" particle hypothesis.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:235
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_pt
std::vector< float > m_pt
Track transverse momentum in [GeV/c].
Definition: ECLChargedPIDDataAnalysisValidationModule.h:160
Belle2::ECLChargedPIDDataAnalysisValidationModule::c_chargedStableHypos
static constexpr unsigned int c_chargedStableHypos
The maximal number of charged stable particle hypotheses.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:93
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_trkPhi
std::vector< float > m_trkPhi
Track azimuthal angle in [rad].
Definition: ECLChargedPIDDataAnalysisValidationModule.h:178
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_clusterReg
std::vector< float > m_clusterReg
Cluster ECL region.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:198
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_deltalogl_sig_bkg
std::vector< float > m_deltalogl_sig_bkg
Delta Log-likelihood "signal" vs.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:251
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_p
std::vector< float > m_p
Track momentum in [GeV/c].
Definition: ECLChargedPIDDataAnalysisValidationModule.h:151
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_trackClusterMatch
std::vector< float > m_trackClusterMatch
Flag for track-cluster matching condition.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:215
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_logl_sig
std::vector< float > m_logl_sig
Log-likelihood for the "signal" particle hypothesis.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:224
Belle2::ECLChargedPIDDataAnalysisValidationModule::ECLChargedPIDDataAnalysisValidationModule
ECLChargedPIDDataAnalysisValidationModule()
Constructor of the module.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:23
Belle2::ECLChargedPIDDataAnalysisValidationModule::~ECLChargedPIDDataAnalysisValidationModule
virtual ~ECLChargedPIDDataAnalysisValidationModule()
Destructor of the module.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:49
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_mergeChargeOfPdgIds
std::vector< unsigned int > m_mergeChargeOfPdgIds
The (unsigned) pdgId list of the charged stable particles for which particle and antiparticle should ...
Definition: ECLChargedPIDDataAnalysisValidationModule.h:105
Belle2::ECLChargedPIDDataAnalysisValidationModule::initialize
virtual void initialize() override
Initializes the module.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:54
Belle2::ECLChargedPIDDataAnalysisValidationModule::beginRun
virtual void beginRun() override
Called once before a new run begins.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:120
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_trkTheta
std::vector< float > m_trkTheta
Track polar angle in [rad].
Definition: ECLChargedPIDDataAnalysisValidationModule.h:169
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_saveValidationTree
bool m_saveValidationTree
Save the TTree in the output file alongside the histograms.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:135
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_tree
std::vector< TTree * > m_tree
A ROOT::TTree filled with the info to make control plots.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:142
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_outputFileName
std::string m_outputFileName
Base name of the output ROOT::TFile.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:129
Belle2::ECLChargedPIDDataAnalysisValidationModule::endRun
virtual void endRun() override
Called once when a run ends.
Definition: ECLChargedPIDDataAnalysisValidationModule.cc:257
Belle2::ECLChargedPIDDataAnalysisValidationModule::c_PID
static constexpr float c_PID
Defintion of the PID cut threshold to compute the efficiency.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:87
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_clusterPhi
std::vector< float > m_clusterPhi
Cluster azimuthal angle in [rad].
Definition: ECLChargedPIDDataAnalysisValidationModule.h:208
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_inputPdgIdSet
std::set< int > m_inputPdgIdSet
The pdgId set of the charged stable particles of interest.
Definition: ECLChargedPIDDataAnalysisValidationModule.h:116
Belle2::ECLChargedPIDDataAnalysisValidationModule::m_clusterTheta
std::vector< float > m_clusterTheta
Cluster polar angle in [rad].
Definition: ECLChargedPIDDataAnalysisValidationModule.h:188