BmnRoot
Loading...
Searching...
No Matches
BmnMwpcTrackFinder.h
Go to the documentation of this file.
1// Author: Vasilisa Lenivenko <vasilisa@jinr.ru> 2018-07-18
2
4// //
5// BmnMwpcTrackFinder //
6// //
7// Vasilisa Lenivenko and Vladimir Palchik //
8// The algorithm serves for searching for track segments //
9// in the MWPC of the BM@N experiment //
10// //
12
13#ifndef BMNMWPCTRACKFINDER_H
14#define BMNMWPCTRACKFINDER_H
15
16#include "BmnMwpcTrack.h"
17#include "BmnMwpcHit.h"
18#include "BmnMwpcGeometrySRC.h"
19#include "BmnEnums.h"
20#include "BmnMath.h"
21
22#include "FairTask.h"
23
24#include <TMath.h>
25#include <TClonesArray.h>
26#include <TString.h>
27#include "TH1D.h"
28#include "TH2D.h"
29
30#include <vector>
31#include <iostream>
32#include <fstream>
33#include <sstream>
34
35using namespace std;
36using namespace TMath;
37
38class BmnMwpcTrackFinder : public FairTask
39{
40 public:
42 BmnMwpcTrackFinder(Bool_t isExp, Int_t runPeriod, Int_t runNumber);
43 virtual ~BmnMwpcTrackFinder();
44 virtual InitStatus Init();
45 virtual void Exec(Option_t* opt);
46 virtual void Finish();
47
48 struct MC_points{
49 Double_t x2[6] = {-999., -999.,-999.,-999.,-999.,-999.};
50 Double_t y2[6] = {-999., -999.,-999.,-999.,-999.,-999.};
51 Double_t z2[6] = {-999., -999.,-999.,-999.,-999.,-999.};
52 Double_t x3[6] = {-999., -999.,-999.,-999.,-999.,-999.};
53 Double_t y3[6] = {-999., -999.,-999.,-999.,-999.,-999.};
54 Double_t z3[6] = {-999., -999.,-999.,-999.,-999.,-999.};
55
56 Bool_t xWas2=0;
57 Bool_t uWas2=0;
58 Bool_t vWas2=0;
59 Bool_t xWas3=0;
60 Bool_t uWas3=0;
61 Bool_t vWas3=0;
62
63 Double_t param[4] = {999., 999., 999., 999.};
64 Double_t param2[4] = {999., 999., 999., 999.};
65 Double_t param3[4] = {999., 999., 999., 999.};
66 Int_t Np2 = 0;
67 Int_t Np3 = 0;
68 Int_t Np = 0;
69 Int_t Id = -1;
70 };
71
72 private:
73 Bool_t expData;
74 Bool_t fDebug = 0;
75 UInt_t fEventNo; // event counter
76 Int_t fRunPeriod;
77 Int_t fRunNumber;
78
79 TString fInputBranchName;
80 TString fInputBranchNameHit;
81 TString fOutputBranchName;
82 TString fOutputFileName;
83
85 TClonesArray* fBmnMwpcSegmentsArray;
86 TClonesArray* fBmnHitsArray;
88 TClonesArray* fBmnMwpcTracksArray;
89
90 BmnMwpcGeometrySRC* fMwpcGeo;
91 TList fList;
92
93 vector<TH1D*> hpar_Ax_Ch, hpar_Bx_Ch, hpar_Ay_Ch, hpar_By_Ch, hChi2_match_pair, hChi2_ndf_Ch, hpar_Ax_pair, hpar_Bx_pair, hpar_Ay_pair, hpar_By_pair, hpar_theta_pair, hpar_phi_pair,
94 Nomin_Ch, Denom_Ch, Eff_Ch, hX_in_target_pair, hY_in_target_pair, hdX_pair, hdY_pair, hdAx_pair, hdAy_pair,
95 hoccupancyXp, hoccupancyUp, hoccupancyVp,hoccupancyXm, hoccupancyUm, hoccupancyVm, hNbest_pair, hChi2_ndf_pair;
96
97 vector<TH2D*> hAx_bx_in_target_pair, hAy_by_in_target_pair, hY_X_in_target_pair, hYvsX_pair ;
98 TH1D *hdX_target, *hdY_target, *hX_in_target, *hY_in_target, *hdAx_target, *hdAy_target, *hChi2_m_target, *hdX_pair01_inZpair1, *hdY_pair01_inZpair1,
99 *hdX_pair_1,*hdY_pair_1,*hdAx_pair_1,*hdAy_pair_1,*hChi2m_pair_1,*hXv_pair_1 ,*hYv_pair_1,
100 *hDen, *hNum, *hEff,
101 *hDen_mctr, *hNum_mctr, *hEff_mctr,
102 *hdAx_tr_mc, *hdX_tr_mc, *hdAy_tr_mc, *hdY_tr_mc, *hNtrpc_reco, *hNtrpc_mc;
103 TH2D *hNtrpc_mc_vs_reco;
104 TH2D *hAx_bx_in_target, *hAy_by_in_target, *hY_X_in_target, *hdX_pair01_vs_x1, *hdY_pair01_vs_y1, *htheta_p1vsp0, *hChi2best_Chi2fake_after_target, *hChi2best_Chi2fake_before_target, *hYvsX_mc_pair;
105
106 Short_t kNChambers;
107 Short_t kNPlanes;
108 Int_t kBig;
109 Int_t kCh_min;
110 Int_t kCh_max;
111 Int_t kNumPairs;
112 TVector3 *ChCent;
113 vector<MC_points> vec_points;
114 Double_t Z0_SRC;
115 Double_t ktarget_region;
116 Double_t ktarget_regionY;
117 Double_t kX_target;
118 Double_t kY_target;
119 Float_t *kZmid;
120 Float_t *ZCh;
121 Float_t **kZ_loc;
122 Float_t *kZ_midle_pair;
123
124 Float_t **z_gl;
125 Float_t **shift;
126 Float_t **shift_pair;
127
128 Float_t kZ_to_pole;
129 Float_t kZ_target;
130 Int_t kMinHits;
131 Int_t kmaxPairs;
132 Double_t kChi2_Max;
133
134 Float_t dw;
135 Float_t dw_half;
136 Double_t sq3;
137 Double_t sq2;
138 Double_t sq12;
139 Double_t sigma;
140 Short_t kMiddlePl;
141
142 Int_t **kPln;
143 Float_t *sigm2;
144 Float_t **sigma_delta;
145 Int_t *ipl;
146 Double_t **matrA;
147 Double_t **matrb;
148 Double_t **Amatr;
149 Double_t **bmatr;
150
151 Double_t ***par_ab_Ch;
152 Double_t ***par_ab_pair;
153 Double_t****sigma2_pair;
154 Double_t ***XVU_Ch;
155 Double_t ***Clust_Ch;
156 Double_t **Chi2_match_pair;
157 Double_t **Chi2_ndf_pair;
158 Double_t **Chi2_ndf_Ch;
159 Int_t **ind_best_pair;
160 Int_t **ind_best_Ch;
161 Int_t **Nhits_match;
162 Int_t *Nbest_pair;
163 Int_t *Nbest_Ch;
164 Int_t **Nhits_Ch;
165 Int_t **Nhits_pair;
166
167 void ReadSegments(Double_t ***, Int_t **, Double_t **, Int_t *, Double_t ***, Double_t ***, vector<MC_points>&);
168 void PrepareArraysToProcessEvent();
169 void SegmentParamAlignment(Int_t, Int_t *, Double_t ***, Float_t **);
170 void SegmentMatching(Int_t,Int_t *, Double_t ***, Float_t *, Int_t **, Int_t *,Double_t **,Double_t ***, Int_t **, Int_t **);
171 void SegmentMatchingAfterTarget(Int_t,Int_t *, Double_t ***, Float_t *, Int_t **, Int_t *,Double_t **,Double_t ***, Int_t **, Int_t **);
172 void SegmentFit(Int_t, Float_t **, Float_t *,Int_t *, Int_t **, Double_t ***, Double_t **, Double_t ***, Double_t ***, Int_t **,Int_t **, Int_t **, Double_t ****);
173 void FillFitMatrix(Int_t, Double_t** , Float_t** , Double_t* , Int_t*);
174 void FillFreeCoefVector(Int_t, Double_t*, Double_t***, Int_t, Float_t**, Double_t*, Int_t*);
175 void InverseMatrix(Double_t**, Double_t**);
176 void PairMatching( Int_t *, Double_t ***, Float_t *);
177 void FillEfficiency(Int_t, Double_t ***, Int_t **, Int_t, Int_t, Float_t, Float_t);
178 void StraightByTwoPoints(Double_t ***, Int_t *, Double_t ***, Int_t *, Float_t *, Double_t **, Int_t *);
179 void MCefficiencyCalculation(vector<MC_points>&, Int_t *, Double_t ***);
180 void TracksStoring(Int_t *, Double_t ***, Double_t **, Int_t **, Double_t****);
181
182 const int kMaxMC = 100;
183
184 ClassDef(BmnMwpcTrackFinder, 1)
185};
186
187#endif
virtual void Exec(Option_t *opt)
virtual InitStatus Init()
STL namespace.