Belle II Software  release-06-02-00
CombinedPIDPerformanceModule.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 #include <framework/core/Module.h>
12 #include <TFile.h>
13 #include <TList.h>
14 #include <TEfficiency.h>
15 #include <TH3F.h>
16 
17 #include <mdst/dataobjects/MCParticle.h>
18 #include <mdst/dataobjects/PIDLikelihood.h>
19 #include <mdst/dataobjects/Track.h>
20 #include <mdst/dataobjects/TrackFitResult.h>
21 
22 #include <framework/datastore/StoreArray.h>
23 #include <framework/gearbox/Const.h>
24 
25 namespace Belle2 {
38 
39  public:
40 
43 
46 
48  virtual void initialize() override;
49 
51  virtual void event() override;
52 
54  virtual void terminate() override;
55 
56  private:
57 
58  // required input
65  TList* m_histoList{nullptr};
66 
68  TEfficiency* createEfficiency(const char* name, const char* title,
69  Int_t nbins, Double_t min, Double_t max, TList* histoList = NULL);
70 
72  void fillEfficiencyHistos(const TrackFitResult* fitResult, const PIDLikelihood* pid, int pdg);
73 
74  /* user-defined parameters */
75  std::string m_rootFileName;
76  std::string m_mdstType;
77  int m_nbins;
78  double m_pLow;
79  double m_pHigh;
81  /* ROOT file related parameters */
82  TFile* m_rootFilePtr;
84  /* list of histograms filled per MCParticle found in the event */
85  // TEfficiencies for each particle type
86  std::vector< TEfficiency* > m_piK_Efficiencies;
87  std::vector< TEfficiency* > m_Kpi_Efficiencies;
88  std::vector< TEfficiency* > m_ppi_Efficiencies;
89  std::vector< TEfficiency* > m_pK_Efficiencies;
90  std::vector< TEfficiency* > m_dpi_Efficiencies;
91  std::vector< TEfficiency* > m_epi_Efficiencies;
92  std::vector< TEfficiency* > m_mpi_Efficiencies;
94  // TEfficiencies for fake rates
95  std::vector< TEfficiency* > m_piK_FakeRates;
96  std::vector< TEfficiency* > m_Kpi_FakeRates;
97  std::vector< TEfficiency* > m_ppi_FakeRates;
98  std::vector< TEfficiency* > m_pK_FakeRates;
99  std::vector< TEfficiency* > m_dpi_FakeRates;
100  std::vector< TEfficiency* > m_epi_FakeRates;
101  std::vector< TEfficiency* > m_mpi_FakeRates;
103  TH3F* h_ROC[5][10] = {};
106  double pidvalue(float pida, float pidb);
107 
109  bool pidavail(const PIDLikelihood* pid, Const::DetectorSet dets);
110 
111  // determine which detectors to use for each particle
117  enum dettype {svd, cdc, top, arich, klm, ecl, dedx, dedxtop, dedxecl, all};
118  std::vector<int> detset;
119  std::vector<int> edetset;
121  };
123 } // end of namespace
This module takes the MCParticles, the Tracks, and the PIDLikelihoods as input and produces a root fi...
bool pidavail(const PIDLikelihood *pid, Const::DetectorSet dets)
determine the availability of the given detector(s)
std::vector< TEfficiency * > m_dpi_FakeRates
deuteron fake rates
TEfficiency * createEfficiency(const char *name, const char *title, Int_t nbins, Double_t min, Double_t max, TList *histoList=NULL)
method to create TEfficiencies
std::vector< TEfficiency * > m_dpi_Efficiencies
deuteron efficiencies
double m_pHigh
upper bound of momentum range
dettype
enumeration for detector numbering
std::vector< TEfficiency * > m_epi_FakeRates
electron fake rates
virtual void initialize() override
Initialize the module.
std::vector< TEfficiency * > m_ppi_Efficiencies
proton efficiencies
std::vector< TEfficiency * > m_mpi_FakeRates
muon fake rates
virtual void event() override
This method is called for each event.
void fillEfficiencyHistos(const TrackFitResult *fitResult, const PIDLikelihood *pid, int pdg)
method to fill TEfficiencies
std::vector< TEfficiency * > m_pK_Efficiencies
proton efficiencies
std::vector< TEfficiency * > m_piK_FakeRates
pion fake rates
StoreArray< TrackFitResult > m_trackFitResults
Required array of input TrackFitResults.
virtual void terminate() override
End of the event processing.
double pidvalue(float pida, float pidb)
returns the likelihood ratio for given log likelihoods
std::vector< TEfficiency * > m_mpi_Efficiencies
muon efficiencies
std::vector< int > edetset
set of detectors used electrons
std::vector< TEfficiency * > m_ppi_FakeRates
proton fake rates
StoreArray< Track > m_tracks
Required array of input Tracks.
std::vector< int > detset
set of detectors used for hadrons
std::vector< TEfficiency * > m_Kpi_Efficiencies
kaon efficiencies
std::vector< TEfficiency * > m_epi_Efficiencies
electron efficiencies
std::vector< TEfficiency * > m_piK_Efficiencies
pion efficiencies
std::vector< TEfficiency * > m_pK_FakeRates
proton fake rates
StoreArray< MCParticle > m_mcParticles
Required array of input MCParticles.
StoreArray< PIDLikelihood > m_pidLikelihoods
Required array of input PIDLikelihoods.
std::string m_mdstType
flag for Belle/BelleII mdst files
std::vector< TEfficiency * > m_Kpi_FakeRates
kaon fake rates
TFile * m_rootFilePtr
pointer at root file used for storing histograms
double m_pLow
lower bound of momentum range
Const::DetectorSet chargedSet
pions, kaons, protons
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:71
Base class for Modules.
Definition: Module.h:72
Class to collect log likelihoods from TOP, ARICH, dEdx, ECL and KLM aimed for output to mdst includes...
Definition: PIDLikelihood.h:26
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Values of the result of a track fit with a given particle hypothesis.
Abstract base class for different kinds of events.