Coverity fix
[u/mrichter/AliRoot.git] / TRD / TRDbase / 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),
5f006bd7 35 fTrackletWord(trackletWord),
36 fMCM(-1),
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)
5f006bd7 49{
6419bebb 50 // constructor
51
4cc89512 52 fGeo = new AliTRDgeometry();
25b41f6f 53 fLabel[0] = -1;
54 fLabel[1] = -1;
55 fLabel[2] = -1;
52c19022 56}
57
58AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) :
59 AliTRDtrackletBase(),
4cc89512 60 fGeo(0x0),
52c19022 61 fHCId(hcid),
5f006bd7 62 fTrackletWord(trackletWord),
52c19022 63 fMCM(-1),
4cc89512 64 fROB(-1),
48e5462a 65 fQ0(0),
66 fQ1(0),
36dc3337 67 fNHits(0),
68 fNHits0(0),
69 fNHits1(0),
ce51199c 70 fSlope(0.),
71 fOffset(0.),
72 fError(0.),
73 fNClusters(0),
74 fResiduals(0x0),
75 fClsCharges(0x0)
5f006bd7 76{
6419bebb 77 // constructor
78
4cc89512 79 fGeo = new AliTRDgeometry();
25b41f6f 80 fLabel[0] = -1;
81 fLabel[1] = -1;
82 fLabel[2] = -1;
52c19022 83}
84
b0a41e80 85AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, Int_t mcm) :
86 AliTRDtrackletBase(),
87 fGeo(0x0),
88 fHCId(hcid),
5f006bd7 89 fTrackletWord(trackletWord),
b0a41e80 90 fMCM(mcm),
91 fROB(rob),
48e5462a 92 fQ0(0),
93 fQ1(0),
36dc3337 94 fNHits(0),
95 fNHits0(0),
96 fNHits1(0),
ce51199c 97 fSlope(0.),
98 fOffset(0.),
99 fError(0.),
100 fNClusters(0),
101 fResiduals(0x0),
102 fClsCharges(0x0)
5f006bd7 103{
6419bebb 104 // constructor
105
b0a41e80 106 fGeo = new AliTRDgeometry();
25b41f6f 107 fLabel[0] = -1;
108 fLabel[1] = -1;
109 fLabel[2] = -1;
b0a41e80 110}
111
52c19022 112AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) :
113 AliTRDtrackletBase(rhs),
4cc89512 114 fGeo(0x0),
52c19022 115 fHCId(rhs.fHCId),
116 fTrackletWord(rhs.fTrackletWord),
117 fMCM(rhs.fMCM),
4cc89512 118 fROB(rhs.fROB),
48e5462a 119 fQ0(rhs.fQ0),
120 fQ1(rhs.fQ1),
36dc3337 121 fNHits(rhs.fNHits),
122 fNHits0(rhs.fNHits0),
123 fNHits1(rhs.fNHits1),
25b41f6f 124 fSlope(rhs.fSlope),
ce51199c 125 fOffset(rhs.fOffset),
126 fError(rhs.fError),
127 fNClusters(rhs.fNClusters),
128 fResiduals(0x0),
129 fClsCharges(0x0)
52c19022 130{
6419bebb 131 // copy constructor
132
4cc89512 133 fGeo = new AliTRDgeometry();
ce51199c 134 fResiduals = new Float_t[fNClusters];
135 fClsCharges = new Float_t[fNClusters];
136 for (Int_t iCls = 0; iCls < fNClusters; iCls++) {
137 fResiduals[iCls] = rhs.fResiduals[iCls];
138 fClsCharges[iCls] = rhs.fClsCharges[iCls];
139 }
25b41f6f 140 fLabel[0] = rhs.fLabel[0];
141 fLabel[1] = rhs.fLabel[1];
142 fLabel[2] = rhs.fLabel[2];
52c19022 143}
144
5f006bd7 145AliTRDtrackletMCM::~AliTRDtrackletMCM()
52c19022 146{
6419bebb 147 // destructor
148
ce51199c 149 delete [] fResiduals;
150 delete [] fClsCharges;
4cc89512 151 delete fGeo;
52c19022 152}
153
154Int_t AliTRDtrackletMCM::GetYbin() const {
155 // returns (signed) value of Y
156 if (fTrackletWord & 0x1000) {
157 return -((~(fTrackletWord-1)) & 0x1fff);
158 }
159 else {
160 return (fTrackletWord & 0x1fff);
161 }
162}
163
5f006bd7 164Int_t AliTRDtrackletMCM::GetdY() const
52c19022 165{
166 // returns (signed) value of the deflection length
167 if (fTrackletWord & (1 << 19)) {
168 return -((~((fTrackletWord >> 13) - 1)) & 0x7f);
169 }
170 else {
171 return ((fTrackletWord >> 13) & 0x7f);
172 }
173}
ce51199c 174
25b41f6f 175void AliTRDtrackletMCM::SetLabel(Int_t label[])
5f006bd7 176{
6419bebb 177 // set the labels (up to 3)
178
25b41f6f 179 fLabel[0] = label[0];
180 fLabel[1] = label[1];
181 fLabel[2] = label[2];
182}
183
ce51199c 184void AliTRDtrackletMCM::SetClusters(Float_t *res, Float_t *q, Int_t n)
185{
186 fNClusters = n;
187 delete [] fResiduals;
188 delete [] fClsCharges;
189
190 fResiduals = new Float_t[fNClusters];
191 fClsCharges = new Float_t[fNClusters];
192
193 for (Int_t iCls = 0; iCls < fNClusters; iCls++) {
194 fResiduals[iCls] = res[iCls];
195 fClsCharges[iCls] = q[iCls];
196 }
197}