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 <reconstruction/dataobjects/CDCDedxTrack.h>
15#include <reconstruction/dataobjects/CDCDedxLikelihood.h>
16
17#include <mdst/dataobjects/Track.h>
18#include <mdst/dataobjects/MCParticle.h>
19#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
20
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/CDCDedxInjectionTime.h>
38#include <cdc/dbobjects/CDCdEdxPDFs.h>
39
40#include <vector>
41
42
43namespace Belle2 {
67 class CDCDedxPIDModule : public Module {
68
69 public:
70
73
75 virtual ~CDCDedxPIDModule();
76
78 virtual void initialize() override;
79
82 virtual void event() override;
83
85 virtual void terminate() override;
86
87 private:
88
89 // outputs
93 // required inputs
97 // optional inputs
101 double meanCurve(double* x, double* par, int version) const;
102
104 double getMean(double bg) const;
105
107 double sigmaCurve(double* x, const double* par, int version) const;
108
110 double getSigma(double dedx, double nhit, double cos, double timereso) const;
111
113 double I2D(double cosTheta, double I) const;
114
116 double D2I(double cosTheta, double D) const;
117
125 void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
126
139 double(&predres)[Const::ChargedStable::c_SetSize], double p, double dedx, double cos, int nhit, double timereso) const;
140
141
148 void saveLookupLogl(double(&logl)[Const::ChargedStable::c_SetSize], double p, double dedx);
149
151 void checkPDFs();
152
153 // parameters to determine the predicted means and resolutions
154 std::vector<double> m_meanpars;
155 std::vector<double> m_sigmapars;
157 // pdfs for PID
172 // parameters: calibration constants
184 std::vector<double> m_hadronpars;
186 int m_nLayerWires[9] = {};
188 // parameters to determine the predicted means and resolutions and hadron correction
192 };
194} // Belle2 namespace
Extract CDC dE/dx information from fitted tracks.
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
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Abstract base class for different kinds of events.