Belle II Software  release-05-02-19
ECLChargedPIDModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Guglielmo De Nardo *
7  * Marco Milesi (marco.milesi@unimelb.edu.au) *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 //FRAMEWORK
15 #include <framework/core/Module.h>
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/datastore/StoreObjPtr.h>
18 #include <framework/dataobjects/EventMetaData.h>
19 #include <framework/gearbox/Const.h>
20 #include <framework/logging/Logger.h>
21 #include <framework/utilities/FileSystem.h>
22 #include <framework/gearbox/Unit.h>
23 #include <framework/database/DBObjPtr.h>
24 
25 //MDST
26 #include <mdst/dataobjects/Track.h>
27 
28 //ECL
29 #include <ecl/dataobjects/ECLShower.h>
30 #include <ecl/dataobjects/ECLPidLikelihood.h>
31 #include <ecl/dbobjects/ECLChargedPidPDFs.h>
32 
33 
34 namespace Belle2 {
63  class ECLChargedPIDModule : public Module {
64 
65  public:
66 
71 
75  virtual ~ECLChargedPIDModule();
76 
80  void checkPdfsDB();
81 
88  virtual void initialize() override;
89 
95  virtual void beginRun() override;
96 
102  virtual void event() override;
103 
109  virtual void endRun() override;
110 
114  virtual void terminate() override;
115 
116  private:
117 
121  StoreArray<Track> m_tracks;
122 
126  StoreArray<ECLPidLikelihood> m_eclPidLikelihoods;
127 
131  DBObjPtr<ECLChargedPidPDFs> m_pdfs;
132 
138  static constexpr double c_dummyLogL = 0.0;
139 
144 
160  std::unordered_map<ECLChargedPidPDFs::InputVar, double> m_variables {
172  };
173 
177  StoreObjPtr<EventMetaData> m_eventMetaData;
178 
188  inline int linIndex(int i, int j, int m)
189  {
190  return j + m * i;
191  }
192 
201  void transfoGaussDecorr(const unsigned int pdg, const int charge, const double& p, const double& theta,
202  std::vector<double>& variables);
203 
208  double getPdfVal(const double& x, const TF1* pdf);
209 
213  static constexpr double c_sqrt2 = 1.41421356237309504880;
214 
215  };
216 
218 } //Belle2
Belle2::ECLChargedPIDModule::m_tracks
StoreArray< Track > m_tracks
Array of Track objects.
Definition: ECLChargedPIDModule.h:130
Belle2::ECLChargedPidPDFs::InputVar::c_Z51
@ c_Z51
Zernike moment 51.
Belle2::ECLChargedPidPDFs::InputVar::c_PSDMVA
@ c_PSDMVA
PSD MVA.
Belle2::ECLChargedPIDModule::m_eclPidLikelihoods
StoreArray< ECLPidLikelihood > m_eclPidLikelihoods
Array of ECLPidLikelihood objects.
Definition: ECLChargedPIDModule.h:135
Belle2::ECLChargedPIDModule::getPdfVal
double getPdfVal(const double &x, const TF1 *pdf)
Extract the PDF value for a given variable from the TF1 object.
Definition: ECLChargedPIDModule.cc:211
Belle2::ECLChargedPIDModule::linIndex
int linIndex(int i, int j, int m)
Get the index corresponding to element i,j in a linearised n*m array.
Definition: ECLChargedPIDModule.h:197
Belle2::ECLChargedPIDModule::initialize
virtual void initialize() override
Use this to initialize resources or memory your module needs.
Definition: ECLChargedPIDModule.cc:39
Belle2::ECLChargedPidPDFs::InputVar::c_ZMVA
@ c_ZMVA
Zernike MVA.
Belle2::ECLChargedPIDModule::~ECLChargedPIDModule
virtual ~ECLChargedPIDModule()
Destructor, use to clean up anything you created in the constructor.
Definition: ECLChargedPIDModule.cc:36
Belle2::ECLChargedPidPDFs::InputVar::c_EoP
@ c_EoP
E/p.
Belle2::ECLChargedPIDModule::checkPdfsDB
void checkPdfsDB()
Check the PDFs payload for consistency everytime they change in the database.
Definition: ECLChargedPIDModule.cc:48
Belle2::ECLChargedPIDModule::beginRun
virtual void beginRun() override
Called once before a new run begins.
Definition: ECLChargedPIDModule.cc:54
Belle2::ECLChargedPIDModule::event
virtual void event() override
Called once for each event.
Definition: ECLChargedPIDModule.cc:61
Belle2::ECLChargedPIDModule::m_pdfs
DBObjPtr< ECLChargedPidPDFs > m_pdfs
Interface to get the DB payload for ECL charged PID PDFs.
Definition: ECLChargedPIDModule.h:140
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ECLChargedPidPDFs::InputVar::c_LAT
@ c_LAT
Lateral shower shape.
Belle2::ECLChargedPidPDFs::InputVar::c_E1E9
@ c_E1E9
E1/E9.
Belle2::ECLChargedPidPDFs::InputVar::c_E9E21
@ c_E9E21
E9/E21.
Belle2::ECLChargedPIDModule::c_dummyLogL
static constexpr double c_dummyLogL
Dummy value of Log Likelihood for a particle hypothesis.
Definition: ECLChargedPIDModule.h:147
Belle2::ECLChargedPIDModule::m_variables
std::unordered_map< ECLChargedPidPDFs::InputVar, double > m_variables
Map to contain ECL shower observables.
Definition: ECLChargedPIDModule.h:169
Belle2::ECLChargedPIDModule::c_sqrt2
static constexpr double c_sqrt2
Defintion of sqrt(2)
Definition: ECLChargedPIDModule.h:222
Belle2::ECLChargedPIDModule::terminate
virtual void terminate() override
Clean up anything you created in initialize().
Definition: ECLChargedPIDModule.cc:326
Belle2::ECLChargedPidPDFs::InputVar::c_Z40
@ c_Z40
Zernike moment 40.
Belle2::ECLChargedPIDModule::ECLChargedPIDModule
ECLChargedPIDModule()
Constructor, for setting module description and parameters.
Definition: ECLChargedPIDModule.cc:23
Belle2::ECLChargedPIDModule::transfoGaussDecorr
void transfoGaussDecorr(const unsigned int pdg, const int charge, const double &p, const double &theta, std::vector< double > &variables)
Transform input variables according to:
Definition: ECLChargedPIDModule.cc:224
Belle2::ECLChargedPidPDFs::InputVar::c_E
@ c_E
Energy of maxE shower.
Belle2::ECLChargedPIDModule::endRun
virtual void endRun() override
Called once when a run ends.
Definition: ECLChargedPIDModule.cc:322
Belle2::ECLChargedPidPDFs::InputVar::c_DeltaL
@ c_DeltaL
DeltaL (track depth)
Belle2::ECLChargedPIDModule::m_applyClusterTimingSel
bool m_applyClusterTimingSel
Apply cluster timing selection.
Definition: ECLChargedPIDModule.h:152
Belle2::ECLChargedPidPDFs::InputVar::c_S2
@ c_S2
Second moment.
Belle2::ECLChargedPIDModule::m_eventMetaData
StoreObjPtr< EventMetaData > m_eventMetaData
The event information.
Definition: ECLChargedPIDModule.h:186