Coverity 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"
a675b8d6 45#include "AliLog.h"
d15a28e7 46
47ClassImp(AliPHOSTrackSegment)
48
49//____________________________________________________________________________
3663622c 50AliPHOSTrackSegment::AliPHOSTrackSegment()
51 : fEmcRecPoint(0),
52 fIndexInList(0),
53 fCpvRecPoint(0),
54 fTrack(0)
55{
56 //def ctor
648f392e 57 fDcpv[0]=999. ;
58 fDcpv[1]=999. ;
3663622c 59}
60
61//____________________________________________________________________________
88714635 62AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
fbf5cb06 63 AliPHOSRecPoint * cpvrp1)
3663622c 64 : fEmcRecPoint(0),
65 fIndexInList(0),
66 fCpvRecPoint(0),
67 fTrack(0)
b2a60966 68{
69 // ctor
70
d15a28e7 71 if( emc )
83974468 72 fEmcRecPoint = emc->GetIndexInList() ;
73 else
74 fEmcRecPoint = -1 ;
d15a28e7 75
fbf5cb06 76 if( cpvrp1 )
77 fCpvRecPoint = cpvrp1->GetIndexInList() ;
83974468 78 else
fbf5cb06 79 fCpvRecPoint = -1 ;
d15a28e7 80
fbf5cb06 81 fTrack = -1 ;
82
83 fIndexInList = -1 ;
648f392e 84 fDcpv[0]=999. ;
85 fDcpv[1]=999. ;
fbf5cb06 86}
87
88//____________________________________________________________________________
89AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
90 AliPHOSRecPoint * cpvrp1,
91 Int_t track)
3663622c 92 : fEmcRecPoint(0),
93 fIndexInList(0),
94 fCpvRecPoint(0),
95 fTrack(0)
fbf5cb06 96{
97 // ctor
98
99 if( emc )
100 fEmcRecPoint = emc->GetIndexInList() ;
101 else
102 fEmcRecPoint = -1 ;
103
104 if( cpvrp1 )
105 fCpvRecPoint = cpvrp1->GetIndexInList() ;
106 else
107 fCpvRecPoint = -1 ;
108
109 fTrack = track ;
d15a28e7 110
83974468 111 fIndexInList = -1 ;
648f392e 112 fDcpv[0]=999. ;
113 fDcpv[1]=999. ;
114}
115
116//____________________________________________________________________________
117AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
118 AliPHOSRecPoint * cpvrp1,
119 Int_t track, Float_t dx,Float_t dz)
120 : fEmcRecPoint(0),
121 fIndexInList(0),
122 fCpvRecPoint(0),
123 fTrack(0)
124{
125 // ctor
126
127 if( emc )
128 fEmcRecPoint = emc->GetIndexInList() ;
129 else
130 fEmcRecPoint = -1 ;
131
132 if( cpvrp1 )
133 fCpvRecPoint = cpvrp1->GetIndexInList() ;
134 else
135 fCpvRecPoint = -1 ;
136
137 fTrack = track ;
138
139 fIndexInList = -1 ;
140
141 fDcpv[0] = dx ;
142 fDcpv[1] = dz ;
d15a28e7 143}
144
145//____________________________________________________________________________
6ad0bfa0 146AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
3663622c 147 : TObject(ts),
148 fEmcRecPoint(0),
149 fIndexInList(0),
150 fCpvRecPoint(0),
151 fTrack(0)
6ad0bfa0 152{
b2a60966 153 // Copy ctor
154
c198e326 155 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
6ad0bfa0 156}
157
d15a28e7 158
159//____________________________________________________________________________
6c8ba828 160AliPHOSTrackSegment & AliPHOSTrackSegment::operator = (const AliPHOSTrackSegment &)
161{
162 Fatal("operator =", "not implemented");
163 return *this;
164}
165
166//____________________________________________________________________________
702ab87e 167void AliPHOSTrackSegment::Copy(TObject & obj) const
6ad0bfa0 168{
b2a60966 169 // Copy of a track segment into another track segment
170
6ad0bfa0 171 TObject::Copy(obj) ;
83974468 172 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
fbf5cb06 173 ( (AliPHOSTrackSegment &)obj ).fCpvRecPoint = fCpvRecPoint ;
83974468 174 ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ;
fbf5cb06 175 ( (AliPHOSTrackSegment &)obj ).fTrack = fTrack ;
648f392e 176 ( (AliPHOSTrackSegment &)obj ).fDcpv[0] = fDcpv[0] ;
177 ( (AliPHOSTrackSegment &)obj ).fDcpv[1] = fDcpv[1] ;
fbf5cb06 178}
179
d15a28e7 180
181//____________________________________________________________________________
702ab87e 182void AliPHOSTrackSegment::Print(const Option_t *) const
d15a28e7 183{
b2a60966 184 // Print all information on this track Segment
185
d15a28e7 186
a675b8d6 187 AliInfo("Track segment");
fbf5cb06 188 printf("Stored at position %d\n", fIndexInList) ;
189 printf(" Emc RecPoint # %d\n", fEmcRecPoint) ;
190 if(fCpvRecPoint >= 0)
191 printf(" CPV RecPoint # %d\n", fCpvRecPoint) ;
2731cd1e 192 else
fbf5cb06 193 printf(" No CPV RecPoint\n");
194 if (fTrack >= 0)
195 printf(" Charged track # %d\n", fTrack) ;
196 else
197 printf(" No Charged track\n");
648f392e 198 printf(" Distance to CPV: x=%f, z=%f\n",fDcpv[0],fDcpv[1]) ;
d15a28e7 199}
fbf5cb06 200
28c3a259 201//____________________________________________________________________________
fbf5cb06 202void AliPHOSTrackSegment::SetCpvRecPoint(AliPHOSRecPoint * cpvRecPoint)
28c3a259 203{
2f04ed65 204 // gives an id from its position in the list
fbf5cb06 205 if( cpvRecPoint )
206 fCpvRecPoint = cpvRecPoint->GetIndexInList() ;
28c3a259 207 else
fbf5cb06 208 fCpvRecPoint = -1 ;
28c3a259 209}
648f392e 210//____________________________________________________________________________
211Float_t AliPHOSTrackSegment::GetCpvDistance(const Option_t* dr) const
212{
213 if(strcmp(dr,"x")==0||strcmp(dr,"X")==0) return fDcpv[0] ;
214 if(strcmp(dr,"z")==0||strcmp(dr,"Z")==0) return fDcpv[1] ;
215 if(strcmp(dr,"r")==0||strcmp(dr,"R")==0) return TMath::Sqrt(fDcpv[0]*fDcpv[0]+fDcpv[1]*fDcpv[1]) ;
216 return 999. ;
d15a28e7 217
648f392e 218}