Modificaions from Stefan Rossegger :
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackletMCM.cxx
CommitLineData
52c19022 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/* $Id: AliTRDtrackletMCM.cxx 28397 2008-09-02 09:33:00Z cblume $ */
17
18////////////////////////////////////////////////////////////////////////////
19// //
20// MCM tracklet //
21// //
22// Author: J. Klein (Jochen.Klein@cern.ch) //
23// //
24////////////////////////////////////////////////////////////////////////////
25
26#include "AliTRDtrackletMCM.h"
27#include "AliLog.h"
28
29ClassImp(AliTRDtrackletMCM)
30
31AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord) :
32 AliTRDtrackletBase(),
4cc89512 33 fGeo(0x0),
52c19022 34 fHCId(-1),
35 fTrackletWord(trackletWord),
36 fMCM(-1),
4cc89512 37 fROB(-1),
48e5462a 38 fQ0(0),
39 fQ1(0),
36dc3337 40 fNHits(0),
41 fNHits0(0),
42 fNHits1(0),
ce51199c 43 fSlope(0.),
44 fOffset(0.),
45 fError(0.),
46 fNClusters(0),
47 fResiduals(0x0),
48 fClsCharges(0x0)
52c19022 49{
4cc89512 50 fGeo = new AliTRDgeometry();
25b41f6f 51 fLabel[0] = -1;
52 fLabel[1] = -1;
53 fLabel[2] = -1;
52c19022 54}
55
56AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) :
57 AliTRDtrackletBase(),
4cc89512 58 fGeo(0x0),
52c19022 59 fHCId(hcid),
60 fTrackletWord(trackletWord),
61 fMCM(-1),
4cc89512 62 fROB(-1),
48e5462a 63 fQ0(0),
64 fQ1(0),
36dc3337 65 fNHits(0),
66 fNHits0(0),
67 fNHits1(0),
ce51199c 68 fSlope(0.),
69 fOffset(0.),
70 fError(0.),
71 fNClusters(0),
72 fResiduals(0x0),
73 fClsCharges(0x0)
52c19022 74{
4cc89512 75 fGeo = new AliTRDgeometry();
25b41f6f 76 fLabel[0] = -1;
77 fLabel[1] = -1;
78 fLabel[2] = -1;
52c19022 79}
80
b0a41e80 81AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, Int_t mcm) :
82 AliTRDtrackletBase(),
83 fGeo(0x0),
84 fHCId(hcid),
85 fTrackletWord(trackletWord),
86 fMCM(mcm),
87 fROB(rob),
48e5462a 88 fQ0(0),
89 fQ1(0),
36dc3337 90 fNHits(0),
91 fNHits0(0),
92 fNHits1(0),
ce51199c 93 fSlope(0.),
94 fOffset(0.),
95 fError(0.),
96 fNClusters(0),
97 fResiduals(0x0),
98 fClsCharges(0x0)
b0a41e80 99{
100 fGeo = new AliTRDgeometry();
25b41f6f 101 fLabel[0] = -1;
102 fLabel[1] = -1;
103 fLabel[2] = -1;
b0a41e80 104}
105
52c19022 106AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) :
107 AliTRDtrackletBase(rhs),
4cc89512 108 fGeo(0x0),
52c19022 109 fHCId(rhs.fHCId),
110 fTrackletWord(rhs.fTrackletWord),
111 fMCM(rhs.fMCM),
4cc89512 112 fROB(rhs.fROB),
48e5462a 113 fQ0(rhs.fQ0),
114 fQ1(rhs.fQ1),
36dc3337 115 fNHits(rhs.fNHits),
116 fNHits0(rhs.fNHits0),
117 fNHits1(rhs.fNHits1),
25b41f6f 118 fSlope(rhs.fSlope),
ce51199c 119 fOffset(rhs.fOffset),
120 fError(rhs.fError),
121 fNClusters(rhs.fNClusters),
122 fResiduals(0x0),
123 fClsCharges(0x0)
52c19022 124{
4cc89512 125 fGeo = new AliTRDgeometry();
ce51199c 126 fResiduals = new Float_t[fNClusters];
127 fClsCharges = new Float_t[fNClusters];
128 for (Int_t iCls = 0; iCls < fNClusters; iCls++) {
129 fResiduals[iCls] = rhs.fResiduals[iCls];
130 fClsCharges[iCls] = rhs.fClsCharges[iCls];
131 }
25b41f6f 132 fLabel[0] = rhs.fLabel[0];
133 fLabel[1] = rhs.fLabel[1];
134 fLabel[2] = rhs.fLabel[2];
52c19022 135}
136
137AliTRDtrackletMCM::~AliTRDtrackletMCM()
138{
ce51199c 139 delete [] fResiduals;
140 delete [] fClsCharges;
4cc89512 141 delete fGeo;
52c19022 142}
143
144Int_t AliTRDtrackletMCM::GetYbin() const {
145 // returns (signed) value of Y
146 if (fTrackletWord & 0x1000) {
147 return -((~(fTrackletWord-1)) & 0x1fff);
148 }
149 else {
150 return (fTrackletWord & 0x1fff);
151 }
152}
153
154Int_t AliTRDtrackletMCM::GetdY() const
155{
156 // returns (signed) value of the deflection length
157 if (fTrackletWord & (1 << 19)) {
158 return -((~((fTrackletWord >> 13) - 1)) & 0x7f);
159 }
160 else {
161 return ((fTrackletWord >> 13) & 0x7f);
162 }
163}
ce51199c 164
25b41f6f 165void AliTRDtrackletMCM::SetLabel(Int_t label[])
166{
167 fLabel[0] = label[0];
168 fLabel[1] = label[1];
169 fLabel[2] = label[2];
170}
171
ce51199c 172void AliTRDtrackletMCM::SetClusters(Float_t *res, Float_t *q, Int_t n)
173{
174 fNClusters = n;
175 delete [] fResiduals;
176 delete [] fClsCharges;
177
178 fResiduals = new Float_t[fNClusters];
179 fClsCharges = new Float_t[fNClusters];
180
181 for (Int_t iCls = 0; iCls < fNClusters; iCls++) {
182 fResiduals[iCls] = res[iCls];
183 fClsCharges[iCls] = q[iCls];
184 }
185}