add new data members, move members to the correlation class to the base one, and...
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODTrdTrack.cxx
CommitLineData
9aa7ebff 1#include "AliAODTrdTrack.h"
2
3AliAODTrdTrack::AliAODTrdTrack() :
4 AliVTrdTrack(),
5 fGlobalStack(-1),
6 fPID(0),
7 fLayerMask(0),
8 fA(0),
9 fFlagsTiming(0),
10 fTracklets(),
11 fTrackMatch(0x0),
12 fLabel(-1)
13{
14 // default constructor
15
16 fTracklets.SetClass("AliAODTrdTracklet", 6);
17}
18
19AliAODTrdTrack::AliAODTrdTrack(const AliVTrdTrack &rhs) :
20 AliVTrdTrack(rhs),
21 fGlobalStack(5*rhs.GetSector() + rhs.GetStack()),
22 fPID(rhs.GetPID()),
23 fLayerMask(rhs.GetLayerMask()),
24 fA(rhs.GetA()),
25 fFlagsTiming(rhs.GetFlagsTiming()),
26 fTracklets(),
27 fTrackMatch(rhs.GetTrackMatch()),
28 fLabel(rhs.GetLabel())
29{
30 // constructor from abstract base class
31
0a91069b 32 fTracklets.SetClass("AliAODTrdTracklet", 6);
33
9aa7ebff 34 // copy the contributing tracklets
35 for (Int_t iTracklet = 0; iTracklet < 6; ++iTracklet) {
36 const AliVTrdTracklet *trkl = rhs.GetTracklet(iTracklet);
37 if (trkl)
38 new (fTracklets[iTracklet]) AliAODTrdTracklet(*trkl);
0a91069b 39 else
40 new (fTracklets[iTracklet]) AliAODTrdTracklet();
9aa7ebff 41 }
42}
43
44AliAODTrdTrack::AliAODTrdTrack(const AliAODTrdTrack& rhs) :
45 AliVTrdTrack(rhs),
46 fGlobalStack(rhs.fGlobalStack),
47 fPID(rhs.fPID),
48 fLayerMask(rhs.fLayerMask),
49 fA(rhs.fA),
50 fFlagsTiming(rhs.fFlagsTiming),
51 fTracklets(),
52 fTrackMatch(rhs.fTrackMatch),
53 fLabel(rhs.fLabel)
54{
55 // copy constructor
56
0a91069b 57 fTracklets.SetClass("AliAODTrdTracklet", 6);
58
9aa7ebff 59 // copy the contributing tracklets
60 for (Int_t iTracklet = 0; iTracklet < 6; ++iTracklet) {
61 const AliVTrdTracklet *trkl = rhs.GetTracklet(iTracklet);
62 if (trkl)
63 new (fTracklets[iTracklet]) AliAODTrdTracklet(*trkl);
0a91069b 64 else
65 new (fTracklets[iTracklet]) AliAODTrdTracklet();
9aa7ebff 66 }
67}
68
69AliAODTrdTrack& AliAODTrdTrack::operator=(const AliAODTrdTrack& rhs)
70{
71 // assignment operator
72
73 if (&rhs != this)
74 AliVTrdTrack::operator=(rhs);
75
76 fGlobalStack = rhs.fGlobalStack;
77 fPID = rhs.fPID;
78 fLayerMask = rhs.fLayerMask;
79 fA = rhs.fA;
80 fFlagsTiming = rhs.fFlagsTiming;
81 fTrackMatch = rhs.fTrackMatch;
82 fLabel = rhs.fLabel;
83
84 // assign the contributing tracklets
85 for (Int_t iTracklet = 0; iTracklet < 6; ++iTracklet) {
86 const AliVTrdTracklet *trkl = rhs.GetTracklet(iTracklet);
87 if (trkl)
88 new (fTracklets[iTracklet]) AliAODTrdTracklet(*trkl);
0a91069b 89 else
90 new (fTracklets[iTracklet]) AliAODTrdTracklet();
9aa7ebff 91 }
92
93 return *this;
94}
95
96void AliAODTrdTrack::Copy(TObject &rhs) const
97{
98 // copy
99
100 AliVTrdTrack::Copy(rhs);
101}
102
103Int_t AliAODTrdTrack::GetPt() const
104{
105 // calculate pt from a as done in hardware
106
107 const Int_t maskIdLut[64] = {
108 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
109 -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 2, -1, 3, 4, 5,
110 -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 7, -1, 8, 9, 10,
111 -1, -1, -1, 11, -1, 12, 13, 14, -1, 15, 16, 17, 18, 19, 20, 21
112 };
113
114 const Int_t c1Lut[32] = {
115 -2371, -2474, -2474, -2474, -2563, -2448, -2578, -2578,
116 -2578, -2670, -2557, -2578, -2578, -2670, -2557, -2578,
117 -2670, -2557, -2763, -2557, -2644, -2523, -1, -1,
118 -1, -1, -1, -1, -1, -1, -1, -1
119 };
120
121 if (this->GetA() != 0) {
122 Int_t layerMaskId = maskIdLut[this->GetLayerMask()];
123 Int_t c1 = c1Lut[layerMaskId];
124 Int_t c1Ext = c1 << 8;
125 Int_t ptRawStage4 = c1Ext / ((this->GetA() >> 2) != 0 ? (this->GetA() >> 2) : 1 );
126 Int_t ptRawComb4 = ptRawStage4;
127 Int_t ptExtComb4 = (ptRawComb4 > 0) ? ptRawComb4 + 33 : ptRawComb4 - 30;
128
129 return -ptExtComb4/2;
130 }
131 else
132 return 0;
133}