Belle II Software development
CDCDedxCorrectionModule.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 <cmath>
12#include <algorithm>
13#include <TMath.h>
14#include <vector>
15
16#include <framework/core/Module.h>
17#include <framework/datastore/StoreArray.h>
18#include <framework/database/DBObjPtr.h>
19
20#include <reconstruction/dataobjects/CDCDedxTrack.h>
21#include <reconstruction/dataobjects/DedxConstants.h>
22#include <reconstruction/dbobjects/CDCDedxScaleFactor.h>
23#include <reconstruction/dbobjects/CDCDedxMomentumCor.h>
24#include <reconstruction/dbobjects/CDCDedxWireGain.h>
25#include <reconstruction/dbobjects/CDCDedxRunGain.h>
26#include <reconstruction/dbobjects/CDCDedxInjectionTime.h>
27#include <reconstruction/dbobjects/CDCDedxCosineCor.h>
28#include <reconstruction/dbobjects/CDCDedx2DCell.h>
29#include <reconstruction/dbobjects/CDCDedx1DCell.h>
30#include <reconstruction/dbobjects/CDCDedxHadronCor.h>
31#include <reconstruction/dbobjects/CDCDedxADCNonLinearity.h>
32#include <reconstruction/dbobjects/CDCDedxCosineEdge.h>
33
34#include <mdst/dataobjects/EventLevelTriggerTimeInfo.h>
35
36#include <cdc/geometry/CDCGeometryParConstants.h>
37#include <cdc/geometry/CDCGeometryPar.h>
38
39namespace Belle2 {
44 class CDCDedxTrack;
45
53
54 public:
55
60
64 virtual void initialize() override;
65
68 virtual void event() override;
69
71 virtual void terminate() override;
72
74 void RunGainCorrection(double& dedx) const;
75
77 void TimeGainCorrection(double& dedx, double ring, double time) const;
78
80 void WireGainCorrection(int wireID, double& dedx, int layer) const;
81
83 void TwoDCorrection(int layer, double doca, double enta, double& dedx) const;
84
86 void OneDCorrection(int layer, double enta, double& dedx) const;
87
89 void CosineCorrection(double costheta, double& dedx) const;
90
92 void CosineEdgeCorrection(double costh, double& dedx) const;
93
96 void HadronCorrection(double costheta, double& dedx) const;
97
99 void StandardCorrection(int adc, int layer, int wireID, double doca, double enta, double length,
100 double costheta, double ring, double time, double& dedx) const;
101
103 double GetCorrection(int& adc, int layer, int wireID, double doca, double enta, double costheta, double ring, double time) const;
104
107 double D2I(const double cosTheta, const double D) const;
108
111 double I2D(const double cosTheta, const double I) const;
112
113 private:
114
117 bool m_momCor;
132 //parameters: calibration constants
144 std::vector<double> m_hadronpars;
145 std::array<double, 56> m_lgainavg;
148 void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
149
154
155 };
157} // Belle2 namespace
This module may be used to apply the corrections to dE/dx per the calibration constants.
bool m_twoDCell
boolean to apply 2D correction
double D2I(const double cosTheta, const double D) const
Saturation correction: convert the measured ionization (D) to actual ionization (I)
bool m_runGain
boolean to apply run gains
StoreObjPtr< EventLevelTriggerTimeInfo > m_TTDInfo
Store Object Ptr: EventLevelTriggerTimeInfo.
std::vector< double > m_hadronpars
hadron saturation parameters
bool m_cosineEdge
boolean to apply cosine edge
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
bool m_useDBMomCor
boolean to apply momentum correction from DB
void TwoDCorrection(int layer, double doca, double enta, double &dedx) const
Perform a 2D correction.
DBObjPtr< CDCDedxMomentumCor > m_DBMomentumCor
Momentum correction DB object.
bool m_momCor
boolean to apply momentum correction
virtual void initialize() override
Initialize the Module.
bool m_scaleCor
boolean to apply scale factor
DBObjPtr< CDCDedxHadronCor > m_DBHadronCor
hadron saturation parameters
virtual void event() override
This method is called for each event.
double m_removeHighest
upper bound for truncated mean
DBObjPtr< CDCDedxCosineEdge > m_DBCosEdgeCor
cosine edge calibration
double I2D(const double cosTheta, const double I) const
Saturation correction: convert the actural ionization (I) to measured ionization (D)
std::array< double, 56 > m_lgainavg
average calibration factor for the layer
void OneDCorrection(int layer, double enta, double &dedx) const
Perform a wire gain correction.
DBObjPtr< CDCDedxADCNonLinearity > m_DBNonlADC
hadron saturation non linearity
DBObjPtr< CDCDedx1DCell > m_DB1DCell
1D correction DB object
virtual void terminate() override
End of the event processing.
bool m_oneDCell
boolean to apply 1D correction
void HadronCorrection(double costheta, double &dedx) const
Perform a hadron saturation correction.
void calculateMeans(double *mean, double *truncatedMean, double *truncatedMeanErr, const std::vector< double > &dedx) const
Recalculate the dE/dx mean values after corrections.
void StandardCorrection(int adc, int layer, int wireID, double doca, double enta, double length, double costheta, double ring, double time, double &dedx) const
Perform a standard set of corrections.
DBObjPtr< CDCDedx2DCell > m_DB2DCell
2D correction DB object
bool m_nonlADC
boolean to apply non linear ADC
bool m_relative
boolean to apply relative or absolute correction
DBObjPtr< CDCDedxCosineCor > m_DBCosineCor
Electron saturation correction DB object.
StoreArray< CDCDedxTrack > m_cdcDedxTracks
Store array: CDCDedxTrack.
bool m_timeGain
boolean to apply injection time gains
void CosineEdgeCorrection(double costh, double &dedx) const
Perform the cosine edge correction.
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
void CosineCorrection(double costheta, double &dedx) const
Perform the cosine correction.
void WireGainCorrection(int wireID, double &dedx, int layer) const
Perform a wire gain correction.
bool m_cosineCor
boolean to apply cosine correction
void RunGainCorrection(double &dedx) const
Perform a run gain correction.
double GetCorrection(int &adc, int layer, int wireID, double doca, double enta, double costheta, double ring, double time) const
Get the standard set of corrections.
double m_removeLowest
lower bound for truncated mean
DBObjPtr< CDCDedxInjectionTime > m_DBInjectTime
time gain/reso DB object
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
void TimeGainCorrection(double &dedx, double ring, double time) const
Perform a injection time gain correction.
bool m_wireGain
boolean to apply wire gains
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
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.