Belle II Software  release-06-00-14
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 <framework/core/Module.h>
12 
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/database/DBObjPtr.h>
15 
16 #include <reconstruction/dbobjects/CDCDedxScaleFactor.h>
17 #include <reconstruction/dbobjects/CDCDedxMomentumCor.h>
18 #include <reconstruction/dbobjects/CDCDedxWireGain.h>
19 #include <reconstruction/dbobjects/CDCDedxRunGain.h>
20 #include <reconstruction/dbobjects/CDCDedxCosineCor.h>
21 #include <reconstruction/dbobjects/CDCDedx2DCell.h>
22 #include <reconstruction/dbobjects/CDCDedx1DCell.h>
23 #include <reconstruction/dbobjects/CDCDedxHadronCor.h>
24 #include <reconstruction/dbobjects/CDCDedxADCNonLinearity.h> //new in rel5
25 #include <reconstruction/dbobjects/CDCDedxCosineEdge.h> //new in rel5
26 
27 #include <vector>
28 
29 namespace Belle2 {
34  class CDCDedxTrack;
35 
43 
44  public:
45 
49  virtual ~CDCDedxCorrectionModule();
50 
54  virtual void initialize() override;
55 
58  virtual void event() override;
59 
61  virtual void terminate() override;
62 
64  void RunGainCorrection(double& dedx) const;
65 
67  void WireGainCorrection(int wireID, double& dedx) const;
68 
70  void TwoDCorrection(int layer, double doca, double enta, double& dedx) const;
71 
73  void OneDCorrection(int layer, double enta, double& dedx) const;
74 
76  void CosineCorrection(double costheta, double& dedx) const;
77 
79  void CosineEdgeCorrection(double costh, double& dedx) const;
80 
83  void HadronCorrection(double costheta, double& dedx) const;
84 
86  void StandardCorrection(int adc, int layer, int wireID, double doca, double enta, double length, double costheta,
87  double& dedx) const;
88 
90  double GetCorrection(int& adc, int layer, int wireID, double doca, double enta, double costheta) const;
91 
94  double D2I(const double cosTheta, const double D) const;
95 
98  double I2D(const double cosTheta, const double I) const;
99 
100  private:
101 
102  bool m_relative;
104  bool m_momCor;
106  bool m_scaleCor;
107  bool m_cosineCor;
108  bool m_wireGain;
109  bool m_runGain;
110  bool m_twoDCell;
111  bool m_oneDCell;
113  bool m_nonlADC;
117  //parameters: calibration constants
129  std::vector<double> m_hadronpars;
132  void calculateMeans(double* mean, double* truncatedMean, double* truncatedMeanErr, const std::vector<double>& dedx) const;
133 
138 
139  };
141 } // 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
void WireGainCorrection(int wireID, double &dedx) const
Perform a wire gain correction.
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)
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.
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.
void CosineEdgeCorrection(double costh, double &dedx) const
Perform the cosine edge correction.
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
double GetCorrection(int &adc, int layer, int wireID, double doca, double enta, double costheta) const
Get the standard set of corrections.
void CosineCorrection(double costheta, double &dedx) const
Perform the cosine correction.
bool m_cosineCor
boolean to apply cosine correction
void RunGainCorrection(double &dedx) const
Perform a run gain correction.
void StandardCorrection(int adc, int layer, int wireID, double doca, double enta, double length, double costheta, double &dedx) const
Perform a standard set of corrections.
double m_removeLowest
lower bound for truncated mean
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
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
Abstract base class for different kinds of events.