]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtrackletMCM.cxx
robust write tracklet quality to ESD track
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackletMCM.cxx
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
29 ClassImp(AliTRDtrackletMCM)
30
31 AliTRDtrackletMCM::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     fGeo = new AliTRDgeometry();
51     fLabel[0] = -1;
52     fLabel[1] = -1;
53     fLabel[2] = -1;
54 }
55
56 AliTRDtrackletMCM::AliTRDtrackletMCM(UInt_t trackletWord, Int_t hcid) :
57   AliTRDtrackletBase(),
58   fGeo(0x0),
59   fHCId(hcid),
60   fTrackletWord(trackletWord),
61   fMCM(-1),
62   fROB(-1),
63   fQ0(0),
64   fQ1(0),
65   fNHits(0),
66   fNHits0(0),
67   fNHits1(0),
68   fSlope(0.),
69   fOffset(0.),
70   fError(0.),
71   fNClusters(0),
72   fResiduals(0x0),
73   fClsCharges(0x0)
74 {
75     fGeo = new AliTRDgeometry();
76     fLabel[0] = -1;
77     fLabel[1] = -1;
78     fLabel[2] = -1;
79 }
80
81 AliTRDtrackletMCM::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),
88   fQ0(0),
89   fQ1(0),
90   fNHits(0),
91   fNHits0(0),
92   fNHits1(0),
93   fSlope(0.),
94   fOffset(0.),
95   fError(0.),
96   fNClusters(0),
97   fResiduals(0x0),
98   fClsCharges(0x0)
99 {
100     fGeo = new AliTRDgeometry();
101     fLabel[0] = -1;
102     fLabel[1] = -1;
103     fLabel[2] = -1;
104 }
105
106 AliTRDtrackletMCM::AliTRDtrackletMCM(const AliTRDtrackletMCM &rhs) :
107   AliTRDtrackletBase(rhs),
108   fGeo(0x0),
109   fHCId(rhs.fHCId),
110   fTrackletWord(rhs.fTrackletWord),
111   fMCM(rhs.fMCM),
112   fROB(rhs.fROB),
113   fQ0(rhs.fQ0),
114   fQ1(rhs.fQ1),
115   fNHits(rhs.fNHits),
116   fNHits0(rhs.fNHits0),
117   fNHits1(rhs.fNHits1),
118   fSlope(rhs.fSlope),
119   fOffset(rhs.fOffset),
120   fError(rhs.fError),
121   fNClusters(rhs.fNClusters),
122   fResiduals(0x0),
123   fClsCharges(0x0)
124 {
125     fGeo = new AliTRDgeometry();
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     }
132     fLabel[0] = rhs.fLabel[0];
133     fLabel[1] = rhs.fLabel[1];
134     fLabel[2] = rhs.fLabel[2];
135 }
136
137 AliTRDtrackletMCM::~AliTRDtrackletMCM()
138 {
139   delete [] fResiduals;
140   delete [] fClsCharges;
141     delete fGeo;
142 }
143
144 Int_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
154 Int_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 }
164
165 void AliTRDtrackletMCM::SetLabel(Int_t label[])
166 {
167   fLabel[0] = label[0];
168   fLabel[1] = label[1];
169   fLabel[2] = label[2];
170 }
171
172 void 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 }