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