Coverity fix
[u/mrichter/AliRoot.git] / TRD / TRDbase / AliTRDtrackletMCM.cxx
... / ...
CommitLineData
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(),
33 fGeo(0x0),
34 fHCId(-1),
35 fTrackletWord(trackletWord),
36 fMCM(-1),
37 fROB(-1),
38 fQ0(0),
39 fQ1(0),
40 fNHits(0),
41 fNHits0(0),
42 fNHits1(0),
43 fSlope(0.),
44 fOffset(0.),
45 fError(0.),
46 fNClusters(0),
47 fResiduals(0x0),
48 fClsCharges(0x0)
49{
50 // constructor
51
52 fGeo = new AliTRDgeometry();
53 fLabel[0] = -1;
54 fLabel[1] = -1;
55 fLabel[2] = -1;
56}
57
58AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) :
59 AliTRDtrackletBase(),
60 fGeo(0x0),
61 fHCId(hcid),
62 fTrackletWord(trackletWord),
63 fMCM(-1),
64 fROB(-1),
65 fQ0(0),
66 fQ1(0),
67 fNHits(0),
68 fNHits0(0),
69 fNHits1(0),
70 fSlope(0.),
71 fOffset(0.),
72 fError(0.),
73 fNClusters(0),
74 fResiduals(0x0),
75 fClsCharges(0x0)
76{
77 // constructor
78
79 fGeo = new AliTRDgeometry();
80 fLabel[0] = -1;
81 fLabel[1] = -1;
82 fLabel[2] = -1;
83}
84
85AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid, Int_t rob, Int_t mcm) :
86 AliTRDtrackletBase(),
87 fGeo(0x0),
88 fHCId(hcid),
89 fTrackletWord(trackletWord),
90 fMCM(mcm),
91 fROB(rob),
92 fQ0(0),
93 fQ1(0),
94 fNHits(0),
95 fNHits0(0),
96 fNHits1(0),
97 fSlope(0.),
98 fOffset(0.),
99 fError(0.),
100 fNClusters(0),
101 fResiduals(0x0),
102 fClsCharges(0x0)
103{
104 // constructor
105
106 fGeo = new AliTRDgeometry();
107 fLabel[0] = -1;
108 fLabel[1] = -1;
109 fLabel[2] = -1;
110}
111
112AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) :
113 AliTRDtrackletBase(rhs),
114 fGeo(0x0),
115 fHCId(rhs.fHCId),
116 fTrackletWord(rhs.fTrackletWord),
117 fMCM(rhs.fMCM),
118 fROB(rhs.fROB),
119 fQ0(rhs.fQ0),
120 fQ1(rhs.fQ1),
121 fNHits(rhs.fNHits),
122 fNHits0(rhs.fNHits0),
123 fNHits1(rhs.fNHits1),
124 fSlope(rhs.fSlope),
125 fOffset(rhs.fOffset),
126 fError(rhs.fError),
127 fNClusters(rhs.fNClusters),
128 fResiduals(0x0),
129 fClsCharges(0x0)
130{
131 // copy constructor
132
133 fGeo = new AliTRDgeometry();
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 }
140 fLabel[0] = rhs.fLabel[0];
141 fLabel[1] = rhs.fLabel[1];
142 fLabel[2] = rhs.fLabel[2];
143}
144
145AliTRDtrackletMCM::~AliTRDtrackletMCM()
146{
147 // destructor
148
149 delete [] fResiduals;
150 delete [] fClsCharges;
151 delete fGeo;
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
164Int_t AliTRDtrackletMCM::GetdY() const
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}
174
175void AliTRDtrackletMCM::SetLabel(Int_t label[])
176{
177 // set the labels (up to 3)
178
179 fLabel[0] = label[0];
180 fLabel[1] = label[1];
181 fLabel[2] = label[2];
182}
183
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}