Belle II Software development
CDCDedxPIDModule.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 <framework/gearbox/Const.h>
13
14#include <cdc/dataobjects/CDCDedxTrack.h>
15#include <cdc/dataobjects/CDCDedxLikelihood.h>
16
17#include <mdst/dataobjects/Track.h>
18#include <mdst/dataobjects/MCParticle.h>
19
20#include <tracking/dataobjects/RecoTrack.h>
21
22#include <framework/datastore/StoreArray.h>
23#include <framework/database/DBObjPtr.h>
24
25#include <cdc/dbobjects/CDCDedxScaleFactor.h>
26#include <cdc/dbobjects/CDCDedxWireGain.h>
27#include <cdc/dbobjects/CDCDedxRunGain.h>
28#include <cdc/dbobjects/CDCDedxCosineCor.h>
29#include <cdc/dbobjects/CDCDedx2DCell.h>
30#include <cdc/dbobjects/CDCDedx1DCell.h>
31#include <cdc/dbobjects/CDCDedxADCNonLinearity.h>
32#include <cdc/dbobjects/CDCDedxCosineEdge.h>
33#include <cdc/dbobjects/CDCDedxMeanPars.h>
34#include <cdc/dbobjects/CDCDedxSigmaPars.h>
35#include <cdc/dbobjects/CDCDedxHadronCor.h>
36#include <cdc/dbobjects/CDCDedxInjectionTime.h>
37#include <cdc/dbobjects/CDCdEdxPDFs.h>
38
39#include <vector>
40
41
42namespace Belle2 {
47
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
91
92 // required inputs
95
96 // optional inputs
98
100 double meanCurve(double* x, double* par, int version) const;
101
103 double getMean(double bg) const;
104
106 double sigmaCurve(double* x, const double* par, int version) const;
107
109 double getSigma(double dedx, double nhit, double cos, double timereso) 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
138 double(&predres)[Const::ChargedStable::c_SetSize], double p, double dedx, double cos, int nhit, double timereso) const;
139
140
147 void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx);
148
150 void checkPDFs();
151
152 // parameters to determine the predicted means and resolutions
153 std::vector<double> m_meanpars;
154 std::vector<double> m_sigmapars;
155
156 // pdfs for PID
158
165
167
170
171 // parameters: calibration constants
182
183 std::vector<double> m_hadronpars;
184
185 int m_nLayerWires[9] = {};
186
187 // parameters to determine the predicted means and resolutions and hadron correction
190
191 };
192
193} // Belle2 namespace
double I2D(double cosTheta, double I) const
hadron saturation parameterization part 1
double D2I(double cosTheta, double D) const
hadron saturation parameterization part 2
double getMean(double bg) const
calculate the predicted mean using the parameterized resolution
virtual ~CDCDedxPIDModule()
Destructor.
std::vector< double > m_hadronpars
hadron saturation parameters
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
double sigmaCurve(double *x, const double *par, int version) const
parameterized resolution for predictions
DBObjPtr< CDCDedxMeanPars > m_DBMeanPars
dE/dx mean parameters
virtual void initialize() override
Initialize the module.
DBObjPtr< CDCDedxHadronCor > m_DBHadronCor
hadron saturation parameters
virtual void event() override
This method is called for each event.
double m_removeHighest
Portion of highest dE/dx values that should be discarded for truncated mean.
StoreArray< CDCDedxLikelihood > m_dedxLikelihoods
Output array of CDCDedxLikelihoods.
DBObjPtr< CDCDedxCosineEdge > m_DBCosEdgeCor
non-linearly ACD correction DB object
StoreArray< MCParticle > m_mcparticles
Optional array of input MCParticles.
void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx)
for all particles, save log-likelihood values into 'logl'.
DBObjPtr< CDCDedxADCNonLinearity > m_DBNonlADC
non-linearly ACD correction DB object
DBObjPtr< CDCDedx1DCell > m_DB1DCell
1D correction DB object
void checkPDFs()
Check the pdfs for consistency every time they change in the database.
virtual void terminate() override
End of the event processing.
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 cos, int nhit, double timereso) const
for all particles, save chi values into 'chi'.
double meanCurve(double *x, double *par, int version) const
parameterized beta-gamma curve for predicted means
std::vector< double > m_sigmapars
dE/dx resolution parameters
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Save arithmetic and truncated mean for the 'dedx' values.
DBObjPtr< CDCDedx2DCell > m_DB2DCell
2D correction DB object
double getSigma(double dedx, double nhit, double cos, double timereso) const
calculate the predicted resolution using the parameterized resolution
DBObjPtr< CDCDedxCosineCor > m_DBCosineCor
Electron saturation correction DB object.
bool m_ignoreMissingParticles
Ignore particles for which no PDFs are found.
StoreArray< Track > m_tracks
Required array of input Tracks.
int m_nLayerWires[9]
number of wires per layer: needed for wire gain calibration
CDCDedxPIDModule()
Default constructor.
bool m_onlyPrimaryParticles
Only save data for primary particles (as determined by MC truth)
DBObjPtr< CDCdEdxPDFs > m_DBDedxPDFs
DB object for dedx:momentum PDFs.
DBObjPtr< CDCDedxSigmaPars > m_DBSigmaPars
dE/dx resolution parameters
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
std::vector< double > m_meanpars
dE/dx mean parameters
bool m_backHalfCurlers
Whether to use the back half of curlers.
bool m_trackLevel
Whether to use track-level or hit-level MC.
StoreArray< RecoTrack > m_recoTracks
Required array of input RecoTracks.
bool m_useIndividualHits
Include PDF value for each hit in likelihood.
bool m_usePrediction
Whether to use parameterized means and resolutions or lookup tables.
double m_removeLowest
Portion of lowest dE/dx values that should be discarded for truncated mean.
StoreArray< CDCDedxTrack > m_dedxTracks
Output array of CDCDedxTracks.
bool m_enableDebugOutput
Whether to save information on tracks and associated hits and dE/dx values in DedxTrack objects.
DBObjPtr< CDCDedxInjectionTime > m_DBInjectTime
time gain/reso DB object
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
static const unsigned int c_SetSize
Number of elements (for use in array bounds etc.)
Definition Const.h:615
Class for accessing objects in the database.
Definition DBObjPtr.h:21
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.