Belle II Software development
CDCCRTestModule.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/HistoModule.h>
12
13#include <cdc/dataobjects/WireID.h>
14
15#include <string>
16
17#include <mdst/dataobjects/Track.h>
18#include <mdst/dataobjects/TrackFitResult.h>
19#include <tracking/dataobjects/RecoTrack.h>
20#include <framework/dataobjects/EventT0.h>
21#include <framework/datastore/StoreArray.h>
22#include <framework/geometry/B2Vector3.h>
23#include <TH1.h>
24#include <TH2.h>
25#include <TProfile.h>
26#include <TTree.h>
27
28namespace Belle2 {
33
34 namespace CDC {
35
40
41 public:
42
47
51 virtual ~CDCCRTestModule() override;
52
56 void initialize() override;
57
61
62 void event() override;
63
68 void defineHisto() override;
69
70 private:
71
75 TH1* getHist(const char* name, const char* title,
76 int nBins, double x0, double x1)
77 {
78 TH1* h = new TH1D(name, title, nBins, x0, x1);
79 m_allHistos.push_back(h);
80 return h;
81 }
82
86 TProfile* getHistProfile(const char* name, const char* title,
87 int nBins, double x0, double x1)
88 {
89 TProfile* h = new TProfile(name, title, nBins, x0, x1);
90 m_allHistos.push_back(h);
91 return h;
92 }
93
97 TH2* getHist(const char* name, const char* title,
98 int nBinsX, double x0, double x1,
99 int nBinsY, double y0, double y1)
100 {
101 TH2* h = new TH2D(name, title, nBinsX, x0, x1, nBinsY, y0, y1);
102 m_allHistos.push_back(h);
103 return h;
104 }
105
109 TH1* getHist(const std::string& name, const std::string& title,
110 int nBins, double x0, double x1)
111 {
112 return getHist(name.c_str(), title.c_str(), nBins, x0, x1);
113 }
114
118 TProfile* getHistProfile(const std::string& name, const std::string& title,
119 int nBins, double x0, double x1)
120 {
121 return getHistProfile(name.c_str(), title.c_str(), nBins, x0, x1);
122 }
123
127 TH2* getHist(const std::string& name, const std::string& title,
128 int nBinsX, double x0, double x1,
129 int nBinsY, double y0, double y1)
130 {
131 return getHist(name.c_str(), title.c_str(), nBinsX, x0, x1, nBinsY, y0, y1);
132 }
133
134
138 const genfit::SharedPlanePtr constructPlane(const genfit::MeasuredStateOnPlane& state, WireID m_wireID);
139
144
148 void plotResults(Belle2::RecoTrack* track);
149
153 void getHitDistInTrackCand(const RecoTrack* track);//Draw hit distribution from track candidate
154
159
163 void HitEfficiency(const Belle2::RecoTrack* track);
164
168 static int getICLayer(int slayer, int ilayer)
169 {
170 if (slayer == 0) {return ilayer;}
171 else {return 8 + (slayer - 1) * 6 + ilayer;}
172 }
173
175
180
183
186
189
192
193 std::string m_trackArrayName;
194 std::string m_cdcHitArrayName ;
195 std::string m_recoTrackArrayName ;
199 std::vector<TH1*> m_allHistos;
200 std::string m_treeName;
201
202 TTree* m_tree = nullptr;
203 TH1* m_hNTracks = nullptr;
204 TH1* m_hNTracksPerEvent = nullptr;
206 TH1* m_hNDF = nullptr;
207 TH1* m_hNHits = nullptr;
208 TH1* m_hNHits_trackcand = nullptr;
209 TH1* m_hChi2 = nullptr;
210 TH1* m_hPval = nullptr;
211 TH2* m_hNDFChi2 = nullptr;
212 TH2* m_hNDFPval = nullptr;
213 TH1* m_hAlpha = nullptr;
214 TH1* m_hPhi0 = nullptr;
215 TH1* m_hTheta = nullptr;
216 TH1* m_hHitDistInCDCHit[56] = {};
217 TH1* m_hHitDistInTrCand[56] = {};
218 TH1* m_hHitDistInTrack[56] = {};
219 TH1* m_hResidualU[56] = {};
220 TH1* m_hEvtT0 = nullptr;
221 TH2* m_hNDFResidualU[56] = {};
224 TH2* m_hDxDt[56] = {};
225 TProfile* m_hHitEff_soft[56] = {};
226 TH2* m_h2DHitDistInCDCHit = nullptr;
227 TH2* m_h2DHitDistInTrCand = nullptr;
228 TH2* m_h2DHitDistInTrack = nullptr;
229 TH2* m_hTriggerHitZX = nullptr;
230
231
232 double res_b = 0.0;
233 double res_u = 0.0;
234 double res_b_err = 0.0;
235 double res_u_err = 0.0;
236 double weight = 0.0;
237 double absRes_b = 0.0;
238 double absRes_u = 0.0;
239 double alpha = 0.0;
240 double theta = 0.0;
241 unsigned short adc = 0;
242 short tdc = 0;
243 double t = 0.0;
244 double t_fit = 0.0;
245 double dt_flight = 0.0;
246 double dt_flight_sim = 0.0;
247 double dt_prop = 0.0;
248 double evtT0 = 0.0;
249 double Pt = 0.0;
250
251 double x_mea = 0.0;
252 double x_u = 0.0;
253 double x_b = 0.0;
254 double x_sim = 0.0;
255 double z = 0.0;
256 double z_sim = 0.0;
257 double z_prop = 0.0;
258 int lay = 0;
259 int IWire = 0;
260 int lr = 0;
261 int numhits = 0;
262 int boardID = 0;
263 double Pval = 0.0;
264 double TrPval = 0.0;
265 double ndf = 0.0;
266 double d0 = 0.0;
267 double z0 = 0.0;
268 double phi0 = 0.0;
269 double tanL = 0.0;
270 double omega = 0.0;
271 double m_MinimumPt = 0.0;
272
274 std::vector<double> m_TriggerPos;
275 std::vector<double> m_TriggerPlaneDirection;
276 std::vector<double> m_TriggerSize;
277 std::vector<int> m_up;
278 std::vector<int> m_low;
279 double trigHitPos_x = 0.0;
280 double trigHitPos_z = 0.0;
281 int trighit = 0;
282
283 bool m_fillExpertHistos = false;
284 bool m_plotResidual = false;
285 bool m_hitEfficiency = false;
287 bool m_noBFit = false;
288 bool m_ToP = false;
289 bool m_ToF = false;
290 bool m_StoreCDCSimHitInfo = false;
292 bool m_SmallerOutput = false;
293 bool m_StoreTrackParams = false;
294 bool m_MakeHitDist = false;
295 bool m_EventT0Extraction = false;
296 };
297 }
299}
StoreObjPtr< EventT0 > m_eventTimeStoreObject
Event timing.
std::string m_recoTrackArrayName
Belle2::RecoTrack StoreArray name.e.
double m_MinimumPt
Minimum Transverse momentum of tracks.
TProfile * getHistProfile(const char *name, const char *title, int nBins, double x0, double x1)
Create profile plot.
int trighit
Trigger hit information.
bool m_calExpectedDriftTime
Calculate expected drift time from x_fit or not.
double x_sim
Simulation DriftLength .
TTree * m_tree
Output tree recording the information of each hit.
double res_b
Biased residual.
double alpha
Entrance Azimuthal angle of hit (degree).
void getHitDistInTrackCand(const RecoTrack *track)
Make hit distribution from track candidate.
TH1 * m_hNHits
Number of Hits per track.
bool m_plotResidual
Process track to get the hit information of fitted track.
double res_u_err
Unbiased residual error.
TH1 * m_hNHits_trackcand
Number of Hits per trackCand.
B2Vector3D m_trigHitPos
Trigger position.
void initialize() override
Initializes the Module.
StoreArray< TrackFitResult > m_TrackFitResults
Track fit results.
double absRes_b
absolute value of biased residual.
bool m_StoreTrackParams
Store Track parameter or not.
void event() override
Event action (main routine).
TProfile * getHistProfile(const std::string &name, const std::string &title, int nBins, double x0, double x1)
Create profile plot.
double dt_flight
Time of flight.
bool m_SmallerOutput
make output smaller by ignore some variable.
void HitEfficiency(const Belle2::RecoTrack *track)
Cal Hit eff.
TH1 * m_hHitDistInTrack[56]
Hit Dist.
std::string m_cdcHitArrayName
Belle2::CDCHit StoreArray name.
double res_u
Unbiased residual.
TH1 * m_hPhi0
Phi0 of ttrack, see Helix.
TH1 * m_hNormalizedResidualU[56]
Residual distribution normalized with tracking error.
TH1 * m_hNTracks
Number of track fitted, Convergence, not conv, not fit.
static int getICLayer(int slayer, int ilayer)
Convert slayer and ilayer to iclayer.
TH1 * m_hHitDistInCDCHit[56]
Hit Dist.
double z0
Track Parameter, z0.
bool m_hitEfficiency
calculate hit eff or not, Haven't finished.
std::string m_relRecoTrackTrackName
Relation between RecoTrack and Belle2:Track.
std::vector< int > m_low
lower channel list for each board.
void plotResults(Belle2::RecoTrack *track)
Plot track parameters and related variables.
const genfit::SharedPlanePtr constructPlane(const genfit::MeasuredStateOnPlane &state, WireID m_wireID)
Construct a plane for the hit.
TH2 * m_hNDFNormalizedResidualU[56]
Normalized residual vs.
double Pval
P-value of fitted track.
double z_prop
Propagation Length along the sense wire.
double res_b_err
Biased residual error.
double t
Measurement Drift time.
TH2 * m_hNDFPval
Degree-of-freedom vs Probability histo.
TH1 * m_hTheta
Theta of each Hit.
TH1 * m_hNTracksPerEvent
Number of TrackCand per Event.
std::string m_histogramDirectoryName
subdir where to place the histograms.
void getResidualOfUnFittedLayer(Belle2::RecoTrack *track)
Calculate residual for Layers which didn't use int fitting.
double omega
Track Parameter, omega.
double weight
Weight of hit.
double Pt
Transverse momentum.
double x_b
X_fit for biased track fit.
double t_fit
Drift time calculated from x_fit.
bool m_fillExpertHistos
Fill some histogram for monitoring fit quality.
TH1 * m_hAlpha
Alpha of each Hit.
std::string m_trackArrayName
Belle2::Track StoreArray name.
double z_sim
Z of hit on wire (simulation).
const Belle2::TrackFitResult * fitresult
Track fit result.
double TrPval
P-value of fitted track.
bool m_MakeHitDist
Switch to make histograms of hit distribution.
TH2 * m_hNDFChi2
Chi2 vs degree-of-freedom histo.
bool m_noBFit
fit incase no magnetic Field of not, if true, NDF=4 in cal P-value
bool m_EstimateResultForUnFittedLayer
Calculate residual for layer that we do not use in track fitting.
int boardID
Electrical Board ID.
double z
Z of hit on wire.
std::vector< TH1 * > m_allHistos
A list of 1d histograms.
TProfile * m_hHitEff_soft[56]
Hit efficiency of each layer, software.
TH2 * m_h2DHitDistInTrack
2D Hit Dist..(ICLay vs IWire) have weight>0.5 after fit with DAF
double trigHitPos_x
X-position of track at trigger counter.
std::string m_trackFitResultArrayName
Belle2::TrackFitResult StoreArray name.
double dt_prop
Time of propagation.
bool m_ToP
Enable to correct ToP if true.
double x_u
X_fit for unbiased track fit.
double theta
Entrance Polar angle of hit (degree).
std::vector< int > m_up
upper channel list for each board.
TH1 * m_hNTracksPerEventFitted
Number of TrackCand per Event.
bool m_ToF
Enable to correct ToF if true.
TH1 * m_hPval
Fit Probability histo.
B2Vector3D getTriggerHitPosition(Belle2::RecoTrack *track)
extrapolation track to trigger counter plane (y position).
std::string m_treeName
Name of tree for the output file.
double d0
Track Parameter, d0.
StoreArray< RecoTrack > m_RecoTracks
Tracks.
TH1 * m_hHitDistInTrCand[56]
Hit Dist.
TH2 * getHist(const std::string &name, const std::string &title, int nBinsX, double x0, double x1, int nBinsY, double y0, double y1)
Create 2d-histogram.
StoreArray< Track > m_Tracks
Tracks.
virtual ~CDCCRTestModule() override
Destructor.
TH2 * m_h2DHitDistInTrCand
2D Hit Dist.
std::vector< double > m_TriggerPlaneDirection
Nominal center position of trigger counter.
TH1 * getHist(const std::string &name, const std::string &title, int nBins, double x0, double x1)
Create 1d-histogram.
TH2 * m_hDxDt[56]
Unbiased x_fit vs.
TH2 * m_hNDFResidualU[56]
Residual vs.
double tanL
Track Parameter, tanL.
unsigned short adc
adc value.
bool m_StoreCDCSimHitInfo
Store CDCSimHit Information.
double phi0
Track Parameter, phi0.
double trigHitPos_z
Z-position of track at trigger counter.
std::vector< double > m_TriggerPos
Nominal center position of trigger counter.
bool m_EventT0Extraction
use Event T0 extract t0 or not.
double ndf
degree of freedom.
double absRes_u
absolute value of unbiased residual.
TH1 * m_hNDF
Number of Degree Freedom.
TH1 * m_hResidualU[56]
Residual distribution (in cm)
TH2 * getHist(const char *name, const char *title, int nBinsX, double x0, double x1, int nBinsY, double y0, double y1)
Create 2d-histogram.
TH2 * m_hTriggerHitZX
Trigger hit image.
std::vector< double > m_TriggerSize
Size of trigger counter (Width x length).
TH2 * m_h2DHitDistInCDCHit
2D Hit Dist.
TH1 * getHist(const char *name, const char *title, int nBins, double x0, double x1)
Create 1D histogram.
double dt_flight_sim
Time of flight (Simulation).
void defineHisto() override
Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....
StoreArray< CDCHit > m_CDCHits
CDC hits.
double x_mea
measure drift length (signed by left right).
HistoModule()
Constructor.
Definition HistoModule.h:32
This is the Reconstruction Event-Data Model Track.
Definition RecoTrack.h:79
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
Values of the result of a track fit with a given particle hypothesis.
Class to identify a wire inside the CDC.
Definition WireID.h:34
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:522
Abstract base class for different kinds of events.