CbmRoot
LxCATriplets.h
Go to the documentation of this file.
1 #ifndef LXCATRIPLETS_INCLUDED
2 #define LXCATRIPLETS_INCLUDED
3 
4 #pragma GCC diagnostic ignored "-Weffc++"
5 
6 #include "LxMC.h"
7 #include "LxSettings.h"
8 #include "Rtypes.h"
9 #include <cmath>
10 #include <list>
11 
12 struct LxTriplet;
13 #ifdef USE_SEGMENTS
14 struct LxSegment;
15 #endif //USE_SEGMENTS
16 struct LxLayer;
17 struct LxTrack;
18 
19 struct LxPoint {
20  Double_t x, y, z;
21  Double_t dx, dy, dz;
22  Double_t dx2, dy2, dz2;
23  bool used;
24  LxLayer* layer;
25  Int_t hitId;
26  LxTrack* track;
27  std::list<LxTriplet*> triplets;
28 #ifdef USE_SEGMENTS
29  std::list<LxSegment*> segments;
30 #endif //USE_SEGMENTS
31 #ifdef MAKE_EFF_CALC
32  std::list<LxMCPoint*> mcPoints;
33 #endif //MAKE_EFF_CALC
34 
35  LxPoint(Double_t X,
36  Double_t Y,
37  Double_t Z,
38  Double_t Dx,
39  Double_t Dy,
40  Double_t Dz,
41  LxLayer* Layer,
42  Int_t HitId)
43  : x(X)
44  , y(Y)
45  , z(Z)
46  , dx(Dx)
47  , dy(Dy)
48  , dz(Dz)
49  , dx2(Dx * Dx)
50  , dy2(Dy * Dy)
51  , dz2(Dz * Dz)
52  , used(false)
53  , layer(Layer)
54  , hitId(HitId)
55  , track(0) {}
57 };
58 
59 struct LxTriplet {
63  Double_t deltaZ;
64  Double_t deltaZ2;
65  Double_t tx;
66  Double_t ty;
67  Double_t dtx2;
68  Double_t dty2;
69  Double_t dtx;
70  Double_t dty;
71  Double_t chi2;
72 #ifdef USE_SEGMENTS
73  std::list<LxSegment*> neighbours;
74 #else //USE_SEGMENTS
75  std::list<std::pair<LxTriplet*, Double_t>> neighbours;
76 #endif //USE_SEGMENTS
77 
78  LxTriplet(LxPoint* l, LxPoint* c, LxPoint* r, Double_t c2)
79  : left(l)
80  , center(c)
81  , right(r)
82  , deltaZ(r->z - l->z)
83  , deltaZ2(deltaZ * deltaZ)
84  , tx((r->x - l->x) / deltaZ)
85  , ty((r->y - l->y) / deltaZ)
86  , dtx2((l->dx2 + r->dx2) / deltaZ2)
87  , dty2((l->dy2 + r->dy2) / deltaZ2)
88  , dtx(sqrt(dtx2))
89  , dty(sqrt(dty2))
90  , chi2(c2) {}
91 };
92 
93 #ifdef USE_SEGMENTS
94 struct LxSegment {
95  LxPoint* source;
96  LxPoint* end;
97  Double_t tx;
98  Double_t ty;
99  Double_t dtx;
100  Double_t dty;
101  Double_t dtx2;
102  Double_t dty2;
103  Double_t chi2;
104  std::list<LxTriplet*> neighbours;
105 
106  LxSegment(LxPoint* s,
107  LxPoint* e,
108  Double_t Tx,
109  Double_t Ty,
110  Double_t Dtx2,
111  Double_t Dty2,
112  Double_t Chi2)
113  : source(s)
114  , end(e)
115  , tx(Tx)
116  , ty(Ty)
117  , dtx2(Dtx2)
118  , dty2(Dty2)
119  , dtx(sqrt(Dtx2))
120  , dty(sqrt(Dty2))
121  , chi2(Chi2) {}
122 };
123 #endif //USE_SEGMENTS
124 
125 struct LxStation;
126 
127 typedef void* kdt_points_handle;
128 
129 struct LxLayer {
131  Double_t zCoord;
133  Int_t layerNumber;
134 
135  LxLayer(LxStation* Station, int LayerNumber);
137  void Clear();
138 };
139 
140 struct LxSpace;
141 
142 struct LxStation {
143  LxSpace* space;
145  Double_t zCoord;
147  Double_t xDispLeft;
148  Double_t yDispLeft;
149  Double_t xDispRight;
150  Double_t yDispRight;
151  Double_t xDispLeft2;
152  Double_t yDispLeft2;
153  Double_t xDispRight2;
154  Double_t yDispRight2;
155 
156  Double_t xDispRL;
157  Double_t yDispRL;
158  Double_t xDispRL2;
159  Double_t yDispRL2;
160 
161 #ifdef OUT_DISP_BY_TRIPLET_DIR
162  Double_t xOutDispTriplet;
163  Double_t yOutDispTriplet;
164  Double_t xOutDispTriplet2;
165  Double_t yOutDispTriplet2;
166 #else //OUT_DISP_BY_TRIPLET_DIR
167  Double_t xOutDispVertex;
168  Double_t yOutDispVertex;
169  Double_t xOutDispVertex2;
170  Double_t yOutDispVertex2;
171 #endif //OUT_DISP_BY_TRIPLET_DIR
172 
173 #ifdef USE_SEGMENTS
174  Double_t txBreakLeft;
175  Double_t tyBreakLeft;
176  Double_t txBreakRight;
177  Double_t tyBreakRight;
178  Double_t txBreakLeft2;
179  Double_t tyBreakLeft2;
180  Double_t txBreakRight2;
181  Double_t tyBreakRight2;
182 
183  Double_t txInterStationBreak;
184  Double_t tyInterStationBreak;
185  Double_t txInterStationBreak2;
186  Double_t tyInterStationBreak2;
187 #else //USE_SEGMENTS
192 #endif //USE_SEGMENTS
193 
210 
211  LxStation(LxSpace* sp, Int_t stN);
213  void Clear();
214  void BuildTriplets();
215 #ifdef USE_SEGMENTS
216  void BuildSegments();
217 #else //USE_SEGMENTS
218  void ConnectTriplets();
219 #endif //USE_SEGMENTS
220 };
221 
222 struct LxTrackCandidate {
223 #ifdef USE_SEGMENTS
224  LxTriplet* begin;
225  std::pair<LxSegment*, LxTriplet*> branches[LXSTATIONS - 1];
226 #else //USE_SEGMENTS
228 #endif //USE_SEGMENTS
229  Double_t chi2;
230  Int_t length;
231 
232 #ifdef USE_SEGMENTS
234  std::pair<LxSegment*, LxTriplet*>* Branches,
235  Double_t Chi2)
236  : begin(Begin), chi2(Chi2) {
237  for (Int_t i = 0; i < LXSTATIONS - 1; ++i)
238  branches[i] = Branches[i];
239  }
240 #else //USE_SEGMENTS
241  LxTrackCandidate(Int_t len, LxTriplet** Branches, Double_t Chi2)
242  : chi2(Chi2), length(len) {
243  for (Int_t i = 0; i < length; ++i)
244  branches[i] = Branches[i];
245  }
246 #endif //USE_SEGMENTS
247 };
248 
249 struct LxExtTrack {
251  Int_t extId;
253  std::pair<LxTrack*, Double_t> recoTrack;
254 
255  LxExtTrack() : track(0), extId(-1), mcTrack(0), recoTrack(0, 0) {}
256 };
257 
258 struct LxTrack {
259 #ifdef USE_SEGMENTS
260  LxTriplet* begin;
261  std::pair<LxSegment*, LxTriplet*> branches[LXSTATIONS - 1];
262 #else //USE_SEGMENTS
264 #endif //USE_SEGMENTS
265  Double_t chi2;
267  std::list<std::pair<LxExtTrack*, Double_t>> extTrackCandidates;
268  bool matched;
271 #ifdef CALC_LINK_WITH_STS_EFF
272  std::list<LxMCTrack*> mcTracks;
273 #endif //CALC_LINK_WITH_STS_EFF
274  bool clone;
275  Int_t length;
276 
277  explicit LxTrack(LxTrackCandidate* trackCandidate)
278  :
279 #ifdef USE_SEGMENTS
280  begin(trackCandidate->begin)
281  ,
282 #endif //USE_SEGMENTS
283  chi2(trackCandidate->chi2)
284  , externalTrack(0)
285  , matched(false)
286  , mcTrack(0)
287  , clone(false)
288  , length(trackCandidate->length) {
289 #ifdef USE_SEGMENTS
290  begin->left->used = true;
291  begin->left->track = this;
292  begin->center->used = true;
293  begin->center->track = this;
294  begin->right->used = true;
295  begin->right->track = this;
296  points[(LXSTATIONS - 1) * LXLAYERS] = begin->left;
297  points[(LXSTATIONS - 1) * LXLAYERS + 1] = begin->center;
298  points[(LXSTATIONS - 1) * LXLAYERS + 2] = begin->right;
299 #endif //USE_SEGMENTS
300 
301 #ifdef USE_SEGMENTS
302  for (Int_t i = 0; i < LXSTATIONS - 1; ++i)
303 #else //USE_SEGMENTS
304  for (Int_t i = 0; i < length; ++i)
305 #endif //USE_SEGMENTS
306  {
307  branches[i] = trackCandidate->branches[i];
308 #ifdef USE_SEGMENTS
309  LxTriplet* triplet = branches[i].second;
310 #else //USE_SEGMENTS
311  LxTriplet* triplet = branches[i];
312 #endif //USE_SEGMENTS
313  triplet->left->used = true;
314  triplet->left->track = this;
315  triplet->center->used = true;
316  triplet->center->track = this;
317  triplet->right->used = true;
318  triplet->right->track = this;
319  points[i * LXLAYERS] = triplet->left;
320  points[i * LXLAYERS + 1] = triplet->center;
321  points[i * LXLAYERS + 2] = triplet->right;
322  }
323 
324  for (Int_t i = length; i < LXSTATIONS; ++i) {
325  branches[i] = 0;
326  points[i * LXLAYERS] = 0;
327  points[i * LXLAYERS + 1] = 0;
328  points[i * LXLAYERS + 2] = 0;
329  }
330  }
331 
332  void Rebind();
333 };
334 
335 struct LxSpace {
337  std::list<LxTrack*> tracks;
338  std::list<LxExtTrack> extTracks;
339  Int_t stationsInAlgo;
340 
343  void Clear();
344  void BuildTriplets();
345 #ifdef USE_SEGMENTS
346  void BuildSegments();
347  void BuildCandidates(LxTriplet* begin,
348  LxTriplet* triplet,
349  std::pair<LxSegment*, LxTriplet*>* branches,
350  std::list<LxTrackCandidate*>& candidates,
351  Int_t level,
352  Double_t chi2);
353 #else //USE_SEGMENTS
354  void ConnectTriplets();
355  void BuildCandidates(Int_t endStNum,
356  LxTriplet* triplet,
357  LxTriplet** branches,
358  std::list<LxTrackCandidate*>& candidates,
359  Int_t level,
360  Double_t chi2);
361 #endif //USE_SEGMENTS
362  void RemoveClones();
363  void Reconstruct();
365  void FitTracks();
366  LxPoint* AddPoint(Int_t stationNumber,
367  Int_t layerNumber,
368  Int_t hitId,
369  Double_t x,
370  Double_t y,
371  Double_t z,
372  Double_t dx,
373  Double_t dy,
374  Double_t dz);
375 };
376 
377 #endif //LXCATRIPLETS_INCLUDED
LxPoint::dy2
Double_t dy2
Definition: LxCATriplets.h:22
LxTrack
Definition: LxCA.h:268
LxExtTrack::LxExtTrack
LxExtTrack()
Definition: LxCATriplets.h:255
LxStation::layers
std::vector< LxLayer * > layers
Definition: LxCA.h:190
LxStation::yDispLeft
Double_t yDispLeft
Definition: LxCATriplets.h:148
LxSpace::stationsInAlgo
Int_t stationsInAlgo
Definition: LxCA.h:333
LxTrack::length
Int_t length
Definition: LxCATriplets.h:275
LxPoint::track
LxTrack * track
Definition: LxCA.h:58
LxStation::yDispLeft2
Double_t yDispLeft2
Definition: LxCATriplets.h:152
LxSpace::BuildCandidates
void BuildCandidates(int endStNum, LxRay *ray, LxRay **rays, std::list< LxTrackCandidate * > &candidates, scaltype chi2)
LxSpace::BuildTriplets
void BuildTriplets()
Definition: LxCATriplets.cxx:655
LxSettings.h
LxStation::Clear
void Clear()
LxTriplet::neighbours
std::list< std::pair< LxTriplet *, Double_t > > neighbours
Definition: LxCATriplets.h:75
LxStation::errCoeffInterTripletTx2
Double_t errCoeffInterTripletTx2
Definition: LxCATriplets.h:207
LxStation::errCoeffTripletRLX2
Double_t errCoeffTripletRLX2
Definition: LxCATriplets.h:199
LxPoint::z
Double_t z
Definition: LxCATriplets.h:20
sqrt
friend F32vec4 sqrt(const F32vec4 &a)
Definition: L1/vectors/P4_F32vec4.h:41
LxStation::~LxStation
~LxStation()
LxPoint::hitId
Int_t hitId
Definition: LxCA.h:61
LxSpace::ConnectTriplets
void ConnectTriplets()
Definition: LxCATriplets.cxx:669
LxTrack::branches
LxTriplet * branches[LXSTATIONS]
Definition: LxCATriplets.h:263
LxTrack::length
int length
Definition: LxCA.h:280
LxLayer::Clear
void Clear()
LxStation::yDispRight
Double_t yDispRight
Definition: LxCATriplets.h:150
LxLayer::zCoord
Double_t zCoord
Definition: LxCATriplets.h:131
LxLayer::~LxLayer
~LxLayer()
LxSpace::tracks
std::list< LxTrack * > tracks
Definition: LxCA.h:326
LxTrackCandidate::LxTrackCandidate
LxTrackCandidate(Int_t len, LxTriplet **Branches, Double_t Chi2)
Definition: LxCATriplets.h:241
i
int i
Definition: L1/vectors/P4_F32vec4.h:25
LxStation::errCoeffInterTripletX2
Double_t errCoeffInterTripletX2
Definition: LxCATriplets.h:203
LxStation::yOutDispVertex2
Double_t yOutDispVertex2
Definition: LxCATriplets.h:170
LxSpace::~LxSpace
~LxSpace()
LxTrackCandidate
Definition: LxCA.cxx:429
LxSpace::extTracks
std::list< LxExtTrack > extTracks
Definition: LxCA.h:327
LxTriplet::dty2
Double_t dty2
Definition: LxCATriplets.h:68
LxStation::errCoeffInterTripletX
Double_t errCoeffInterTripletX
Definition: LxCATriplets.h:202
LxExtTrack::recoTrack
std::pair< LxTrack *, Double_t > recoTrack
Definition: LxCATriplets.h:253
LxSpace::RemoveClones
void RemoveClones()
LXLAYERS
#define LXLAYERS
Definition: Simple/LxSettings.h:8
LxPoint::y
scaltype y
Definition: LxCA.h:53
LxStation::xOutDispVertex
Double_t xOutDispVertex
Definition: LxCATriplets.h:167
LxSpace
Definition: LxCA.h:309
LxTrack::chi2
Double_t chi2
Definition: LxCATriplets.h:265
LxTrack::chi2
scaltype chi2
Definition: LxCA.h:283
LxStation::ConnectTriplets
void ConnectTriplets()
Definition: LxCATriplets.cxx:494
LxStation::BuildTriplets
void BuildTriplets()
Definition: LxCATriplets.cxx:173
LxStation::xDispLeft2
Double_t xDispLeft2
Definition: LxCATriplets.h:151
LxStation::stationNumber
Int_t stationNumber
Definition: LxCATriplets.h:144
LxPoint
Definition: LxCA.h:52
LxStation::tyInterTripletBreak2
Double_t tyInterTripletBreak2
Definition: LxCATriplets.h:191
LxPoint::dx2
Double_t dx2
Definition: LxCATriplets.h:22
LxPoint::dx
scaltype dx
Definition: LxCA.h:54
LxTriplet::deltaZ2
Double_t deltaZ2
Definition: LxCATriplets.h:64
LxExtTrack
Definition: LxCA.h:249
LxPoint::used
bool used
Definition: LxCA.h:55
LxExtTrack::mcTrack
LxMCTrack * mcTrack
Definition: LxCA.h:252
LxStation::errCoeffInterTripletY
Double_t errCoeffInterTripletY
Definition: LxCATriplets.h:204
LxStation::LxStation
LxStation(LxSpace *sp, int stNum)
Definition: LxCA.cxx:985
LxStation::tyInterTripletBreak
Double_t tyInterTripletBreak
Definition: LxCATriplets.h:189
LxPoint::dz
Double_t dz
Definition: LxCATriplets.h:21
LxStation::errCoeffTripletRLY
Double_t errCoeffTripletRLY
Definition: LxCATriplets.h:200
LxStation::txInterTripletBreak2
Double_t txInterTripletBreak2
Definition: LxCATriplets.h:190
LxTrack::Rebind
void Rebind()
Definition: LxCATriplets.cxx:602
LxTrack::matched
bool matched
Definition: LxCA.h:275
LxStation::errCoeffInterTripletTx
Double_t errCoeffInterTripletTx
Definition: LxCATriplets.h:206
LxPoint::z
scaltype z
Definition: LxCA.h:53
LxTriplet::dty
Double_t dty
Definition: LxCATriplets.h:70
LxStation::yDispRight2
Double_t yDispRight2
Definition: LxCATriplets.h:154
LxPoint::dz2
Double_t dz2
Definition: LxCATriplets.h:22
LxTriplet::tx
Double_t tx
Definition: LxCATriplets.h:65
LxSpace::stations
std::vector< LxStation * > stations
Definition: LxCA.h:325
LxStation::yOutDispVertex
Double_t yOutDispVertex
Definition: LxCATriplets.h:168
LxStation::xDispRight
Double_t xDispRight
Definition: LxCATriplets.h:149
LxSpace::AddPoint
LxPoint * AddPoint(int stationNumber, int layerNumber, int hitId, scaltype x, scaltype y, scaltype z, scaltype dx, scaltype dy, scaltype dz)
Definition: LxCA.h:339
LxTrack::extTrackCandidates
std::list< std::pair< LxExtTrack *, Double_t > > extTrackCandidates
Definition: LxCATriplets.h:267
LxSpace::BuildCandidates
void BuildCandidates(Int_t endStNum, LxTriplet *triplet, LxTriplet **branches, std::list< LxTrackCandidate * > &candidates, Int_t level, Double_t chi2)
LxSpace::Reconstruct
void Reconstruct()
LxTrack::mcTrack
LxMCTrack * mcTrack
Definition: LxCA.h:276
LxTrack::LxTrack
LxTrack(LxTrackCandidate *trackCandidate)
Definition: LxCATriplets.h:277
LxStation::zCoord
Double_t zCoord
Definition: LxCATriplets.h:145
LxTriplet::right
LxPoint * right
Definition: LxCATriplets.h:62
LxTrackCandidate::length
Int_t length
Definition: LxCA.cxx:431
LxPoint::mcPoints
std::list< LxMCPoint * > mcPoints
Definition: LxCA.h:63
LxStation::txInterTripletBreak
Double_t txInterTripletBreak
Definition: LxCATriplets.h:188
LxTrackCandidate::branches
LxTriplet * branches[LXSTATIONS]
Definition: LxCATriplets.h:227
LxTrackCandidate::chi2
Double_t chi2
Definition: LxCATriplets.h:229
LxTriplet::deltaZ
Double_t deltaZ
Definition: LxCATriplets.h:63
LxStation::xDispRight2
Double_t xDispRight2
Definition: LxCATriplets.h:153
LxStation::errCoeffTripletRY
Double_t errCoeffTripletRY
Definition: LxCATriplets.h:196
LxExtTrack::extId
Int_t extId
Definition: LxCA.h:251
kdt_points_handle
void * kdt_points_handle
Definition: LxCATriplets.h:125
LxStation::errCoeffInterTripletTy
Double_t errCoeffInterTripletTy
Definition: LxCATriplets.h:208
LxStation::errCoeffInterTripletY2
Double_t errCoeffInterTripletY2
Definition: LxCATriplets.h:205
LxExtTrack::track
CbmStsTrack * track
Definition: LxCA.h:250
LxStation::xDispLeft
Double_t xDispLeft
Definition: LxCATriplets.h:147
LxLayer::points_handle
kdt_points_handle points_handle
Definition: LxCATriplets.h:130
LxStation::xOutDispVertex2
Double_t xOutDispVertex2
Definition: LxCATriplets.h:169
LxSpace::FitTracks
void FitTracks()
LxStation::xDispRL
Double_t xDispRL
Definition: LxCATriplets.h:156
LxSpace::JoinExtTracks
void JoinExtTracks()
LxTriplet::center
LxPoint * center
Definition: LxCATriplets.h:61
LxTrack::mcTracks
std::list< LxMCTrack * > mcTracks
Definition: LxCATriplets.h:272
LxTrack::points
LxPoint * points[LXSTATIONS *LXLAYERS]
Definition: LxCA.h:282
LxStation
Definition: LxCA.h:189
LxPoint::~LxPoint
~LxPoint()
LxTrack::clone
bool clone
Definition: LxCA.h:292
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
LxTrackCandidate::chi2
scaltype chi2
Definition: LxCA.cxx:432
LxTriplet
Definition: LxCATriplets.h:59
LxLayer::LxLayer
LxLayer(LxStation *Station, int LayerNumber)
LxStation::xDispRL2
Double_t xDispRL2
Definition: LxCATriplets.h:158
LxTriplet::left
LxPoint * left
Definition: LxCATriplets.h:60
LxStation::errCoeffTripletRX2
Double_t errCoeffTripletRX2
Definition: LxCATriplets.h:195
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
LxTriplet::ty
Double_t ty
Definition: LxCATriplets.h:66
LxStation::yDispRL2
Double_t yDispRL2
Definition: LxCATriplets.h:159
LxPoint::triplets
std::list< LxTriplet * > triplets
Definition: LxCATriplets.h:27
LxStation::errCoeffTripletRLX
Double_t errCoeffTripletRLX
Definition: LxCATriplets.h:198
LxStation::errCoeffTripletRY2
Double_t errCoeffTripletRY2
Definition: LxCATriplets.h:197
LxTriplet::dtx2
Double_t dtx2
Definition: LxCATriplets.h:67
LxTriplet::dtx
Double_t dtx
Definition: LxCATriplets.h:69
LxPoint::dz
scaltype dz
Definition: LxCA.h:54
LxStation::space
LxSpace * space
Definition: LxCA.h:205
LxMCTrack
Definition: Simple/LxMC.h:27
LxStation::errCoeffTripletRX
Double_t errCoeffTripletRX
Definition: LxCATriplets.h:194
LxPoint::layer
LxLayer * layer
Definition: LxCA.h:60
CbmStsTrack
Definition: CbmStsTrack.h:37
LxLayer::layerNumber
Int_t layerNumber
Definition: LxCATriplets.h:133
LxSpace::LxSpace
LxSpace()
LxSpace::Clear
void Clear()
LxStation::yDispRL
Double_t yDispRL
Definition: LxCATriplets.h:157
LXSTATIONS
#define LXSTATIONS
Definition: Simple/LxSettings.h:9
LxPoint::dy
scaltype dy
Definition: LxCA.h:54
LxLayer
Definition: LxCA.h:152
LxStation::errCoeffInterTripletTy2
Double_t errCoeffInterTripletTy2
Definition: LxCATriplets.h:209
LxLayer::station
LxStation * station
Definition: LxCA.h:154
LxPoint::x
scaltype x
Definition: LxCA.h:53
LxTriplet::chi2
Double_t chi2
Definition: LxCATriplets.h:71
LxStation::errCoeffTripletRLY2
Double_t errCoeffTripletRLY2
Definition: LxCATriplets.h:201
LxPoint::LxPoint
LxPoint(Double_t X, Double_t Y, Double_t Z, Double_t Dx, Double_t Dy, Double_t Dz, LxLayer *Layer, Int_t HitId)
Definition: LxCATriplets.h:35
LxTriplet::LxTriplet
LxTriplet(LxPoint *l, LxPoint *c, LxPoint *r, Double_t c2)
Definition: LxCATriplets.h:78
LxMC.h
LxTrackCandidate::LxTrackCandidate
LxTrackCandidate(LxRay **rr, Int_t len, scaltype c2)
Definition: LxCA.cxx:434
LxTrack::externalTrack
LxExtTrack * externalTrack
Definition: LxCA.h:269