CbmRoot
LxTBTieTracks.h
Go to the documentation of this file.
1 /*
2  * To change this license header, choose License Headers in Project Properties.
3  * To change this template file, choose Tools | Templates
4  * and open the template in the editor.
5  */
6 
7 /*
8  * File: LxTBTieTracks.h
9  * Author: tablyaz
10  *
11  * Created on September 1, 2016, 11:33 AM
12  */
13 
14 #ifndef LXTBTIETRACKS_H
15 #define LXTBTIETRACKS_H
16 
17 #include "FairTrackParam.h"
18 #include "LxTBBinned.h"
19 #include "LxTBDefinitions.h"
20 
21 class TClonesArray;
22 
25  int nofXBins;
26  int nofYBins;
27  int nofTBins;
28  int lastXBin;
29  int lastYBin;
30  int lastTBin;
39  int binSizeT;
45 
46  LxTBBinndedLayer(int nofxb, int nofyb, int noftb, int bst)
47  : z()
48  , nofXBins(nofxb)
49  , nofYBins(nofyb)
50  , nofTBins(noftb)
51  , lastXBin(nofxb - 1)
52  , lastYBin(nofyb - 1)
53  , lastTBin(noftb - 1)
54  , minX()
55  , maxX()
56  , binSizeX()
57  , minY()
58  , maxY()
59  , binSizeY()
60  , minT(0)
61  , maxT(0)
62  , binSizeT(bst)
64  , maxDx(0)
65  , maxDy(0)
66  , maxDt(0)
67  , tyxBins(reinterpret_cast<LxTbTYXBin*>(
68  new unsigned char[noftb * sizeof(LxTbTYXBin)])) {
69  for (int i = 0; i < noftb; ++i)
71  }
74 
75  ~LxTBBinndedLayer() { delete[] reinterpret_cast<unsigned char*>(tyxBins); }
76 
77  void Clear() {
78  for (int i = 0; i < nofTBins; ++i)
79  tyxBins[i].Clear();
80  }
81 
82  void Init() {
83  binSizeX = (maxX - minX) / nofXBins;
84  binSizeY = (maxY - minY) / nofYBins;
85  }
86 
87  void SetTSBegin(unsigned long long tsLowBound) {
88  minT = tsLowBound;
89  maxT = tsLowBound + timeSliceLength;
90  }
91 
92  struct PointHandler {
93  virtual ~PointHandler() {}
94  virtual void HandlePoint(const LxTbBinnedPoint& point) = 0;
95  };
96 
98  scaltype xDiv0,
99  scaltype y,
100  scaltype yDiv0,
101  timetype t,
102  PointHandler* pointHandler) {
103  scaltype wX = NOF_SIGMAS * std::sqrt(xDiv0 + maxDx * maxDx);
104  scaltype wY = NOF_SIGMAS * std::sqrt(yDiv0 + maxDy * maxDy);
105  timetype wT = NOF_SIGMAS * std::sqrt(2.0) * maxDt;
106 
107  if (x + wX < minX || x - wX > maxX || y + wY < minY || y - wY > maxY
108  || t + wT < minT || t - wT > maxT)
109  return;
110 
111  int tIndMin = (t - wT - minT) / binSizeT;
112 
113  if (tIndMin < 0)
114  tIndMin = 0;
115  else if (tIndMin > lastTBin)
116  tIndMin = lastTBin;
117 
118  int tIndMax = (t + wT - minT) / binSizeT;
119 
120  if (tIndMax < 0)
121  tIndMax = 0;
122  else if (tIndMax > lastTBin)
123  tIndMax = lastTBin;
124 
125  int yIndMin = (y - wY - minY) / binSizeY;
126 
127  if (yIndMin < 0)
128  yIndMin = 0;
129  else if (yIndMin > lastYBin)
130  yIndMin = lastYBin;
131 
132  int yIndMax = (y + wY - minY) / binSizeY;
133 
134  if (yIndMax < 0)
135  yIndMax = 0;
136  else if (yIndMax > lastYBin)
137  yIndMax = lastYBin;
138 
139  int xIndMin = (x - wX - minX) / binSizeX;
140 
141  if (xIndMin < 0)
142  xIndMin = 0;
143  else if (xIndMin > lastXBin)
144  xIndMin = lastXBin;
145 
146  int xIndMax = (x + wX - minX) / binSizeX;
147 
148  if (xIndMax < 0)
149  xIndMax = 0;
150  else if (xIndMax > lastXBin)
151  xIndMax = lastXBin;
152 
153  for (int tInd = tIndMin; tInd <= tIndMax; ++tInd) {
154  LxTbTYXBin& tyxBin = tyxBins[tInd];
155 
156  for (int yInd = yIndMin; yInd <= yIndMax; ++yInd) {
157  LxTbYXBin& yxBin = tyxBin.yxBins[yInd];
158 
159  for (int xInd = xIndMin; xInd <= xIndMax; ++xInd) {
160  LxTbXBin& xBin = yxBin.xBins[xInd];
161 
162  for (std::list<LxTbBinnedPoint>::iterator i = xBin.points.begin();
163  i != xBin.points.end();
164  ++i) {
165  LxTbBinnedPoint& point = *i;
166  scaltype xDiv = xDiv0 + point.dx * point.dx;
167  scaltype wX_prec_sq = NOF_SIGMAS_SQ * xDiv;
168  scaltype yDiv = yDiv0 + point.dy * point.dy;
169  scaltype wY_prec_sq = NOF_SIGMAS_SQ * yDiv;
170  scaltype deltaX = point.x - x;
171  scaltype deltaXSq = deltaX * deltaX;
172  scaltype deltaY = point.y - y;
173  scaltype deltaYSq = deltaY * deltaY;
174  timetype deltaT = point.t - t;
175  timetype deltaTSq = deltaT * deltaT;
176 
177  if (deltaXSq < wX_prec_sq && deltaYSq < wY_prec_sq
178  && deltaTSq < wT * wT)
179  //{
180  //rPoint.neighbours.push_back(LxTbBinnedRay(deltaZ, rPoint, lPoint, deltaXSq / xDiv +
181  //deltaYSq / yDiv + deltaTSq / (rPoint.dt * rPoint.dt + lPoint.dt * lPoint.dt)));
182  pointHandler->HandlePoint(point);
183  //}
184  }
185  }
186  }
187  }
188  }
189 };
190 
192  FairTrackParam fPar;
193  Double_t fChiSq;
194  Double_t fTime;
195  Int_t fSelfId;
196  //Int_t fEventId;
197  //Int_t fFileId;
198 };
199 
203  std::list<LxTBBinnedStsTrack> fStsTracks;
204  TClonesArray* fMuchTracks;
205  TClonesArray* fGlobalTracks;
206 
207  LxTBBinnedDetector(int nofl, int nofxb, int nofyb, int noftb, int binSizeT);
210 
211  void Init();
212  void Clear();
213  void SetTSBegin(unsigned long long tsLowBound);
214  void AddStsTrack(const FairTrackParam& par,
215  Double_t chiSq,
216  Double_t time,
217  Int_t selfId /*, Int_t eventId, Int_t fileId*/);
218  void TieTracks(LxTbBinnedFinder& fFinder);
219 };
220 
221 #endif /* LXTBTIETRACKS_H */
NOF_SIGMAS_SQ
#define NOF_SIGMAS_SQ
Definition: LxTBBinned.h:53
LxTBBinndedLayer::LxTBBinndedLayer
LxTBBinndedLayer(int nofxb, int nofyb, int noftb, int bst)
Definition: LxTBTieTracks.h:46
LxTBBinndedLayer::tyxBins
LxTbTYXBin * tyxBins
Definition: LxTBTieTracks.h:44
LxTBBinndedLayer::minY
scaltype minY
Definition: LxTBTieTracks.h:34
LxTBBinnedDetector::TieTracks
void TieTracks(LxTbBinnedFinder &fFinder)
Definition: LxTBTieTracks.cxx:94
LxTBBinnedStsTrack::fSelfId
Int_t fSelfId
Definition: LxTBTieTracks.h:195
LxTBBinndedLayer::maxY
scaltype maxY
Definition: LxTBTieTracks.h:35
LxTBBinndedLayer::z
scaltype z
Definition: LxTBTieTracks.h:24
LxTbTYXBin
Definition: LxTBBinned.h:180
LxTBBinndedLayer::PointHandler
Definition: LxTBTieTracks.h:92
scaltype
#define scaltype
Definition: CbmGlobalTrackingDefs.h:17
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
LxTBBinndedLayer::nofYBins
int nofYBins
Definition: LxTBTieTracks.h:26
LxTBBinnedDetector::SetTSBegin
void SetTSBegin(unsigned long long tsLowBound)
Definition: LxTBTieTracks.cxx:89
LxTbTYXBin::yxBins
LxTbYXBin * yxBins
Definition: LxTBBinned.h:181
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
LxTBBinndedLayer::operator=
LxTBBinndedLayer & operator=(const LxTBBinndedLayer &)=delete
NOF_SIGMAS
#define NOF_SIGMAS
Definition: LxTBBinned.h:52
LxTBBinndedLayer::nofTBins
int nofTBins
Definition: LxTBTieTracks.h:27
LxTBBinndedLayer::LxTBBinndedLayer
LxTBBinndedLayer(const LxTBBinndedLayer &)=delete
LxTBBinndedLayer::binSizeT
int binSizeT
Definition: LxTBTieTracks.h:39
LxTBBinndedLayer::PointHandler::~PointHandler
virtual ~PointHandler()
Definition: LxTBTieTracks.h:93
LxTbXBin::points
std::list< LxTbBinnedPoint > points
Definition: LxTBBinned.h:145
LxTBBinndedLayer::nofXBins
int nofXBins
Definition: LxTBTieTracks.h:25
LxTbYXBin::xBins
LxTbXBin * xBins
Definition: LxTBBinned.h:162
LxTBBinned.h
LxTBBinndedLayer::maxDx
scaltype maxDx
Definition: LxTBTieTracks.h:41
LxTbBinnedPoint::dx
scaltype dx
Definition: LxTBBinned.h:80
LxTBBinnedStsTrack::fTime
Double_t fTime
Definition: LxTBTieTracks.h:194
LxTbXBin
Definition: LxTBBinned.h:144
LxTBBinndedLayer::timeSliceLength
int timeSliceLength
Definition: LxTBTieTracks.h:40
LxTBBinndedLayer::lastXBin
int lastXBin
Definition: LxTBTieTracks.h:28
LxTBBinndedLayer::Search
void Search(scaltype x, scaltype xDiv0, scaltype y, scaltype yDiv0, timetype t, PointHandler *pointHandler)
Definition: LxTBTieTracks.h:97
LxTBBinnedDetector::LxTBBinnedDetector
LxTBBinnedDetector(int nofl, int nofxb, int nofyb, int noftb, int binSizeT)
Definition: LxTBTieTracks.cxx:62
LxTBBinndedLayer::PointHandler::HandlePoint
virtual void HandlePoint(const LxTbBinnedPoint &point)=0
LxTBBinnedStsTrack::fChiSq
Double_t fChiSq
Definition: LxTBTieTracks.h:193
LxTbBinnedFinder
Definition: LxTBBinned.h:336
LxTBBinndedLayer::binSizeX
scaltype binSizeX
Definition: LxTBTieTracks.h:33
LxTBBinndedLayer::Init
void Init()
Definition: LxTBTieTracks.h:82
LxTBBinnedDetector::fGlobalTracks
TClonesArray * fGlobalTracks
Definition: LxTBTieTracks.h:205
LxTBBinndedLayer::minT
timetype minT
Definition: LxTBTieTracks.h:37
LxTBBinnedDetector::fStsTracks
std::list< LxTBBinnedStsTrack > fStsTracks
Definition: LxTBTieTracks.h:203
LxTBBinndedLayer::binSizeY
scaltype binSizeY
Definition: LxTBTieTracks.h:36
LxTBBinnedDetector::LxTBBinnedDetector
LxTBBinnedDetector(const LxTBBinnedDetector &)=delete
LxTbBinnedPoint::y
scaltype y
Definition: LxTBBinned.h:81
LxTBBinnedDetector
Definition: LxTBTieTracks.h:200
LxTBBinndedLayer::maxX
scaltype maxX
Definition: LxTBTieTracks.h:32
LxTBBinnedStsTrack
Definition: LxTBTieTracks.h:191
LxTBBinnedDetector::fMuchTracks
TClonesArray * fMuchTracks
Definition: LxTBTieTracks.h:204
LxTBBinnedDetector::Clear
void Clear()
Definition: LxTBTieTracks.cxx:82
LxTbBinnedPoint::dy
scaltype dy
Definition: LxTBBinned.h:82
LxTBBinnedDetector::operator=
LxTBBinnedDetector & operator=(const LxTBBinnedDetector &)=delete
LxTBBinnedDetector::Init
void Init()
Definition: LxTBTieTracks.cxx:77
LxTBBinndedLayer::lastYBin
int lastYBin
Definition: LxTBTieTracks.h:29
timetype
#define timetype
Definition: CbmGlobalTrackingDefs.h:18
LxTbYXBin
Definition: LxTBBinned.h:161
LxTBBinndedLayer::maxDy
scaltype maxDy
Definition: LxTBTieTracks.h:42
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
LxTBBinndedLayer::maxDt
timetype maxDt
Definition: LxTBTieTracks.h:43
LxTBBinnedStsTrack::fPar
FairTrackParam fPar
Definition: LxTBTieTracks.h:192
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
LxTBBinndedLayer::SetTSBegin
void SetTSBegin(unsigned long long tsLowBound)
Definition: LxTBTieTracks.h:87
LxTBBinndedLayer::minX
scaltype minX
Definition: LxTBTieTracks.h:31
LxTBBinnedDetector::fLayers
LxTBBinndedLayer * fLayers
Definition: LxTBTieTracks.h:201
LxTBBinndedLayer::~LxTBBinndedLayer
~LxTBBinndedLayer()
Definition: LxTBTieTracks.h:75
LxTBBinndedLayer::lastTBin
int lastTBin
Definition: LxTBTieTracks.h:30
LxTBDefinitions.h
LxTbBinnedPoint::t
timetype t
Definition: LxTBBinned.h:83
LxTbBinnedPoint
Definition: LxTBBinned.h:78
LxTBBinndedLayer::Clear
void Clear()
Definition: LxTBTieTracks.h:77
LxTBBinndedLayer::maxT
timetype maxT
Definition: LxTBTieTracks.h:38
LxTBBinnedDetector::AddStsTrack
void AddStsTrack(const FairTrackParam &par, Double_t chiSq, Double_t time, Int_t selfId)
Definition: LxTBTieTracks.cxx:17
LxTbBinnedPoint::x
scaltype x
Definition: LxTBBinned.h:79
LxTBBinndedLayer
Definition: LxTBTieTracks.h:23
LxTBBinnedDetector::fNofLayers
int fNofLayers
Definition: LxTBTieTracks.h:202