BmnRoot
Loading...
Searching...
No Matches
BmnMwpcHitFinder.h
Go to the documentation of this file.
1//Author: Vasilisa Lenivenko <vasilisa@jinr.ru> 2018-07-18
2
4// //
5// BmnMwpcHitFinder //
6// //
7// Implementation of an algorithm developed by //
8// Vasilisa Lenivenko and Vladimir Palchik //
9// to the BmnRoot software //
10// //
11// The algorithm serves for searching for hits //
12// in the Multi Wire Prop. Chambers of the BM@N experiment //
13// //
15
16#ifndef BMNMWPCHITFINDER_H
17#define BMNMWPCHITFINDER_H
18
19#include <BmnEventQuality.h>
20#include "BmnMwpcHit.h"
21#include "BmnMwpcDigit.h"
22#include "BmnMwpcGeometrySRC.h"
23#include "BmnTrack.h"
24#include "BmnMwpcTrack.h"
25
26#include "FairTask.h"
27
28#include <TClonesArray.h>
29#include <TVector3.h>
30#include <TMath.h>
31#include <TString.h>
32#include "TList.h"
33#include "TH1D.h"
34#include "TH2D.h"
35
36#include <map>
37#include <algorithm>
38#include <vector>
39using namespace std;
40
41class BmnMwpcHitFinder : public FairTask
42{
43public:
47 BmnMwpcHitFinder(Bool_t, Int_t, Int_t);
50
52 virtual InitStatus Init();
54 virtual void Exec(Option_t* opt);
56 virtual void Finish();
57
58 struct MC_points{
59 Int_t Id = -1;//Id
60 Int_t Pdg = -999;//Id
61 Int_t Np2 = 0;
62 Int_t Np3 = 0;
63 Bool_t xWas2=0;
64 Bool_t uWas2=0;
65 Bool_t vWas2=0;
66 Bool_t xWas3=0;
67 Bool_t uWas3=0;
68 Bool_t vWas3=0;
69
70 Double_t param2[4] = {999., 999., 999., 999.};
71 Double_t param3[4] = {999., 999., 999., 999.};
72
73 Double_t x2[6] = {-999., -999.,-999.,-999.,-999.,-999.};
74 Double_t y2[6] = {-999., -999.,-999.,-999.,-999.,-999.};
75 Double_t z2[6] = {-999., -999.,-999.,-999.,-999.,-999.};
76 Double_t x3[6] = {-999., -999.,-999.,-999.,-999.,-999.};
77 Double_t y3[6] = {-999., -999.,-999.,-999.,-999.,-999.};
78 Double_t z3[6] = {-999., -999.,-999.,-999.,-999.,-999.};
79 Double_t xt = -999.;
80 Double_t yt = -999.;
81 };
82
83private:
84 Bool_t expData;
85 Bool_t fDebug = 0;
86 Bool_t fDoTest = 0;
87 UInt_t fEventNo; // event counter
88
89 TString fInputBranchName;
90 TString fOutputBranchName;
91 TString fBmnEventHeaderBranchName;
92
94 TClonesArray* fBmnMwpcDigitArray;
95 TClonesArray* fBmnHitsArray;
97 TClonesArray* fBmnMwpcSegmentsArray;
98 TClonesArray* fBmnMwpcEventHeader;
99
100 TString fOutputFileName;
101
102 Int_t nInputDigits; // max. number of found digits per plane
103 Int_t nTimeSamples; //
104
105 BmnMwpcGeometrySRC* fMwpcGeometrySRC;
106
107 TList fList;
108
109 Int_t fRunPeriod;
110 Int_t fRunNumber;
111 Short_t kNChambers, kNPlanes, kNWires;
112 Int_t kNumPairs;
113 Int_t kCh_min, kCh_max;
114 Int_t kBig;
115 TVector3 *ChCent;
116 Float_t *Zmid;
117 Float_t *ChZ;
118 TH1D *hNtrMC, *hDen_mc, *hNum_mc, *hEff_mc,
119 *hx_target, *hy_target, *hNp_MCtrue_ch2, *hNp_MCtrue_ch3,
120 *hDen_mcreaction2, *hNum_mcreaction2,*hEff_mcreaction2,
121 *hDen_mcreaction3, *hNum_mcreaction3,*hEff_mcreaction3, *hHalfDeadCh;
122
123 TH2D *hYvsX_mc_ch2, *hYvsX_mc_ch3;
124
125 vector<TH1D*> hNp_best_Ch, hNbest_Ch, hOccupancy, hTime,
126 hoccupancyXp, hoccupancyUp, hoccupancyVp, hoccupancyXm, hoccupancyUm, hoccupancyVm, hfiredWire_Ch, hClusterSize, hChisq_ndf_Ch, hNFired_layers_Ch,
127 hWiresXp, hWiresUp, hWiresVp, hWiresXm, hWiresUm, hWiresVm,
128 hResiduals_pl0_Ch, hResiduals_pl1_Ch, hResiduals_pl2_Ch, hResiduals_pl3_Ch, hResiduals_pl4_Ch, hResiduals_pl5_Ch,hfired_wire_Ch, hNum_layers_out_beam_Ch,
129 hpar_Ax_Ch, hpar_Ay_Ch,hpar_Bx_Ch,hpar_By_Ch,
130 hx_target_best, hy_target_best,
131 hAx_mc_ch, hAy_mc_ch,hBx_mc_ch,hBy_mc_ch,
132 hdAx_mc_SegCh, hdAy_mc_SegCh,hdX_mc_SegCh,hdY_mc_SegCh,
133 hdAx_mc_Seg_deltaCh, hdAy_mc_Seg_deltaCh, hdX_mc_Seg_deltaCh,hdY_mc_Seg_deltaCh;
134
135 vector<TH2D*> hEvent_display_Ch, htime_wire_Ch, hY_X_Ch;
136 Int_t kMinHits;
137 Int_t kMinHits_before_target;
138 Int_t kmaxSeg;
139 Int_t kChMaxAllWires;
140 Double_t kChi2_Max;
141 Double_t dw, dw_half;
142 Double_t sq3, sq12, sigma;
143 Double_t kMiddlePl;
144
145 vector<MC_points> vec_points;
146
147 // Arrays
148 Int_t *Nseg_Ch;
149 Int_t *counter_pl;
150 Int_t *Nbest_Ch;
151 Int_t *ipl;
152 Int_t *Nlay_w_wires;
153 Float_t *sigm2;
154 Float_t *z2;
155 Float_t **shift;
156 Float_t **kZ_loc;
157 Float_t **z_gl;
158 Int_t **kPln;
159 Int_t **iw;
160 Int_t **iw_Ch;
161 Int_t **Nhits_Ch;
162 Int_t **Beam_wires_min;
163 Int_t **Beam_wires_max;
164 Float_t **XVU;
165 Float_t **XVU_cl;
166 Int_t **ind_best_Ch;
167 Int_t **best_Ch_gl;
168 Double_t **Chi2_ndf_Ch;
169 Double_t **Chi2_ndf_best_Ch;
170 Int_t ***wire_Ch;
171 Float_t ***xuv_Ch;
172 Int_t ***Wires_Ch;
173 Int_t ***clust_Ch;
174 Float_t ***XVU_Ch;
175 Double_t ***par_ab_Ch;
176 Double_t ***Coord_xuv;
177 Double_t ***XVU_coord;
178 Double_t ***Coord_wire;
179
180 Int_t *Nbest_seg;
181 Int_t **Nclust;
182 Int_t **Nhits_seg;
183 Int_t ***ClusterSize;
184 Double_t ***DigitsArray;
185 Double_t **Chi2_ndf_seg;
186 Double_t ***Coor_seg;
187 Double_t ***Cluster_seg;
188 Double_t ***par_ab_seg;
189 Double_t ****sigma2_seg;
190 Double_t ***Cluster_coord;
191 Int_t **Fired_layer;
192
193 Double_t **matrA;
194 Double_t **matrb;
195 Double_t **Amatr;
196 Double_t **bmatr;
197 const int kMaxMC = 100;
198 Double_t Z0_SRC;
199
200 //functions for Vasilisa method:
201 void PrepareArraysToProcessEvent();
202 void ReadWires(Double_t ***, Int_t **, vector<MC_points>&);
203 void Clustering(Int_t, Int_t***, Double_t***, Double_t***, Double_t***, Int_t **, Int_t *);
204 void SegmentParamAlignment(Int_t, Int_t *, Double_t ***, Float_t **);
205 void SegmentFinder(Int_t , Int_t** , Double_t ***, Int_t ***,Int_t *, Double_t ***, Double_t ***, Int_t **,Int_t , Short_t , Int_t );
206 void SegmentFinder2coord(Int_t, Int_t **, Double_t ***, Int_t ***,Int_t *, Double_t ***, Double_t ***, Int_t **,Int_t, Short_t , Int_t ,Int_t *, Double_t ***);
207 void ProcessSegments( Int_t , Int_t *, Double_t ***, Double_t ***, Int_t **, Float_t **, Int_t , Double_t , Double_t ,Int_t ** , Double_t **, Double_t ***, Double_t ***, Double_t ***, Int_t *, Int_t *, Double_t ****);
208 void ProcessSegments2coord( Int_t , Int_t *, Double_t ***, Double_t ***, Int_t **, Float_t **, Int_t , Double_t , Double_t ,Int_t ** , Double_t **, Double_t ***, Double_t ***, Double_t ***, Int_t *, Int_t *, Double_t ****);
209 void FillFreeCoefVectorXUV(Int_t, Double_t*, Float_t**, Float_t**, Float_t*, Int_t*);
210 void FillFreeCoefVector(Int_t , Double_t*, Double_t*** , Int_t , Float_t** , Double_t*, Int_t*);
211 void FillFitMatrix(Int_t, Double_t **, Float_t **, Double_t *, Int_t *);
212 void InverseMatrix(Double_t**, Double_t**);
213 void MCefficiencyCalculation(Int_t, vector<MC_points>&, Double_t ***, Int_t *);
214 void SegmentsStoring(Int_t *, Double_t ***,Double_t **, Int_t **, Double_t ***, Double_t ***, Double_t ****);
215
216 const Int_t PDG_Li7 = 1000030070;//Li7
217 const Int_t PDG_He4 = 1000020040;//He4
218
219 TString fBmnEvQualityBranchName;
220 TClonesArray* fBmnEvQuality;
221
222 ClassDef(BmnMwpcHitFinder, 1);
223};
224
225#endif
virtual void Finish()
virtual void Exec(Option_t *opt)
virtual InitStatus Init()
virtual ~BmnMwpcHitFinder()
BmnMwpcHitFinder(Bool_t, Int_t, Int_t)
STL namespace.