Belle II Software  release-06-02-00
HitLevelInfoWriter.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 <reconstruction/dataobjects/CDCDedxTrack.h>
12 
13 #include <mdst/dataobjects/Track.h>
14 #include <mdst/dataobjects/TrackFitResult.h>
15 #include <mdst/dataobjects/ECLCluster.h>
16 #include <mdst/dataobjects/KLMCluster.h>
17 #include <mdst/dataobjects/HitPatternCDC.h>
18 
19 #include <genfit/Track.h>
20 
21 #include <framework/dataobjects/EventMetaData.h>
22 #include <framework/datastore/StoreArray.h>
23 #include <framework/datastore/StoreObjPtr.h>
24 #include <framework/database/DBObjPtr.h>
25 #include <framework/core/Module.h>
26 
27 #include <reconstruction/dbobjects/CDCDedxScaleFactor.h>
28 #include <reconstruction/dbobjects/CDCDedxWireGain.h>
29 #include <reconstruction/dbobjects/CDCDedxRunGain.h>
30 #include <reconstruction/dbobjects/CDCDedxCosineCor.h>
31 #include <reconstruction/dbobjects/CDCDedx2DCell.h>
32 #include <reconstruction/dbobjects/CDCDedx1DCell.h>
33 #include <reconstruction/dbobjects/CDCDedxADCNonLinearity.h> //new in rel5
34 #include <reconstruction/dbobjects/CDCDedxCosineEdge.h> //new in rel5
35 #include <mdst/dbobjects/BeamSpot.h>
36 
37 #include <analysis/dataobjects/ParticleList.h>
38 #include <analysis/dataobjects/Particle.h>
39 #include <analysis/utility/ReferenceFrame.h>
40 
41 #include <vector>
42 
43 #include <TFile.h>
44 #include <TTree.h>
45 #include <TString.h>
46 
47 class TH2F;
48 
49 namespace Belle2 {
55  class CDCDedxTrack;
56 
60 
61  public:
62 
65 
67  virtual ~HitLevelInfoWriterModule();
68 
70  virtual void initialize() override;
71 
74  virtual void event() override;
75 
77  virtual void terminate() override;
78 
80  void bookOutput(std::string filename);
81 
82  private:
83 
84  std::string m_strOutputBaseName;
85  std::vector<std::string> m_strParticleList;
86  std::vector<std::string> m_filename;
87  std::vector<TFile*> m_file;
88  std::vector<TTree*> m_tree;
97  void fillTrack(const TrackFitResult* fitResult);
98 
100  void fillDedx(CDCDedxTrack* dedxTrack);
101 
103  void clearEntries();
104 
105  // event level information (from emd)
106  int m_expID{ -1};
107  int m_runID{ -1};
108  int m_eventID{ -1};
110  // track level information (from tfr)
111  double m_d0{0.};
112  double m_z0{0.};
113  double m_dz{ -1.};
114  double m_dr{ -1.};
115  double m_dphi{ -1.};
116  double m_vx0{0.};
117  double m_vy0{0.};
118  double m_vz0{0.};
119  double m_tanlambda{ -1.};
120  double m_phi0{ -1.};
121  double m_chi2{ -1.};
123  double m_nCDChits{ -1.};
124  int m_inCDC{ -1};
125  int m_trackID{ -1};
126  double m_length{ -1.};
127  int m_charge{0};
128  double m_cosTheta{ -2.};
129  double m_pCDC{ -1.};
130  double m_p{ -1.};
131  double m_pt{ -1.};
132  double m_phi{ -1.};
133  double m_ioasym{ -1.};
134  double m_theta{ -2.};
136  // track level Mc
137  double m_PDG{ -1.};
138  // double m_motherPDG; /**< MC PID of mother particle */
139  // double m_pTrue; /**< MC true momentum */
140  // double m_trackDist; /**< the total distance traveled by the track */
141 
142  // track level dE/dx measurements
143  double m_mean{ -1.};
144  double m_trunc{ -1.};
145  double m_truncNoSat{ -1.};
146  double m_error{ -1.};
148  // other dec specific information
149  double m_eop{ -1.};
150  double m_e{ -1.};
151  double m_e1_9{ -1.};
152  double m_e9_21{ -1.};
153  double m_klmLayers{ -1.};
155  // calibration constants
156  double m_scale{ -1.};
157  double m_cosCor{ -1.};
158  double m_cosEdgeCor{ -1.};
159  double m_runGain{ -1.};
161  // hadron cal and PID related variables
162  double m_chie{ -1.};
163  double m_chimu{ -1.};
164  double m_chipi{ -1.};
165  double m_chik{ -1.};
166  double m_chip{ -1.};
167  double m_chid{ -1.};
169  double m_prese{ -1.};
170  double m_presmu{ -1.};
171  double m_prespi{ -1.};
172  double m_presk{ -1.};
173  double m_presp{ -1.};
174  double m_presd{ -1.};
176  double m_pmeane{ -1.};
177  double m_pmeanmu{ -1.};
178  double m_pmeanpi{ -1.};
179  double m_pmeank{ -1.};
180  double m_pmeanp{ -1.};
181  double m_pmeand{ -1.};
183  static const int kMaxHits = 200;
184  // layer level information
185  int l_nhits{ -1};
186  int l_nhitsused{ -1};
189  int l_layer[kMaxHits] = {};
190  double l_path[kMaxHits] = {};
191  double l_dedx[kMaxHits] = {};
193  // hit level information (references on nhits)
194  int h_nhits{ -1};
195  int h_lwire[kMaxHits] = {};
196  int h_wire[kMaxHits] = {};
197  int h_layer[kMaxHits] = {};
199  double h_path[kMaxHits] = {};
200  double h_dedx[kMaxHits] = {};
201  double h_adcraw[kMaxHits] = {};
202  double h_adccorr[kMaxHits] = {};
203  double h_doca[kMaxHits] = {};
204  double h_ndoca[kMaxHits] = {};
205  double h_ndocaRS[kMaxHits] = {};
206  double h_enta[kMaxHits] = {};
207  double h_entaRS[kMaxHits] = {};
208  double h_driftT[kMaxHits] = {};
209  double h_driftD[kMaxHits] = {};
210  double h_facnladc[kMaxHits] = {};
211  double h_wireGain[kMaxHits] = {};
212  double h_twodCor[kMaxHits] = {};
213  double h_onedCor[kMaxHits] = {};
215  //Tracking variables for extra hits
216  double h_WeightPionHypo[kMaxHits] = {};
217  double h_WeightKaonHypo[kMaxHits] = {};
221  // parameters: calibration constants
231  bool nodeadwire;
232  //Flag to enable and disable set of variables
236  };
238 } // Belle2 namespace
Debug output for CDCDedxPID module.
Definition: CDCDedxTrack.h:25
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
Extracts dE/dx information for calibration testing.
double h_ndoca[kMaxHits]
normalized distance of closest approach
double h_driftD[kMaxHits]
drift distance
double h_onedCor[kMaxHits]
calibration 1D cleanup correction
int l_nhits
the total number of layer hits for this Track
double m_cosEdgeCor
calibration cosine edge correction
double m_presk
pred reso for kaon hypothesis
double m_phi0
Angle of the transverse momentum in the r-phi plane.
double m_d0
Signed distance to the POCA in the r-phi plane.
double m_presp
pred reso for proton hypothesis
int l_wirelongesthit[kMaxHits]
the wire number of longest hit in this layer
double m_ioasym
asymmetry in increasing vs decreasing layer numbers per track
double m_p
momentum from tracking
double m_e9_21
ratio of energies of the central 3x3 crystal vs 5x5 crystals
int m_trackID
ID number of the Track.
DBObjPtr< CDCDedxRunGain > m_DBRunGain
Run gain DB object.
double m_vx0
X coordinate of track POCA to origin.
virtual ~HitLevelInfoWriterModule()
Destructor.
StoreArray< KLMCluster > m_klmClusters
Required array of input KLMClusters.
double m_pmeand
pred mean for deuteron hypothesis
virtual void initialize() override
Initialize the module.
double h_enta[kMaxHits]
entrance angle
bool enableHitLevel
Flag to switch on/off hit level info.
std::string m_strOutputBaseName
Base name for the output ROOT files.
virtual void event() override
This method is called for each event.
double h_WeightKaonHypo[kMaxHits]
weight for kaon hypothesis from KalmanFitterInfo
DBObjPtr< CDCDedxCosineEdge > m_DBCosEdgeCor
cosine edge calibration
HitLevelInfoWriterModule()
Default constructor.
double m_pmeanp
pred mean for proton hypothesis
double h_WeightProtonHypo[kMaxHits]
weight for proton hypothesis from KalmanFitterInfo
double m_chid
chi value for deuteron hypothesis
double m_dz
vertex or POCA in case of tracks z in respect to IPs
DBObjPtr< CDCDedxADCNonLinearity > m_DBNonlADC
hadron saturation non linearity
double m_pmeank
pred mean for kaon hypothesis
double h_facnladc[kMaxHits]
calibration hit gain
DBObjPtr< CDCDedx1DCell > m_DB1DCell
1D correction DB object
StoreArray< TrackFitResult > m_trackFitResults
Required array of input TrackFitResults.
int h_nhits
the number of good hits for this Track
std::vector< std::string > m_filename
full names of the output ROOT files
virtual void terminate() override
End of the event processing.
double h_adccorr[kMaxHits]
charge per hit corr by nonlinear ADC
double m_presmu
pred reso for muon hypothesis
double m_cosCor
calibration cosine correction
double m_tanlambda
Slope of the track in the r-z plane.
int h_layer[kMaxHits]
layer number
double h_adcraw[kMaxHits]
charge per hit
int m_expID
experiment in which this Track was found
void fillTrack(const TrackFitResult *fitResult)
Fill the TTree with the information from the track fit.
double h_path[kMaxHits]
path length in cell
double m_chimu
chi value for muon hypothesis
double m_vy0
Y coordinate of track POCA to origin.
double m_chik
chi value for kaon hypothesis
double m_chi2
chi^2 from track fit
double h_wireGain[kMaxHits]
calibration hit gain
double m_theta
cos(theta) for the track
double h_twodCor[kMaxHits]
calibration 2D correction
double m_chie
chi value for electron hypothesis
DBObjPtr< CDCDedx2DCell > m_DB2DCell
2D correction DB object
double m_runGain
calibration run gain
int m_eventID
event in which this Track was found
void bookOutput(std::string filename)
Create the output TFiles and TTrees.
void clearEntries()
Clear the arrays before filling an event.
double m_dr
track d0 relative to IP
double m_prese
pred reso for electron hypothesis
DBObjPtr< CDCDedxCosineCor > m_DBCosineCor
Electron saturation correction DB object.
int h_foundByTrackFinder[kMaxHits]
the 'found by track finder' flag for the given hit
StoreArray< Track > m_tracks
Required array of input Tracks.
double l_dedx[kMaxHits]
dE/dx for this layer
double l_path[kMaxHits]
distance travelled in this layer
int l_layer[kMaxHits]
layer number
std::vector< TFile * > m_file
output ROOT files
double m_chip
chi value for proton hypothesis
double m_pmeane
pred mean for electron hypothesis
double m_cosTheta
cos(theta) for the track
int l_nhitsused
the total number of layer hits used for this Track
StoreArray< ECLCluster > m_eclClusters
Required array of input ECLClusters.
double h_dedx[kMaxHits]
charge per path length
double h_driftT[kMaxHits]
drift time
double m_dphi
POCA in degrees in respect to IP.
DBObjPtr< CDCDedxWireGain > m_DBWireGains
Wire gain DB object.
double m_eop
energy over momentum in the calorimeter
double m_presd
pred reso for deuteron hypothesis
double m_scale
calibration scale factor
double m_klmLayers
number of klm layers with hits
int l_nhitscombined[kMaxHits]
the number of hits combined this layer
double m_error
standard deviation of the truncated mean
double m_pCDC
momentum valid in CDC
double m_truncNoSat
dE/dx averaged, truncated mean, with corrections (not hadron)
double m_length
total path length of the Track
double m_nCDChits
Number of CDC hits associated to the track.
static const int kMaxHits
default hit level index
double h_ndocaRS[kMaxHits]
normalized +RS distance of closest approach
double m_vz0
Z coordinate of track POCA to origin.
double m_trunc
dE/dx averaged, truncated mean, with corrections
int m_inCDC
frack is CDC acceptance or not
double h_doca[kMaxHits]
distance of closest approach
double m_z0
z coordinate of the POCA
int m_charge
the charge for this Track
double h_WeightPionHypo[kMaxHits]
weight for pion hypothesis from KalmanFitterInfo
bool nodeadwire
write only active wires
std::vector< TTree * > m_tree
output ROOT trees
int m_runID
run in which this Track was found
double m_e
energy in the calorimeter
StoreArray< CDCDedxTrack > m_dedxTracks
Required array of CDCDedxTracks.
double m_pmeanmu
pred mean for muon hypothesis
double h_entaRS[kMaxHits]
normalized + RS distance of entrance angle
double m_prespi
pred reso for pion hypothesis
int h_wire[kMaxHits]
sense wire ID
DBObjPtr< CDCDedxScaleFactor > m_DBScaleFactor
Scale factor to make electrons ~1.
bool enableExtraVar
Flag to switch on/off extra level info and some available w/ release/5 only.
int h_lwire[kMaxHits]
sense wire within layer
double m_chipi
chi value for pion hypothesis
std::vector< std::string > m_strParticleList
Vector of ParticleLists to write out.
double m_pt
transverse momentum from tracking
double m_pmeanpi
pred mean for pion hypothesis
void fillDedx(CDCDedxTrack *dedxTrack)
Fill the TTree with the information from a CDCDedxTrack object.
double m_e1_9
ratio of energies of the central 1 crystal vs 3x3 crystals
Base class for Modules.
Definition: Module.h:72
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Values of the result of a track fit with a given particle hypothesis.
Abstract base class for different kinds of events.