]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSRecPoint.cxx
Adding using::std...
[u/mrichter/AliRoot.git] / ITS / AliITSRecPoint.cxx
CommitLineData
ee84ac37 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
88cb7938 16/* $Id$ */
d9f43611 17
00a7cc50 18///////////////////////////////////////////////////////////////////////////////
19// Reconstructed space point class for set:ITS
20// Reconstructed points are expressed simultaneously in two different
21// reference frames, both differing from the global system.
22// The first is referred to the sensor (see AliITSsegmentation for the
23// definition) and each point is represented by two coordinates: fXloc and
24// fZloc. This system in the code is referred to as "local"
25// The second is used for tracking (V2, SA and MI versions) and the X axis
26// represents the radial coordinate (this system is, in the bending plane,
27// a rotated system w.r.t. the global reference system).
28// Each reaconstructed point is represented by two coordinates: fY and fZ,
29// inherited from AliCluster. This system in the code is referred to as
30// "trackingV2".
31///////////////////////////////////////////////////////////////////////////////
e8189707 32
2499b21b 33#include <TGeoMatrix.h>
e8189707 34#include "AliITSRecPoint.h"
75fb37cc 35#include "AliAlignObj.h"
36
fe7d86eb 37using std::ios;
e8189707 38ClassImp(AliITSRecPoint)
9671cc24 39
00a7cc50 40//_____________________________________________________________
8f6140ad 41AliITSRecPoint::AliITSRecPoint():
42AliCluster(),
e56160b8 43fXloc(0),
44fZloc(0),
45fdEdX(0),
46fIndex(0),
47fQ(0),
48fLayer(0),
49fNz(0),
50fNy(0),
51fChargeRatio(0),
52fType(0),
b2558977 53fDeltaProb(0),
8f6140ad 54fDriftTime(0.),
55fDriftSide(0)
75fb37cc 56{
57 // default constructor
00a7cc50 58}
59
60//________________________________________________________________________
75fb37cc 61AliITSRecPoint::AliITSRecPoint(Int_t *lab,Float_t *hit, Int_t *info, Bool_t local):
ae079791 62AliCluster(AliGeomManager::LayerToVolUID((info[2]+AliGeomManager::kSPD1),lab[3]&0x3FF),hit,0,0,lab),
e56160b8 63fXloc(0),
64fZloc(0),
65fdEdX(0),
66fIndex(lab[3]),
67fQ(hit[4]),
68fLayer(info[2]),
69fNz(info[1]),
70fNy(info[0]),
71fChargeRatio(0),
72fType(0),
b2558977 73fDeltaProb(0),
8f6140ad 74fDriftTime(0.),
75fDriftSide(0)
e56160b8 76{
00a7cc50 77 //standard constructor used in AliITSClusterFinderV2
e56160b8 78
75fb37cc 79 if (!local) { // Cluster V2
80 Double_t txyz[3] = {GetX(), GetY(), GetZ()};
81 Double_t lxyz[3] = {0, 0, 0};
82 GetTracking2LocalMatrix()->LocalToMaster(txyz,lxyz);
83 fXloc = lxyz[0]; fZloc = lxyz[2];
465c1533 84 if(fLayer==4) hit[5]=-hit[5];
0a56760a 85 if( (fLayer==4) || (fLayer==5) ) SetSigmaYZ(hit[5]);
75fb37cc 86 }
87 else {
88 switch (fLayer) {
89 case 0:
90 case 1:
91 fdEdX = 0;
92 break;
93 case 2:
94 case 3:
95 fdEdX=fQ*1e-6;
96 break;
97 case 4:
d695268b 98 fdEdX=fQ*2.16;
99 SetSigmaYZ(hit[5]);
045be90c 100 break;
75fb37cc 101 case 5:
102 fdEdX=fQ*2.16;
d695268b 103 hit[5]=-hit[5];
104 SetSigmaYZ(hit[5]);
75fb37cc 105 break;
106 default:
107 AliError(Form("Wrong ITS layer %d (0 -> 5)",fLayer));
108 break;
109 }
e8a76a26 110 fXloc = hit[0];
111 fZloc = hit[1];
75fb37cc 112 Double_t lxyz[3] = {fXloc, 0, fZloc};
113 Double_t txyz[3] = {0, 0, 0};
114 GetTracking2LocalMatrix()->MasterToLocal(lxyz,txyz);
115
116 SetX(0.); SetY(txyz[1]); SetZ(txyz[2]);
e56160b8 117
00a7cc50 118 }
75fb37cc 119
00a7cc50 120}
75fb37cc 121
00a7cc50 122//_______________________________________________________________________
8f6140ad 123AliITSRecPoint::AliITSRecPoint(const AliITSRecPoint& pt):
124 AliCluster(pt),
125 fXloc(pt.fXloc),
126 fZloc(pt.fZloc),
127 fdEdX(pt.fdEdX),
128 fIndex(pt.fIndex),
129 fQ(pt.fQ),
130 fLayer(pt.fLayer),
131 fNz(pt.fNz),
132 fNy(pt.fNy),
133 fChargeRatio(pt.fChargeRatio),
134 fType(pt.fType),
135 fDeltaProb(pt.fDeltaProb),
136 fDriftTime(pt.fDriftTime),
137 fDriftSide(pt.fDriftSide)
75fb37cc 138{
00a7cc50 139 //Copy constructor
00a7cc50 140
141}
142
143//______________________________________________________________________
e56160b8 144AliITSRecPoint& AliITSRecPoint::operator=(const AliITSRecPoint& source){
00a7cc50 145 // Assignment operator
e56160b8 146
147 this->~AliITSRecPoint();
148 new(this) AliITSRecPoint(source);
00a7cc50 149 return *this;
e56160b8 150
00a7cc50 151}
152
ee84ac37 153//----------------------------------------------------------------------
154void AliITSRecPoint::Print(ostream *os){
155 ////////////////////////////////////////////////////////////////////////
156 // Standard output format for this class.
157 ////////////////////////////////////////////////////////////////////////
158#if defined __GNUC__
159#if __GNUC__ > 2
160 ios::fmtflags fmt;
161#else
162 Int_t fmt;
163#endif
164#else
9f69211c 165#if defined __ICC || defined __ECC || defined __xlC__
ee84ac37 166 ios::fmtflags fmt;
167#else
168 Int_t fmt;
169#endif
170#endif
171
172 fmt = os->setf(ios::fixed); // set fixed floating point output
75fb37cc 173 *os << GetLabel(0) << " " << GetLabel(1) << " " << GetLabel(2) << " ";
ee84ac37 174 fmt = os->setf(ios::scientific); // set scientific for dEdX.
012f0f4c 175 *os << GetX() <<" " << GetY() << " " << GetZ() << " " ;
176 *os << GetSigmaY2() << " " << GetSigmaZ2() << " " << GetSigmaYZ() << " ";
177 fmt = os->setf(ios::fixed);
178 *os << GetVolumeId() << " "<< Misalign() /*fIsMisaligned*/ << " ";
179 fmt = os->setf(ios::scientific); // set scientific for dEdX.
180 *os << fXloc << " " << fZloc << " " << fdEdX << " ";
ee84ac37 181 fmt = os->setf(ios::fixed); // every fixed
012f0f4c 182 *os << fIndex <<" " << fQ << " "<<fLayer <<" "<<fNz<<" "<<fNy<<" ";
8f6140ad 183 *os << fChargeRatio<<" " << fType << " " << fDeltaProb << " " << fDriftTime<< " " << fDriftSide;
ee84ac37 184 os->flags(fmt); // reset back to old formating.
185 return;
186}
98a86dff 187
188//----------------------------------------------------------------------
189Int_t AliITSRecPoint::GetNpixels() const {
190//
191// returns the number of pixels used for the SPD clusters
192//
193
194 if(fLayer > 1) return -1;
195 else return fType;
196
197}
198
8bab7823 199//----------------------------------------------------------------------
200Int_t AliITSRecPoint::GetSPDclusterType() const {
201//
e3901fd8 202// returns an Int_t with encoded information on cluster size
203// type <= 16: cluster type identifier according to conventional numbering
204// type > 16: Npixels+1000*Ny+1000000*Nz
8bab7823 205//
206
207 Int_t type = -1;
208 if(fLayer > 1) return type;
209 else {
210
211 switch (fType) {
212 case 1 : type = 1 ;break;
213 case 2 : if(fNy == 2) type = 2;
214 else type = 3;
215 break;
216 case 3 : if(fNy == 3) type = 4;
217 else if(fNz == 3) type = 6;
218 else type = 5;
219 break;
220 case 4 : if(fNz == 1) type = 7;
221 else if(fNz == 2 && fNy == 2) type = 8;
222 else if(fNy == 2 && fNz == 3) type = 11;
223 else if(fNy == 3 && fNz == 2) type = 9;
e3901fd8 224 else type = 15;
8bab7823 225 break;
226 case 5 : if(fNy == 3 && fNz == 2) type = 10;
227 if(fNy == 2 && fNz == 3 ) type = 12;
228 if(fNy == 5) type = 16;
e3901fd8 229 else type = fType+1000*fNy+1000000*fNz;
8bab7823 230 break;
231 case 6 : if(fNy ==3 && fNz == 2) type = 13;
232 if(fNy ==2 && fNz == 3) type = 14;
e3901fd8 233 else type = fType+1000*fNy+1000000*fNz;
234 break;
235 default: type = fType+1000*fNy+1000000*fNz;
236 break;
8bab7823 237 }
238
239 return type;
240 }
e3901fd8 241}
242
243//----------------------------------------------------------------------
244Int_t AliITSRecPoint::GetSDDclusterType() const {
245// returns an Int_t with encoded information on cluster size
246// Byte1 = fNz Byte0=fNy, other two bytes empty for extra information
247// max. allowed cluster size = 255
248 Int_t typ=(fNz&0xFF)<<8;
249 typ+=fNy&0xFF;
8f6140ad 250 if(fDriftSide==1) typ+=1<<16;
e3901fd8 251 return typ;
252}
d59a647b 253//----------------------------------------------------------------------
254void AliITSRecPoint::DecodeSDDclusterType(Int_t cluType, Int_t &cluSizAn, Int_t& cluSizTb, Int_t &drSide){
255// Extract cluster sizes and drift side from cluster type
256 cluSizTb=cluType&0xFF;
257 cluSizAn=(cluType>>8)&0xFF;
258 drSide=(cluType>>16);
259 return;
260}
e3901fd8 261//----------------------------------------------------------------------
262Int_t AliITSRecPoint::GetSSDclusterType() const {
263// returns an Int_t with encoded information on cluster size
264// Byte1 = fNz Byte0=fNy, other two bytes empty for extra information
265// max. allowed cluster size = 255
266 Int_t typ=(fNz&0xFF)<<8;
267 typ+=fNy&0xFF;
268 return typ;
269}
8bab7823 270
ee84ac37 271//----------------------------------------------------------------------
272void AliITSRecPoint::Read(istream *is){
273////////////////////////////////////////////////////////////////////////
274// Standard input format for this class.
275////////////////////////////////////////////////////////////////////////
012f0f4c 276 Bool_t mis;
277 Int_t lab[4];
278 Float_t hit[6];
279 lab[3] = 0; // ??
280 *is >> lab[0] >> lab[1] >> lab[2];
281 SetLabel(lab[0],0); SetLabel(lab[1],1); SetLabel(lab[2],2);
282 *is >> hit[0] >> hit[1] >> hit[2] >> hit[3] >> hit[4] >> hit[5];
283 SetX(hit[0]);SetY(hit[1]);SetZ(hit[2]);SetSigmaY2(hit[3]);
284 SetSigmaZ2(hit[4]);//fSigmaYZ=hit[5];
285 *is >> lab[0] >> mis;
286 SetVolumeId(lab[0]);// fIsMisalinged = mis;
287 *is >> fXloc >> fZloc >> fdEdX;
288 *is >> fIndex >> fQ >> fLayer >> fNz >> fNy >> fChargeRatio >> fType;
8f6140ad 289 *is >> fDeltaProb >> fDriftTime >> fDriftSide;
012f0f4c 290
291 return;
ee84ac37 292}
293//----------------------------------------------------------------------
294ostream &operator<<(ostream &os,AliITSRecPoint &p){
295////////////////////////////////////////////////////////////////////////
296// Standard output streaming function.
297////////////////////////////////////////////////////////////////////////
298
299 p.Print(&os);
300 return os;
301}
302//----------------------------------------------------------------------
303istream &operator>>(istream &is,AliITSRecPoint &r){
304////////////////////////////////////////////////////////////////////////
305// Standard input streaming function.
306////////////////////////////////////////////////////////////////////////
307
308 r.Read(&is);
309 return is;
310}
0a56760a 311//----------------------------------------------------------------------