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