Adding TRD online tracks and trackets to ESD:
[u/mrichter/AliRoot.git] / STEER / AliESDTrdTrack.cxx
CommitLineData
0ee00e25 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16///////////////////////////////////////////////////////////////////////////////
17//
52cd0cc0 18// ESD format for the TRD tracks calculated in the
19// Global Tracking Unit, used for the TRD L1 trigger
20//
21// Author: Jochen Klein <jochen.klein@cern.ch>
0ee00e25 22//
23///////////////////////////////////////////////////////////////////////////////
24
25#include "AliESDTrdTrack.h"
52cd0cc0 26#include "AliESDTrdTracklet.h"
0ee00e25 27
28ClassImp(AliESDTrdTrack)
29
30//_____________________________________________________________________________
31AliESDTrdTrack::AliESDTrdTrack():
32 TObject(),
52cd0cc0 33 fSector(-1),
34 fStack(-1),
35 fA(0),
36 fB(0),
37 fC(0),
38 fY(0),
0ee00e25 39 fPID(0),
52cd0cc0 40 fLayerMask(0),
41 fFlags(0),
42 fReserved(0),
43 fLabel(-1)
0ee00e25 44{
0ee00e25 45 //
46 // Default constructor
47 //
48
49}
50
0ee00e25 51AliESDTrdTrack::AliESDTrdTrack(const AliESDTrdTrack& track):
52 TObject(track),
52cd0cc0 53 fSector(track.fSector),
54 fStack(track.fStack),
55 fA(track.fA),
56 fB(track.fB),
57 fC(track.fC),
58 fY(track.fY),
0ee00e25 59 fPID(track.fPID),
52cd0cc0 60 fLayerMask(track.fLayerMask),
61 fFlags(track.fFlags),
62 fReserved(track.fReserved),
63 fLabel(track.fLabel)
0ee00e25 64{
0ee00e25 65 //
66 // Copy contructor
67 //
68
52cd0cc0 69 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
70 fTrackletIndex[iLayer] = track.fTrackletIndex[iLayer];
71
72 if (track.fTrackletRefs[iLayer].GetObject())
73 fTrackletRefs[iLayer] = track.fTrackletRefs[iLayer];
74 }
0ee00e25 75}
76
0ee00e25 77AliESDTrdTrack& AliESDTrdTrack::operator=(const AliESDTrdTrack& track)
78{
52cd0cc0 79 //
80 // assignment operator
0ee00e25 81 //
82
83 if (this == &track)
84 return *this;
cd888a89 85 TObject::operator=(track);
52cd0cc0 86 fLabel = track.fLabel;
87 fSector = track.fSector;
88 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
89 fTrackletIndex[iLayer] = track.fTrackletIndex[iLayer];
90 fTrackletRefs[iLayer] = track.fTrackletRefs[iLayer];
91 }
0ee00e25 92
93 return *this;
0ee00e25 94}
95
52cd0cc0 96void AliESDTrdTrack::Copy(TObject& obj) const
97{
98 // this overwrites the virtual TOBject::Copy()
732a24fe 99 // to allow run time copying without casting
100 // in AliESDEvent
101
102 if(this==&obj)return;
103 AliESDTrdTrack *robj = dynamic_cast<AliESDTrdTrack*>(&obj);
52cd0cc0 104 if(!robj)return; // not an aliesdtrdtrack
732a24fe 105 *robj = *this;
106}
52cd0cc0 107
108ULong64_t AliESDTrdTrack::GetTrackWord(Int_t /* rev */) const
109{
110 // return track word representation as in raw data
111 // MSB always 1
112
113 ULong64_t trackWord = 1;
114 AppendBits(trackWord, 1, 0);
115 AppendBits(trackWord, 6, fLayerMask);
116 AppendBits(trackWord, 18, fA);
117 AppendBits(trackWord, 18, fB);
118 AppendBits(trackWord, 12, fC);
119 AppendBits(trackWord, 8, fPID);
120 return trackWord;
121}
122
123ULong64_t AliESDTrdTrack::GetExtendedTrackWord(Int_t /* rev */) const
124{
125 // return extended track word representation as in raw data
126 // MSB always 0
127
128 ULong64_t trackWord = 0;
129 AppendBits(trackWord, 11, fFlags);
130 AppendBits(trackWord, 3, fReserved);
131 AppendBits(trackWord, 13, fY);
132 AppendBits(trackWord, 6, fTrackletIndex[5]);
133 AppendBits(trackWord, 6, fTrackletIndex[4]);
134 AppendBits(trackWord, 6, fTrackletIndex[3]);
135 AppendBits(trackWord, 6, fTrackletIndex[2]);
136 AppendBits(trackWord, 6, fTrackletIndex[1]);
137 AppendBits(trackWord, 6, fTrackletIndex[0]);
138 return trackWord;
139}
140
141Int_t AliESDTrdTrack::GetPt() const
142{
143 // calculate pt from a as done in hardware
144
145 const Int_t maskIdLut[64] = {
146 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0,
147 -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, 2, -1, 3, 4, 5,
148 -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 7, -1, 8, 9, 10,
149 -1, -1, -1, 11, -1, 12, 13, 14, -1, 15, 16, 17, 18, 19, 20, 21
150 };
151
152 const Int_t c1Lut[32] = {
153 -2371, -2474, -2474, -2474, -2563, -2448, -2578, -2578,
154 -2578, -2670, -2557, -2578, -2578, -2670, -2557, -2578,
155 -2670, -2557, -2763, -2557, -2644, -2523, -1, -1,
156 -1, -1, -1, -1, -1, -1, -1, -1
157 };
158
159 if (this->GetA() != 0) {
160 Int_t layerMaskId = maskIdLut[this->GetLayerMask()];
161 Int_t c1 = c1Lut[layerMaskId];
162 Int_t c1Ext = c1 << 8;
163 Int_t ptRawStage4 = c1Ext / (this->GetA() >> 2);
164 Int_t ptRawComb4 = ptRawStage4;
165 Int_t ptExtComb4 = (ptRawComb4 > 0) ? ptRawComb4 + 33 : ptRawComb4 - 30;
166
167 return -ptExtComb4/2;
168 }
169 else
170 return 0;
171}