Bug fix
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrackSegment.cxx
CommitLineData
d15a28e7 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 **************************************************************************/
b2a60966 15/* $Id$ */
702ab87e 16
17/* History of cvs commits:
18 *
19 * $Log$
648f392e 20 * Revision 1.30 2006/08/28 10:01:56 kharlov
21 * Effective C++ warnings fixed (Timur Pocheptsov)
22 *
3663622c 23 * Revision 1.29 2005/05/28 14:19:05 schutz
24 * Compilation warnings fixed by T.P.
25 *
702ab87e 26 */
27
d15a28e7 28//_________________________________________________________________________
b2a60966 29// Track segment in PHOS
30// Can be : 1 EmcRecPoint
fbf5cb06 31// 1 EmcRecPoint + 1 CPV
32// 1 EmcRecPoint + 1 CPV + 1 charged track
b2a60966 33//
34//*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
d15a28e7 35
36// --- ROOT system ---
37
d15a28e7 38
39// --- Standard library ---
40
d15a28e7 41// --- AliRoot header files ---
e957fea8 42#include "AliPHOSEmcRecPoint.h"
d15a28e7 43#include "AliPHOSTrackSegment.h"
fbf5cb06 44#include "AliESDtrack.h"
d15a28e7 45
46ClassImp(AliPHOSTrackSegment)
47
48//____________________________________________________________________________
3663622c 49AliPHOSTrackSegment::AliPHOSTrackSegment()
50 : fEmcRecPoint(0),
51 fIndexInList(0),
52 fCpvRecPoint(0),
53 fTrack(0)
54{
55 //def ctor
648f392e 56 fDcpv[0]=999. ;
57 fDcpv[1]=999. ;
3663622c 58}
59
60//____________________________________________________________________________
88714635 61AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
fbf5cb06 62 AliPHOSRecPoint * cpvrp1)
3663622c 63 : fEmcRecPoint(0),
64 fIndexInList(0),
65 fCpvRecPoint(0),
66 fTrack(0)
b2a60966 67{
68 // ctor
69
d15a28e7 70 if( emc )
83974468 71 fEmcRecPoint = emc->GetIndexInList() ;
72 else
73 fEmcRecPoint = -1 ;
d15a28e7 74
fbf5cb06 75 if( cpvrp1 )
76 fCpvRecPoint = cpvrp1->GetIndexInList() ;
83974468 77 else
fbf5cb06 78 fCpvRecPoint = -1 ;
d15a28e7 79
fbf5cb06 80 fTrack = -1 ;
81
82 fIndexInList = -1 ;
648f392e 83 fDcpv[0]=999. ;
84 fDcpv[1]=999. ;
fbf5cb06 85}
86
87//____________________________________________________________________________
88AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
89 AliPHOSRecPoint * cpvrp1,
90 Int_t track)
3663622c 91 : fEmcRecPoint(0),
92 fIndexInList(0),
93 fCpvRecPoint(0),
94 fTrack(0)
fbf5cb06 95{
96 // ctor
97
98 if( emc )
99 fEmcRecPoint = emc->GetIndexInList() ;
100 else
101 fEmcRecPoint = -1 ;
102
103 if( cpvrp1 )
104 fCpvRecPoint = cpvrp1->GetIndexInList() ;
105 else
106 fCpvRecPoint = -1 ;
107
108 fTrack = track ;
d15a28e7 109
83974468 110 fIndexInList = -1 ;
648f392e 111 fDcpv[0]=999. ;
112 fDcpv[1]=999. ;
113}
114
115//____________________________________________________________________________
116AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
117 AliPHOSRecPoint * cpvrp1,
118 Int_t track, Float_t dx,Float_t dz)
119 : fEmcRecPoint(0),
120 fIndexInList(0),
121 fCpvRecPoint(0),
122 fTrack(0)
123{
124 // ctor
125
126 if( emc )
127 fEmcRecPoint = emc->GetIndexInList() ;
128 else
129 fEmcRecPoint = -1 ;
130
131 if( cpvrp1 )
132 fCpvRecPoint = cpvrp1->GetIndexInList() ;
133 else
134 fCpvRecPoint = -1 ;
135
136 fTrack = track ;
137
138 fIndexInList = -1 ;
139
140 fDcpv[0] = dx ;
141 fDcpv[1] = dz ;
d15a28e7 142}
143
144//____________________________________________________________________________
6ad0bfa0 145AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
3663622c 146 : TObject(ts),
147 fEmcRecPoint(0),
148 fIndexInList(0),
149 fCpvRecPoint(0),
150 fTrack(0)
6ad0bfa0 151{
b2a60966 152 // Copy ctor
153
c198e326 154 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
6ad0bfa0 155}
156
d15a28e7 157
158//____________________________________________________________________________
702ab87e 159void AliPHOSTrackSegment::Copy(TObject & obj) const
6ad0bfa0 160{
b2a60966 161 // Copy of a track segment into another track segment
162
6ad0bfa0 163 TObject::Copy(obj) ;
83974468 164 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
fbf5cb06 165 ( (AliPHOSTrackSegment &)obj ).fCpvRecPoint = fCpvRecPoint ;
83974468 166 ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ;
fbf5cb06 167 ( (AliPHOSTrackSegment &)obj ).fTrack = fTrack ;
648f392e 168 ( (AliPHOSTrackSegment &)obj ).fDcpv[0] = fDcpv[0] ;
169 ( (AliPHOSTrackSegment &)obj ).fDcpv[1] = fDcpv[1] ;
fbf5cb06 170}
171
d15a28e7 172
173//____________________________________________________________________________
702ab87e 174void AliPHOSTrackSegment::Print(const Option_t *) const
d15a28e7 175{
b2a60966 176 // Print all information on this track Segment
177
d15a28e7 178
fbf5cb06 179 Info("Print", "");
180 printf("Stored at position %d\n", fIndexInList) ;
181 printf(" Emc RecPoint # %d\n", fEmcRecPoint) ;
182 if(fCpvRecPoint >= 0)
183 printf(" CPV RecPoint # %d\n", fCpvRecPoint) ;
2731cd1e 184 else
fbf5cb06 185 printf(" No CPV RecPoint\n");
186 if (fTrack >= 0)
187 printf(" Charged track # %d\n", fTrack) ;
188 else
189 printf(" No Charged track\n");
648f392e 190 printf(" Distance to CPV: x=%f, z=%f\n",fDcpv[0],fDcpv[1]) ;
d15a28e7 191}
fbf5cb06 192
28c3a259 193//____________________________________________________________________________
fbf5cb06 194void AliPHOSTrackSegment::SetCpvRecPoint(AliPHOSRecPoint * cpvRecPoint)
28c3a259 195{
2f04ed65 196 // gives an id from its position in the list
fbf5cb06 197 if( cpvRecPoint )
198 fCpvRecPoint = cpvRecPoint->GetIndexInList() ;
28c3a259 199 else
fbf5cb06 200 fCpvRecPoint = -1 ;
28c3a259 201}
648f392e 202//____________________________________________________________________________
203Float_t AliPHOSTrackSegment::GetCpvDistance(const Option_t* dr) const
204{
205 if(strcmp(dr,"x")==0||strcmp(dr,"X")==0) return fDcpv[0] ;
206 if(strcmp(dr,"z")==0||strcmp(dr,"Z")==0) return fDcpv[1] ;
207 if(strcmp(dr,"r")==0||strcmp(dr,"R")==0) return TMath::Sqrt(fDcpv[0]*fDcpv[0]+fDcpv[1]*fDcpv[1]) ;
208 return 999. ;
d15a28e7 209
648f392e 210}