adding JETAN and FASTJETAN development libs for new i/o of tracks/particles for the...
[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//-----------------------------------------------------------------------
102void AliJetCalTrkTrack::Print(const Option_t* option)
103{
104 cout << "Track: " << option << ", Pt: " << GetPt() << ", Eta: " << GetEta() << ", Phi: " << GetPhi() << endl;
105}
106
107//...........................................................................
108//***************************************************************************
109ClassImp(AliJetCalTrkTrackKine)
110
111 AliJetCalTrkTrackKine::AliJetCalTrkTrackKine():
112 AliJetCalTrkTrack(),
113 fCalTrkPtReso(1.),
114 fCalTrkTrackE(-999.),
115 fCalTrkTrackPt(-999.),
116 fCalTrkTrackP(-999.)
117{
118 // Default constructor
119}
120
121//------------------------------------------------------------------------
122AliJetCalTrkTrackKine::AliJetCalTrkTrackKine(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptReso) :
123 AliJetCalTrkTrack(track,cutFlag,signalFlag),
124 fCalTrkPtReso(ptReso),
125 fCalTrkTrackE(-999.),
126 fCalTrkTrackPt(-999.),
127 fCalTrkTrackP(-999.)
128{
129 // Constructor 2
130}
131
132//------------------------------------------------------------------------
133void AliJetCalTrkTrackKine::Clear(Option_t* option)
134{
135 // Clear objects
136 fCalTrkPtReso = 1.;
137 fCalTrkTrackE = -999;
138 fCalTrkTrackPt = -999;
139 fCalTrkTrackP = -999;
140 AliJetCalTrkTrack::Clear(option);
141
142}
143
144//------------------------------------------------------------------------
145Float_t AliJetCalTrkTrackKine::GetE()
146{
147 // Particle energy
148 if(fCalTrkTrackE==-999){
149 if ( fCalTrkPtReso != 1 ){
150 fCalTrkTrackE = TMath::Sqrt(GetPx()*GetPx()+GetPy()*GetPy()+GetPz()*GetPz()+GetM()*GetM());
151 }
152 else {fCalTrkTrackE = GetParticle()->E(); }
153 }
154
155 return fCalTrkTrackE;
156
157}
158
159//------------------------------------------------------------------------
160Float_t AliJetCalTrkTrackKine::GetPt()
161{
162 // Particle transverse momentum
163 if(fCalTrkTrackPt==-999){
164 if ( fCalTrkPtReso != 1 ){
165 fCalTrkTrackPt = TMath::Sqrt(GetPx()*GetPx()+GetPy()*GetPy());
166 }
167 else {fCalTrkTrackPt = GetParticle()->Pt();}
168 }
169
170 return fCalTrkTrackPt;
171
172}
173
174//------------------------------------------------------------------------
175Float_t AliJetCalTrkTrackKine::GetP()
176{
177 // Particle momentum
178 if(fCalTrkTrackP==-999){
179 if ( fCalTrkPtReso != 1 ){
180 fCalTrkTrackP = TMath::Sqrt(GetPx()*GetPx()+GetPy()*GetPy()+GetPz()*GetPz());
181 }
182 else {fCalTrkTrackP = GetParticle()->P(); }
183 }
184
185 return fCalTrkTrackP;
186
187}
188
189//...........................................................................
190//***************************************************************************
191
192ClassImp(AliJetCalTrkEvent)
193
194 AliJetCalTrkEvent::AliJetCalTrkEvent():
195 TObject(),
196 fJetCalTrkTrack(0x0),
197 fJetCalTrkCell(0x0),
198 fNJetCalTrkTrack(0)
199{
200 // Default constructor
201}
202
203//----------------------------------------------------------------
204AliJetCalTrkEvent::AliJetCalTrkEvent(Short_t opt,Bool_t kine,Bool_t kIsHighMult):
205 TObject(),
206 fJetCalTrkTrack(0x0),
207 fJetCalTrkCell(0x0),
208 fNJetCalTrkTrack(0)
209{
210 // Constructor 2
211 if (kine==0) {
212 // Tracks (real or MC)
213 if(opt%2==!0 || opt==0){
214 fJetCalTrkTrack = new TClonesArray("AliJetCalTrkTrack", kIsHighMult*3800+200);
215 }
216 }
217 else { // Kine cases
218 fJetCalTrkTrack = new TClonesArray("AliJetCalTrkTrackKine", kIsHighMult*3800+200);
219 }
220
221}
222
223//----------------------------------------------------------------
224AliJetCalTrkEvent::~AliJetCalTrkEvent()
225{
226 // destructor
227 if (fJetCalTrkTrack) delete fJetCalTrkTrack;
228 if (fJetCalTrkCell) delete fJetCalTrkCell;
229
230}
231//----------------------------------------------------------------
232AliJetCalTrkEvent::AliJetCalTrkEvent(const AliJetCalTrkEvent& rCalTrkEvent):
233 TObject(),
234 fJetCalTrkTrack(rCalTrkEvent.fJetCalTrkTrack),
235 fJetCalTrkCell(rCalTrkEvent.fJetCalTrkCell),
236 fNJetCalTrkTrack(rCalTrkEvent.fNJetCalTrkTrack)
237{
238 // Copy constructor
239}
240
241//----------------------------------------------------------------
242AliJetCalTrkEvent& AliJetCalTrkEvent::operator=(const AliJetCalTrkEvent& rhs)
243{
244 // Assignment
245 if (this != &rhs) {
246 TObject::operator=(rhs);
247 if (fJetCalTrkTrack) delete fJetCalTrkTrack;
248 if (fJetCalTrkCell) delete fJetCalTrkCell;
249 fJetCalTrkTrack = rhs.fJetCalTrkTrack;
250 fJetCalTrkCell = rhs.fJetCalTrkCell;
251 fNJetCalTrkTrack = rhs.fNJetCalTrkTrack;
252 }
253
254 return *this;
255
256}
257
258//----------------------------------------------------------------
259AliJetCalTrkTrack* AliJetCalTrkEvent::AddCalTrkTrack(AliVTrack* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptCorr)
260{
261 // Add a track to the CalTrkEvent
262 TClonesArray &tJetCalTrkTrack = *fJetCalTrkTrack ;
263 AliJetCalTrkTrack *n = new(tJetCalTrkTrack[fNJetCalTrkTrack++]) AliJetCalTrkTrack(track, cutFlag, signalFlag, ptCorr) ;
264 return n ;
265
266}
267
268//----------------------------------------------------------------
269AliJetCalTrkTrack* AliJetCalTrkEvent::AddCalTrkTrack(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptCorr)
270{
271 // Add a track to the CalTrkEvent
272 TClonesArray &tJetCalTrkTrack = *fJetCalTrkTrack ;
273 AliJetCalTrkTrack *n = new(tJetCalTrkTrack[fNJetCalTrkTrack++]) AliJetCalTrkTrack(track, cutFlag, signalFlag, ptCorr) ;
274 return n ;
275
276}
277
278//_________________________________________________________________
279AliJetCalTrkTrackKine* AliJetCalTrkEvent::AddCalTrkTrackKine(AliVParticle* track, Bool_t cutFlag, Bool_t signalFlag, Float_t ptReso)
280{
281 // Add a track to the CalTrkEvent
282 TClonesArray &tJetCalTrkTrack = *fJetCalTrkTrack ;
283 AliJetCalTrkTrackKine *n = new(tJetCalTrkTrack[fNJetCalTrkTrack++]) AliJetCalTrkTrackKine(track, cutFlag, signalFlag, ptReso) ;
284 return n ;
285
286}
287
288
289//----------------------------------------------------------------
290AliJetCalTrkTrack* AliJetCalTrkEvent::GetCalTrkTrack(Int_t i)
291{
292 // Get track i
293 return (AliJetCalTrkTrack*) fJetCalTrkTrack->At(i);
294
295}
296
297//-----------------------------------------------------------------
298void AliJetCalTrkEvent::Clear(Option_t* /*option*/)
299{
300 // Clear object
301
302 if(fJetCalTrkTrack) fJetCalTrkTrack->Clear("C"); // array of Tracks
303 fNJetCalTrkTrack = 0; // Number of tracks
304}
305
306//________________________________________________________________
307void AliJetCalTrkEvent::Print(const Option_t* /*option*/) const
308{
309 // prints event information
310 cout<< "Number of tracks:" << fNJetCalTrkTrack << endl;
311
312}