updated timestamps following the timestamps of the new simulation in AMANDA, adding...
[u/mrichter/AliRoot.git] / JETAN / DEV / AliJetCalTrk.cxx
CommitLineData
d89b8229 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
16/* $Id$ */
17
18//--------------------------------------------------
19// CalTrk is used to store Tracks and CaloCells information
20//
21// Author: alexandre.shabetai@cern.ch & magali.estienne@subatech.in2p3.fr
22//-------------------------------------------------
23
24#include "AliJetCalTrk.h"
25
26#include "AliVCaloCells.h"
27
28ClassImp(AliJetCalTrkTrack)
29
30//////////////////////////////////////////////////////////////////
31
32AliJetCalTrkTrack::AliJetCalTrkTrack():
33 TObject(),
34 fCalTrkTrackRef(),
35 fCalTrkCutFlag(kFALSE),
36 fCalTrkSignalFlag(kFALSE),
37 fCalTrkPtCorr(1.)
38{
39 // Default constructor
40}
41
42//------------------------------------------------------------------------
43AliJetCalTrkTrack::AliJetCalTrkTrack(AliVTrack* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptCorr):
44 TObject(),
45 fCalTrkTrackRef(track),
46 fCalTrkCutFlag(cutFlag),
47 fCalTrkSignalFlag(signalFlag),
48 fCalTrkPtCorr(ptCorr)
49{
50 // Constructor 2
51}
52
53//------------------------------------------------------------------------
54AliJetCalTrkTrack::AliJetCalTrkTrack(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptCorr):
55 TObject(),
56 fCalTrkTrackRef(track),
57 fCalTrkCutFlag(cutFlag),
58 fCalTrkSignalFlag(signalFlag),
59 fCalTrkPtCorr(ptCorr)
60{
61 // Constructor 3
62}
63
64//------------------------------------------------------------------------
65AliJetCalTrkTrack::AliJetCalTrkTrack(const AliJetCalTrkTrack& rCalTrk):
66 TObject(rCalTrk),
67 fCalTrkTrackRef(rCalTrk.fCalTrkTrackRef),
68 fCalTrkCutFlag(rCalTrk.fCalTrkCutFlag),
69 fCalTrkSignalFlag(rCalTrk.fCalTrkSignalFlag),
70 fCalTrkPtCorr(rCalTrk.fCalTrkPtCorr)
71{
72 // Copy constructor
73}
74
75//------------------------------------------------------------------------
76AliJetCalTrkTrack& AliJetCalTrkTrack::operator=(const AliJetCalTrkTrack& rhs)
77{
78 // Assignment
79 if (this != &rhs) {
80 TObject::operator=(rhs);
81 fCalTrkTrackRef = rhs.fCalTrkTrackRef;
82 fCalTrkCutFlag = rhs.fCalTrkCutFlag;
83 fCalTrkSignalFlag = rhs.fCalTrkSignalFlag;
84 fCalTrkPtCorr = rhs.fCalTrkPtCorr;
85 }
86 return *this;
87
88}
89
90//------------------------------------------------------------------------
91void AliJetCalTrkTrack::Clear(Option_t* /*option*/)
92{
93 // Clear objects
94 fCalTrkTrackRef = 0;
95 fCalTrkCutFlag = 0;
96 fCalTrkSignalFlag = 0;
97 fCalTrkPtCorr = 1.;
98
99}
100
101//-----------------------------------------------------------------------
3aa5f547 102void AliJetCalTrkTrack::Print(const Option_t* option) const
d89b8229 103{
104 cout << "Track: " << option << ", Pt: " << GetPt() << ", Eta: " << GetEta() << ", Phi: " << GetPhi() << endl;
3aa5f547 105
d89b8229 106}
107
108//...........................................................................
109//***************************************************************************
110ClassImp(AliJetCalTrkTrackKine)
111
112 AliJetCalTrkTrackKine::AliJetCalTrkTrackKine():
113 AliJetCalTrkTrack(),
114 fCalTrkPtReso(1.),
115 fCalTrkTrackE(-999.),
116 fCalTrkTrackPt(-999.),
3aa5f547 117 fCalTrkTrackP(-999.),
118 fCalTrkTrackPx(-999.),
119 fCalTrkTrackPy(-999.),
120 fCalTrkTrackPz(-999.)
d89b8229 121{
122 // Default constructor
123}
124
125//------------------------------------------------------------------------
126AliJetCalTrkTrackKine::AliJetCalTrkTrackKine(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptReso) :
127 AliJetCalTrkTrack(track,cutFlag,signalFlag),
128 fCalTrkPtReso(ptReso),
129 fCalTrkTrackE(-999.),
130 fCalTrkTrackPt(-999.),
3aa5f547 131 fCalTrkTrackP(-999.),
132 fCalTrkTrackPx(-999.),
133 fCalTrkTrackPy(-999.),
134 fCalTrkTrackPz(-999.)
d89b8229 135{
136 // Constructor 2
3aa5f547 137 CalcPx(); CalcPy(); CalcPz(); CalcP(); CalcPt(); CalcE();
138
d89b8229 139}
140
141//------------------------------------------------------------------------
142void AliJetCalTrkTrackKine::Clear(Option_t* option)
143{
144 // Clear objects
145 fCalTrkPtReso = 1.;
146 fCalTrkTrackE = -999;
147 fCalTrkTrackPt = -999;
148 fCalTrkTrackP = -999;
3aa5f547 149 fCalTrkTrackPx = -999;
150 fCalTrkTrackPy = -999;
151 fCalTrkTrackPz = -999;
d89b8229 152 AliJetCalTrkTrack::Clear(option);
153
154}
155
156//------------------------------------------------------------------------
3aa5f547 157Float_t AliJetCalTrkTrackKine::CalcE()
d89b8229 158{
159 // Particle energy
160 if(fCalTrkTrackE==-999){
161 if ( fCalTrkPtReso != 1 ){
162 fCalTrkTrackE = TMath::Sqrt(GetPx()*GetPx()+GetPy()*GetPy()+GetPz()*GetPz()+GetM()*GetM());
163 }
164 else {fCalTrkTrackE = GetParticle()->E(); }
165 }
166
167 return fCalTrkTrackE;
168
169}
170
171//------------------------------------------------------------------------
3aa5f547 172Float_t AliJetCalTrkTrackKine::CalcPt()
d89b8229 173{
174 // Particle transverse momentum
175 if(fCalTrkTrackPt==-999){
176 if ( fCalTrkPtReso != 1 ){
177 fCalTrkTrackPt = TMath::Sqrt(GetPx()*GetPx()+GetPy()*GetPy());
178 }
179 else {fCalTrkTrackPt = GetParticle()->Pt();}
180 }
181
182 return fCalTrkTrackPt;
183
184}
185
186//------------------------------------------------------------------------
3aa5f547 187Float_t AliJetCalTrkTrackKine::CalcP()
d89b8229 188{
189 // Particle momentum
190 if(fCalTrkTrackP==-999){
191 if ( fCalTrkPtReso != 1 ){
192 fCalTrkTrackP = TMath::Sqrt(GetPx()*GetPx()+GetPy()*GetPy()+GetPz()*GetPz());
193 }
194 else {fCalTrkTrackP = GetParticle()->P(); }
195 }
196
197 return fCalTrkTrackP;
198
199}
200
201//...........................................................................
202//***************************************************************************
203
204ClassImp(AliJetCalTrkEvent)
205
206 AliJetCalTrkEvent::AliJetCalTrkEvent():
207 TObject(),
208 fJetCalTrkTrack(0x0),
209 fJetCalTrkCell(0x0),
210 fNJetCalTrkTrack(0)
211{
212 // Default constructor
213}
214
215//----------------------------------------------------------------
216AliJetCalTrkEvent::AliJetCalTrkEvent(Short_t opt,Bool_t kine,Bool_t kIsHighMult):
217 TObject(),
218 fJetCalTrkTrack(0x0),
219 fJetCalTrkCell(0x0),
220 fNJetCalTrkTrack(0)
221{
222 // Constructor 2
223 if (kine==0) {
224 // Tracks (real or MC)
225 if(opt%2==!0 || opt==0){
226 fJetCalTrkTrack = new TClonesArray("AliJetCalTrkTrack", kIsHighMult*3800+200);
227 }
228 }
229 else { // Kine cases
230 fJetCalTrkTrack = new TClonesArray("AliJetCalTrkTrackKine", kIsHighMult*3800+200);
231 }
232
233}
234
235//----------------------------------------------------------------
236AliJetCalTrkEvent::~AliJetCalTrkEvent()
237{
238 // destructor
239 if (fJetCalTrkTrack) delete fJetCalTrkTrack;
240 if (fJetCalTrkCell) delete fJetCalTrkCell;
241
242}
243//----------------------------------------------------------------
244AliJetCalTrkEvent::AliJetCalTrkEvent(const AliJetCalTrkEvent& rCalTrkEvent):
245 TObject(),
246 fJetCalTrkTrack(rCalTrkEvent.fJetCalTrkTrack),
247 fJetCalTrkCell(rCalTrkEvent.fJetCalTrkCell),
248 fNJetCalTrkTrack(rCalTrkEvent.fNJetCalTrkTrack)
249{
250 // Copy constructor
251}
252
253//----------------------------------------------------------------
254AliJetCalTrkEvent& AliJetCalTrkEvent::operator=(const AliJetCalTrkEvent& rhs)
255{
256 // Assignment
257 if (this != &rhs) {
258 TObject::operator=(rhs);
259 if (fJetCalTrkTrack) delete fJetCalTrkTrack;
260 if (fJetCalTrkCell) delete fJetCalTrkCell;
261 fJetCalTrkTrack = rhs.fJetCalTrkTrack;
262 fJetCalTrkCell = rhs.fJetCalTrkCell;
263 fNJetCalTrkTrack = rhs.fNJetCalTrkTrack;
264 }
265
266 return *this;
267
268}
269
270//----------------------------------------------------------------
271AliJetCalTrkTrack* AliJetCalTrkEvent::AddCalTrkTrack(AliVTrack* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptCorr)
272{
273 // Add a track to the CalTrkEvent
274 TClonesArray &tJetCalTrkTrack = *fJetCalTrkTrack ;
275 AliJetCalTrkTrack *n = new(tJetCalTrkTrack[fNJetCalTrkTrack++]) AliJetCalTrkTrack(track, cutFlag, signalFlag, ptCorr) ;
276 return n ;
277
278}
279
280//----------------------------------------------------------------
281AliJetCalTrkTrack* AliJetCalTrkEvent::AddCalTrkTrack(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptCorr)
282{
283 // Add a track to the CalTrkEvent
284 TClonesArray &tJetCalTrkTrack = *fJetCalTrkTrack ;
285 AliJetCalTrkTrack *n = new(tJetCalTrkTrack[fNJetCalTrkTrack++]) AliJetCalTrkTrack(track, cutFlag, signalFlag, ptCorr) ;
286 return n ;
287
288}
289
290//_________________________________________________________________
291AliJetCalTrkTrackKine* AliJetCalTrkEvent::AddCalTrkTrackKine(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptReso)
292{
293 // Add a track to the CalTrkEvent
294 TClonesArray &tJetCalTrkTrack = *fJetCalTrkTrack ;
295 AliJetCalTrkTrackKine *n = new(tJetCalTrkTrack[fNJetCalTrkTrack++]) AliJetCalTrkTrackKine(track, cutFlag, signalFlag, ptReso) ;
296 return n ;
297
298}
299
300
301//----------------------------------------------------------------
302AliJetCalTrkTrack* AliJetCalTrkEvent::GetCalTrkTrack(Int_t i)
303{
304 // Get track i
305 return (AliJetCalTrkTrack*) fJetCalTrkTrack->At(i);
306
307}
308
309//-----------------------------------------------------------------
310void AliJetCalTrkEvent::Clear(Option_t* /*option*/)
311{
312 // Clear object
313
314 if(fJetCalTrkTrack) fJetCalTrkTrack->Clear("C"); // array of Tracks
315 fNJetCalTrkTrack = 0; // Number of tracks
316}
317
318//________________________________________________________________
319void AliJetCalTrkEvent::Print(const Option_t* /*option*/) const
320{
321 // prints event information
322 cout<< "Number of tracks:" << fNJetCalTrkTrack << endl;
323
324}