GUI for TRD track state control (Ben)
[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//_____________________________________________________________
e56160b8 40AliITSRecPoint::AliITSRecPoint(): AliCluster(),
e56160b8 41fXloc(0),
42fZloc(0),
43fdEdX(0),
44fIndex(0),
45fQ(0),
46fLayer(0),
47fNz(0),
48fNy(0),
49fChargeRatio(0),
50fType(0),
75fb37cc 51fDeltaProb(0)
52{
53 // default constructor
00a7cc50 54}
55
56//________________________________________________________________________
75fb37cc 57AliITSRecPoint::AliITSRecPoint(Int_t *lab,Float_t *hit, Int_t *info, Bool_t local):
ae079791 58AliCluster(AliGeomManager::LayerToVolUID((info[2]+AliGeomManager::kSPD1),lab[3]&0x3FF),hit,0,0,lab),
e56160b8 59fXloc(0),
60fZloc(0),
61fdEdX(0),
62fIndex(lab[3]),
63fQ(hit[4]),
64fLayer(info[2]),
65fNz(info[1]),
66fNy(info[0]),
67fChargeRatio(0),
68fType(0),
75fb37cc 69fDeltaProb(0)
e56160b8 70{
00a7cc50 71 //standard constructor used in AliITSClusterFinderV2
e56160b8 72
75fb37cc 73 if (!local) { // Cluster V2
74 Double_t txyz[3] = {GetX(), GetY(), GetZ()};
75 Double_t lxyz[3] = {0, 0, 0};
76 GetTracking2LocalMatrix()->LocalToMaster(txyz,lxyz);
77 fXloc = lxyz[0]; fZloc = lxyz[2];
78 }
79 else {
80 switch (fLayer) {
81 case 0:
82 case 1:
83 fdEdX = 0;
84 break;
85 case 2:
86 case 3:
87 fdEdX=fQ*1e-6;
88 break;
89 case 4:
90 case 5:
91 fdEdX=fQ*2.16;
92 break;
93 default:
94 AliError(Form("Wrong ITS layer %d (0 -> 5)",fLayer));
95 break;
96 }
e8a76a26 97 fXloc = hit[0];
98 fZloc = hit[1];
75fb37cc 99 Double_t lxyz[3] = {fXloc, 0, fZloc};
100 Double_t txyz[3] = {0, 0, 0};
101 GetTracking2LocalMatrix()->MasterToLocal(lxyz,txyz);
102
103 SetX(0.); SetY(txyz[1]); SetZ(txyz[2]);
e56160b8 104
00a7cc50 105 }
75fb37cc 106
00a7cc50 107}
75fb37cc 108
00a7cc50 109//_______________________________________________________________________
e56160b8 110AliITSRecPoint::AliITSRecPoint(const AliITSRecPoint& pt):AliCluster(pt),
111fXloc(pt.fXloc),
112fZloc(pt.fZloc),
113fdEdX(pt.fdEdX),
114fIndex(pt.fIndex),
115fQ(pt.fQ),
116fLayer(pt.fLayer),
117fNz(pt.fNz),
118fNy(pt.fNy),
119fChargeRatio(pt.fChargeRatio),
120fType(pt.fType),
75fb37cc 121fDeltaProb(pt.fDeltaProb)
122{
00a7cc50 123 //Copy constructor
00a7cc50 124
125}
126
127//______________________________________________________________________
e56160b8 128AliITSRecPoint& AliITSRecPoint::operator=(const AliITSRecPoint& source){
00a7cc50 129 // Assignment operator
e56160b8 130
131 this->~AliITSRecPoint();
132 new(this) AliITSRecPoint(source);
00a7cc50 133 return *this;
e56160b8 134
00a7cc50 135}
136
ee84ac37 137//----------------------------------------------------------------------
138void AliITSRecPoint::Print(ostream *os){
139 ////////////////////////////////////////////////////////////////////////
140 // Standard output format for this class.
141 ////////////////////////////////////////////////////////////////////////
142#if defined __GNUC__
143#if __GNUC__ > 2
144 ios::fmtflags fmt;
145#else
146 Int_t fmt;
147#endif
148#else
9f69211c 149#if defined __ICC || defined __ECC || defined __xlC__
ee84ac37 150 ios::fmtflags fmt;
151#else
152 Int_t fmt;
153#endif
154#endif
155
156 fmt = os->setf(ios::fixed); // set fixed floating point output
75fb37cc 157 *os << GetLabel(0) << " " << GetLabel(1) << " " << GetLabel(2) << " ";
ee84ac37 158 fmt = os->setf(ios::scientific); // set scientific for dEdX.
012f0f4c 159 *os << GetX() <<" " << GetY() << " " << GetZ() << " " ;
160 *os << GetSigmaY2() << " " << GetSigmaZ2() << " " << GetSigmaYZ() << " ";
161 fmt = os->setf(ios::fixed);
162 *os << GetVolumeId() << " "<< Misalign() /*fIsMisaligned*/ << " ";
163 fmt = os->setf(ios::scientific); // set scientific for dEdX.
164 *os << fXloc << " " << fZloc << " " << fdEdX << " ";
ee84ac37 165 fmt = os->setf(ios::fixed); // every fixed
012f0f4c 166 *os << fIndex <<" " << fQ << " "<<fLayer <<" "<<fNz<<" "<<fNy<<" ";
167 *os << fChargeRatio<<" " << fType << " " << fDeltaProb;
ee84ac37 168 os->flags(fmt); // reset back to old formating.
169 return;
170}
171//----------------------------------------------------------------------
172void AliITSRecPoint::Read(istream *is){
173////////////////////////////////////////////////////////////////////////
174// Standard input format for this class.
175////////////////////////////////////////////////////////////////////////
012f0f4c 176 Bool_t mis;
177 Int_t lab[4];
178 Float_t hit[6];
179 lab[3] = 0; // ??
180 *is >> lab[0] >> lab[1] >> lab[2];
181 SetLabel(lab[0],0); SetLabel(lab[1],1); SetLabel(lab[2],2);
182 *is >> hit[0] >> hit[1] >> hit[2] >> hit[3] >> hit[4] >> hit[5];
183 SetX(hit[0]);SetY(hit[1]);SetZ(hit[2]);SetSigmaY2(hit[3]);
184 SetSigmaZ2(hit[4]);//fSigmaYZ=hit[5];
185 *is >> lab[0] >> mis;
186 SetVolumeId(lab[0]);// fIsMisalinged = mis;
187 *is >> fXloc >> fZloc >> fdEdX;
188 *is >> fIndex >> fQ >> fLayer >> fNz >> fNy >> fChargeRatio >> fType;
189 *is >> fDeltaProb;
190
191 return;
ee84ac37 192}
193//----------------------------------------------------------------------
194ostream &operator<<(ostream &os,AliITSRecPoint &p){
195////////////////////////////////////////////////////////////////////////
196// Standard output streaming function.
197////////////////////////////////////////////////////////////////////////
198
199 p.Print(&os);
200 return os;
201}
202//----------------------------------------------------------------------
203istream &operator>>(istream &is,AliITSRecPoint &r){
204////////////////////////////////////////////////////////////////////////
205// Standard input streaming function.
206////////////////////////////////////////////////////////////////////////
207
208 r.Read(&is);
209 return is;
210}
211//----------------------------------------------------------------------