Belle II Software  release-05-02-19
CDCDedxPIDModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jake Bennett, Christian Pulvermacher
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <framework/core/Module.h>
14 #include <framework/gearbox/Const.h>
15 
16 #include <reconstruction/dataobjects/CDCDedxTrack.h>
17 #include <reconstruction/dataobjects/CDCDedxLikelihood.h>
18 
19 #include <mdst/dataobjects/Track.h>
20 #include <mdst/dataobjects/MCParticle.h>
21 #include <tracking/dataobjects/RecoTrack.h>
22 
23 #include <framework/datastore/StoreArray.h>
24 #include <framework/database/DBObjPtr.h>
25 
26 #include <reconstruction/dbobjects/CDCDedxScaleFactor.h>
27 #include <reconstruction/dbobjects/CDCDedxWireGain.h>
28 #include <reconstruction/dbobjects/CDCDedxRunGain.h>
29 #include <reconstruction/dbobjects/CDCDedxCosineCor.h>
30 #include <reconstruction/dbobjects/CDCDedx2DCell.h>
31 #include <reconstruction/dbobjects/CDCDedx1DCell.h>
32 #include <reconstruction/dbobjects/CDCDedxADCNonLinearity.h>
33 #include <reconstruction/dbobjects/CDCDedxCosineEdge.h>
34 #include <reconstruction/dbobjects/CDCDedxMeanPars.h>
35 #include <reconstruction/dbobjects/CDCDedxSigmaPars.h>
36 #include <reconstruction/dbobjects/CDCDedxHadronCor.h>
37 #include <reconstruction/dbobjects/DedxPDFs.h>
38 
39 #include <vector>
40 
41 
42 namespace Belle2 {
66  class CDCDedxPIDModule : public Module {
67 
68  public:
69 
72 
74  virtual ~CDCDedxPIDModule();
75 
77  virtual void initialize() override;
78 
81  virtual void event() override;
82 
84  virtual void terminate() override;
85 
86  private:
87 
88  // outputs
92  // required inputs
96  // optional inputs
100  double meanCurve(double* x, double* par, int version) const;
101 
103  double getMean(double bg) const;
104 
106  double sigmaCurve(double* x, double* par, int version) const;
107 
109  double getSigma(double dedx, double nhit, double sin) const;
110 
112  double I2D(double cosTheta, double I) const;
113 
115  double D2I(double cosTheta, double D) const;
116 
124  void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
125 
135  double(&predres)[Const::ChargedStable::c_SetSize], double p, double dedx, double sin, int nhit) const;
136 
137 
145  void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx);
146 
148  void checkPDFs();
149 
150  // parameters to determine the predicted means and resolutions
151  std::vector<double> m_meanpars;
152  std::vector<double> m_sigmapars;
154  // pdfs for PID
157  bool m_trackLevel;
158  bool m_usePrediction;
159  double m_removeLowest;
161  bool m_backHalfCurlers;
162  bool m_enableDebugOutput;
164  bool m_useIndividualHits;
169  // parameters: calibration constants
180  std::vector<double> m_hadronpars;
182  int m_nLayerWires[9] = {};
184  // parameters to determine the predicted means and resolutions and hadron correction
188  };
190 } // Belle2 namespace
Belle2::CDCDedxPIDModule::m_ignoreMissingParticles
bool m_ignoreMissingParticles
Ignore particles for which no PDFs are found.
Definition: CDCDedxPIDModule.h:175
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::CDCDedxPIDModule::m_DBScaleFactor
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
Definition: CDCDedxPIDModule.h:178
Belle2::CDCDedxPIDModule::m_nLayerWires
int m_nLayerWires[9]
number of wires per layer: needed for wire gain calibration
Definition: CDCDedxPIDModule.h:190
Belle2::CDCDedxPIDModule::m_tracks
StoreArray< Track > m_tracks
Required array of input Tracks.
Definition: CDCDedxPIDModule.h:101
Belle2::CDCDedxPIDModule::m_hadronpars
std::vector< double > m_hadronpars
hadron saturation parameters
Definition: CDCDedxPIDModule.h:188
Belle2::CDCDedxPIDModule::getMean
double getMean(double bg) const
calculate the predicted mean using the parameterized resolution
Definition: CDCDedxPIDModule.cc:787
Belle2::CDCDedxPIDModule::getSigma
double getSigma(double dedx, double nhit, double sin) const
calculate the predicted resolution using the parameterized resolution
Definition: CDCDedxPIDModule.cc:837
Belle2::CDCDedxPIDModule::saveLookupLogl
void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx)
for all particles, save log-likelihood values into 'logl'.
Definition: CDCDedxPIDModule.cc:678
Belle2::CDCDedxPIDModule::terminate
virtual void terminate() override
End of the event processing.
Definition: CDCDedxPIDModule.cc:624
Belle2::CDCDedxPIDModule::event
virtual void event() override
This method is called for each event.
Definition: CDCDedxPIDModule.cc:173
Belle2::CDCDedxPIDModule::m_mcparticles
StoreArray< MCParticle > m_mcparticles
Optional array of input MCParticles.
Definition: CDCDedxPIDModule.h:105
Belle2::CDCDedxPIDModule::meanCurve
double meanCurve(double *x, double *par, int version) const
parameterized beta-gamma curve for predicted means
Definition: CDCDedxPIDModule.cc:768
Belle2::CDCDedxPIDModule::m_useIndividualHits
bool m_useIndividualHits
Include PDF value for each hit in likelihood.
Definition: CDCDedxPIDModule.h:172
Belle2::CDCDedxPIDModule::m_DBCosineCor
DBObjPtr< CDCDedxCosineCor > m_DBCosineCor
Electron saturation correction DB object.
Definition: CDCDedxPIDModule.h:181
Belle2::CDCDedxPIDModule::m_backHalfCurlers
bool m_backHalfCurlers
Whether to use the back half of curlers.
Definition: CDCDedxPIDModule.h:169
Belle2::CDCDedxPIDModule::m_onlyPrimaryParticles
bool m_onlyPrimaryParticles
Only save data for primary particles (as determined by MC truth)
Definition: CDCDedxPIDModule.h:174
Belle2::CDCDedxPIDModule::m_dedxTracks
StoreArray< CDCDedxTrack > m_dedxTracks
Output array of CDCDedxTracks.
Definition: CDCDedxPIDModule.h:97
Belle2::CDCDedxPIDModule::m_DBWireGains
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
Definition: CDCDedxPIDModule.h:179
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::CDCDedxPIDModule::m_meanpars
std::vector< double > m_meanpars
dE/dx mean parameters
Definition: CDCDedxPIDModule.h:159
Belle2::CDCDedxPIDModule::m_DBMeanPars
DBObjPtr< CDCDedxMeanPars > m_DBMeanPars
dE/dx mean parameters
Definition: CDCDedxPIDModule.h:193
Belle2::CDCDedxPIDModule::initialize
virtual void initialize() override
Initialize the module.
Definition: CDCDedxPIDModule.cc:114
Belle2::CDCDedxPIDModule::m_trackLevel
bool m_trackLevel
Whether to use track-level or hit-level MC.
Definition: CDCDedxPIDModule.h:165
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDCDedxPIDModule::m_DBRunGain
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
Definition: CDCDedxPIDModule.h:180
Belle2::CDCDedxPIDModule::m_usePrediction
bool m_usePrediction
Whether to use parameterized means and resolutions or lookup tables.
Definition: CDCDedxPIDModule.h:166
Belle2::CDCDedxPIDModule::D2I
double D2I(double cosTheta, double D) const
hadron saturation parameterization part 2
Definition: CDCDedxPIDModule.cc:714
Belle2::CDCDedxPIDModule::m_enableDebugOutput
bool m_enableDebugOutput
Whether to save information on tracks and associated hits and dE/dx values in DedxTrack objects.
Definition: CDCDedxPIDModule.h:170
Belle2::CDCDedxPIDModule::~CDCDedxPIDModule
virtual ~CDCDedxPIDModule()
Destructor.
Definition: CDCDedxPIDModule.cc:74
Belle2::CDCDedxPIDModule::m_DBDedxPDFs
DBObjPtr< DedxPDFs > m_DBDedxPDFs
DB object for dedx:momentum PDFs.
Definition: CDCDedxPIDModule.h:163
Belle2::CDCDedxPIDModule::m_removeLowest
double m_removeLowest
Portion of lowest dE/dx values that should be discarded for truncated mean.
Definition: CDCDedxPIDModule.h:167
Belle2::CDCDedxPIDModule::calculateMeans
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
Definition: CDCDedxPIDModule.cc:630
Belle2::CDCDedxPIDModule::m_DB2DCell
DBObjPtr< CDCDedx2DCell > m_DB2DCell
2D correction DB object
Definition: CDCDedxPIDModule.h:182
Belle2::CDCDedxPIDModule::m_DBCosEdgeCor
DBObjPtr< CDCDedxCosineEdge > m_DBCosEdgeCor
non-lineary ACD correction DB object
Definition: CDCDedxPIDModule.h:185
Belle2::CDCDedxPIDModule::m_DBNonlADC
DBObjPtr< CDCDedxADCNonLinearity > m_DBNonlADC
non-lineary ACD correction DB object
Definition: CDCDedxPIDModule.h:184
Belle2::CDCDedxPIDModule::saveChiValue
void saveChiValue(double(&chi)[Const::ChargedStable::c_SetSize], double(&predmean)[Const::ChargedStable::c_SetSize], double(&predres)[Const::ChargedStable::c_SetSize], double p, double dedx, double sin, int nhit) const
for all particles, save chi values into 'chi'.
Definition: CDCDedxPIDModule.cc:866
Belle2::CDCDedxPIDModule::m_removeHighest
double m_removeHighest
Portion of highest dE/dx values that should be discarded for truncated mean.
Definition: CDCDedxPIDModule.h:168
Belle2::CDCDedxPIDModule::m_recoTracks
StoreArray< RecoTrack > m_recoTracks
Required array of input RecoTracks.
Definition: CDCDedxPIDModule.h:102
Belle2::CDCDedxPIDModule::m_DBSigmaPars
DBObjPtr< CDCDedxSigmaPars > m_DBSigmaPars
dE/dx resolution parameters
Definition: CDCDedxPIDModule.h:194
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::CDCDedxPIDModule::CDCDedxPIDModule
CDCDedxPIDModule()
Default constructor.
Definition: CDCDedxPIDModule.cc:45
Belle2::CDCDedxPIDModule::m_DB1DCell
DBObjPtr< CDCDedx1DCell > m_DB1DCell
1D correction DB object
Definition: CDCDedxPIDModule.h:183
Belle2::CDCDedxPIDModule::m_sigmapars
std::vector< double > m_sigmapars
dE/dx resolution parameters
Definition: CDCDedxPIDModule.h:160
Belle2::CDCDedxPIDModule::I2D
double I2D(double cosTheta, double I) const
hadron saturation parameterization part 1
Definition: CDCDedxPIDModule.cc:736
Belle2::CDCDedxPIDModule::m_dedxLikelihoods
StoreArray< CDCDedxLikelihood > m_dedxLikelihoods
Output array of CDCDedxLikelihoods.
Definition: CDCDedxPIDModule.h:98
Belle2::CDCDedxPIDModule::sigmaCurve
double sigmaCurve(double *x, double *par, int version) const
parameterized resolution for predictions
Definition: CDCDedxPIDModule.cc:818
Belle2::CDCDedxPIDModule::checkPDFs
void checkPDFs()
Check the pdfs for consistency everytime they change in the database.
Definition: CDCDedxPIDModule.cc:76
Belle2::CDCDedxPIDModule::m_DBHadronCor
DBObjPtr< CDCDedxHadronCor > m_DBHadronCor
hadron saturation parameters
Definition: CDCDedxPIDModule.h:186