]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | ||
f531a546 | 16 | // $Id$ |
4c039060 | 17 | |
959fbac5 | 18 | /////////////////////////////////////////////////////////////////////////// |
19 | // Class AliJet | |
20 | // Creation and investigation of a jet of particle tracks. | |
21 | // An AliJet can be constructed by adding AliTracks. | |
22 | // | |
c1f25d1d | 23 | // To provide maximal flexibility to the user, two modes of track storage |
24 | // are provided by means of the memberfunction SetTrackCopy(). | |
25 | // | |
26 | // a) SetTrackCopy(0) (which is the default). | |
27 | // Only the pointers of the 'added' tracks are stored. | |
28 | // This mode is typically used by making jet studies based on a fixed list | |
29 | // of tracks which stays under user control or is contained for instance | |
30 | // in an AliEvent. | |
31 | // In this way the AliJet just represents a 'logical structure' for the | |
32 | // physics analysis which can be embedded in e.g. an AliEvent or AliVertex. | |
35044448 | 33 | // |
34 | // Note : | |
c1f25d1d | 35 | // Modifications made to the original tracks also affect the AliTrack objects |
36 | // which are stored in the AliJet. | |
35044448 | 37 | // |
c1f25d1d | 38 | // b) SetTrackCopy(1). |
39 | // Of every 'added' track a private copy will be made of which the pointer | |
40 | // will be stored. | |
41 | // In this way the AliJet represents an entity on its own and modifications | |
42 | // made to the original tracks do not affect the AliTrack objects which are | |
43 | // stored in the AliJet. | |
44 | // This mode will allow 'adding' many different AliTracks into an AliJet by | |
45 | // creating only one AliTrack instance in the main programme and using the | |
46 | // AliTrack::Reset() and AliTrack parameter setting memberfunctions. | |
47 | // | |
8e8e6c7f | 48 | // See also the documentation provided for the memberfunction SetOwner(). |
49 | // | |
959fbac5 | 50 | // Coding example to make 2 jets j1 and j2. |
51 | // ---------------------------------------- | |
c1f25d1d | 52 | // j1 contains the AliTracks t1 and t2 |
53 | // j2 contains 10 different AliTracks via tx | |
959fbac5 | 54 | // |
c1f25d1d | 55 | // AliTrack t1,t2; |
959fbac5 | 56 | // ... |
57 | // ... // code to fill the AliTrack data | |
58 | // ... | |
c1f25d1d | 59 | // AliJet j1(); |
f531a546 | 60 | // j1.AddTrack(t1); |
61 | // j1.AddTrack(t2); | |
c1f25d1d | 62 | // |
63 | // AliJet j2(); | |
64 | // j2.SetTrackCopy(1); | |
65 | // AliTrack* tx=new AliTrack(); | |
66 | // for (Int_t i=0; i<10; i++) | |
67 | // { | |
68 | // ... | |
69 | // ... // code to set momentum etc... of the track tx | |
70 | // ... | |
71 | // j2.AddTrack(tx); | |
72 | // tx->Reset(); | |
73 | // } | |
959fbac5 | 74 | // |
84bb7c66 | 75 | // j1.Data(); |
76 | // j2.Data("sph"); | |
959fbac5 | 77 | // |
78 | // Float_t e1=j1.GetEnergy(); | |
79 | // Float_t pnorm=j1->GetMomentum(); | |
80 | // Ali3Vector p=j1->Get3Momentum(); | |
81 | // Float_t m=j1.GetInvmass(); | |
82 | // Int_t ntk=j1.GetNtracks(); | |
83 | // AliTrack* tj=j1.GetTrack(1); | |
84 | // | |
c1f25d1d | 85 | // delete tx; |
86 | // | |
959fbac5 | 87 | // Note : All quantities are in GeV, GeV/c or GeV/c**2 |
88 | // | |
89 | //--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht | |
f531a546 | 90 | //- Modified: NvE $Date$ UU-SAP Utrecht |
959fbac5 | 91 | /////////////////////////////////////////////////////////////////////////// |
92 | ||
d88f97cc | 93 | #include "AliJet.h" |
c72198f1 | 94 | #include "Riostream.h" |
d88f97cc | 95 | |
96 | ClassImp(AliJet) // Class implementation to enable ROOT I/O | |
97 | ||
387a745b | 98 | AliJet::AliJet() : TNamed(),Ali4Vector() |
d88f97cc | 99 | { |
100 | // Default constructor | |
101 | // All variables initialised to 0 | |
102 | // Initial maximum number of tracks is set to the default value | |
6516b62d | 103 | Init(); |
104 | Reset(); | |
105 | SetNtinit(); | |
106 | } | |
107 | /////////////////////////////////////////////////////////////////////////// | |
108 | void AliJet::Init() | |
109 | { | |
110 | // Initialisation of pointers etc... | |
d88f97cc | 111 | fTracks=0; |
112 | fNtinit=0; | |
c1f25d1d | 113 | fTrackCopy=0; |
d88f97cc | 114 | } |
115 | /////////////////////////////////////////////////////////////////////////// | |
387a745b | 116 | AliJet::AliJet(Int_t n) : TNamed(),Ali4Vector() |
d88f97cc | 117 | { |
118 | // Create a jet to hold initially a maximum of n tracks | |
119 | // All variables initialised to 0 | |
6516b62d | 120 | Init(); |
d88f97cc | 121 | Reset(); |
122 | if (n > 0) | |
123 | { | |
124 | SetNtinit(n); | |
125 | } | |
126 | else | |
127 | { | |
128 | cout << endl; | |
129 | cout << " *AliJet* Initial max. number of tracks entered : " << n << endl; | |
130 | cout << " This is invalid. Default initial maximum will be used." << endl; | |
131 | cout << endl; | |
132 | SetNtinit(); | |
133 | } | |
134 | } | |
135 | /////////////////////////////////////////////////////////////////////////// | |
136 | AliJet::~AliJet() | |
137 | { | |
138 | // Default destructor | |
c1f25d1d | 139 | if (fTracks) |
140 | { | |
c1f25d1d | 141 | delete fTracks; |
142 | fTracks=0; | |
143 | } | |
d88f97cc | 144 | } |
145 | /////////////////////////////////////////////////////////////////////////// | |
8e8e6c7f | 146 | void AliJet::SetOwner(Bool_t own) |
147 | { | |
148 | // Set ownership of all added objects. | |
149 | // The default parameter is own=kTRUE. | |
150 | // | |
151 | // Invokation of this memberfunction also sets all the copy modes | |
152 | // (e.g. TrackCopy & co.) according to the value of own. | |
153 | // | |
154 | // This function (with own=kTRUE) is particularly useful when reading data | |
155 | // from a tree/file, since Reset() will then actually remove all the | |
156 | // added objects from memory irrespective of the copy mode settings | |
157 | // during the tree/file creation process. In this way it provides a nice way | |
158 | // of preventing possible memory leaks in the reading/analysis process. | |
159 | // | |
160 | // In addition this memberfunction can also be used as a shortcut to set all | |
161 | // copy modes in one go during a tree/file creation process. | |
162 | // However, in this case the user has to take care to only set/change the | |
163 | // ownership (and copy mode) for empty objects (e.g. newly created objects | |
164 | // or after invokation of the Reset() memberfunction) otherwise it will | |
165 | // very likely result in inconsistent destructor behaviour. | |
166 | ||
167 | Int_t mode=1; | |
168 | if (!own) mode=0; | |
169 | if (fTracks) fTracks->SetOwner(own); | |
170 | fTrackCopy=mode; | |
171 | } | |
172 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 173 | AliJet::AliJet(const AliJet& j) : TNamed(j),Ali4Vector(j) |
6516b62d | 174 | { |
175 | // Copy constructor | |
c72198f1 | 176 | fNtinit=j.fNtinit; |
177 | fNtmax=j.fNtmax; | |
178 | fQ=j.fQ; | |
179 | fNtrk=j.fNtrk; | |
180 | fTrackCopy=j.fTrackCopy; | |
181 | fUserId=j.fUserId; | |
182 | ||
183 | fTracks=0; | |
184 | if (fNtrk) | |
185 | { | |
186 | fTracks=new TObjArray(fNtmax); | |
187 | if (fTrackCopy) fTracks->SetOwner(); | |
188 | } | |
6516b62d | 189 | |
c72198f1 | 190 | for (Int_t i=1; i<=fNtrk; i++) |
6516b62d | 191 | { |
c72198f1 | 192 | AliTrack* tx=j.GetTrack(i); |
193 | if (fTrackCopy) | |
194 | { | |
5f25234b | 195 | fTracks->Add(tx->Clone()); |
c72198f1 | 196 | } |
197 | else | |
198 | { | |
199 | fTracks->Add(tx); | |
200 | } | |
6516b62d | 201 | } |
202 | } | |
203 | /////////////////////////////////////////////////////////////////////////// | |
d88f97cc | 204 | void AliJet::SetNtinit(Int_t n) |
205 | { | |
206 | // Set the initial maximum number of tracks for this jet | |
207 | fNtinit=n; | |
208 | fNtmax=n; | |
79830a7e | 209 | if (fTracks) |
c1f25d1d | 210 | { |
c1f25d1d | 211 | delete fTracks; |
212 | fTracks=0; | |
213 | } | |
d88f97cc | 214 | } |
215 | /////////////////////////////////////////////////////////////////////////// | |
216 | void AliJet::Reset() | |
217 | { | |
218 | // Reset all variables to 0 | |
219 | // The max. number of tracks is set to the initial value again | |
220 | fNtrk=0; | |
221 | fQ=0; | |
43bfa5be | 222 | fUserId=0; |
d88f97cc | 223 | Double_t a[4]={0,0,0,0}; |
224 | SetVector(a,"sph"); | |
225 | if (fNtinit > 0) SetNtinit(fNtinit); | |
226 | } | |
227 | /////////////////////////////////////////////////////////////////////////// | |
1fbffa23 | 228 | void AliJet::AddTrack(AliTrack& t) |
d88f97cc | 229 | { |
35044448 | 230 | // Add a track to the jet. |
d88f97cc | 231 | // In case the maximum number of tracks has been reached |
232 | // space will be extended to hold an additional amount of tracks as | |
35044448 | 233 | // was initially reserved. |
1fbffa23 | 234 | // See SetTrackCopy() to tailor the functionality of the stored structures. |
5f25234b | 235 | // |
236 | // Note : | |
237 | // In case a private copy is made, this is performed via the Clone() memberfunction. | |
238 | // All AliTrack and derived classes have the default TObject::Clone() memberfunction. | |
239 | // However, derived classes generally contain an internal data structure which may | |
240 | // include pointers to other objects. Therefore it is recommended to provide | |
241 | // for all derived classes a specific copy constructor and override the default Clone() | |
242 | // memberfunction using this copy constructor. | |
243 | // An example for this may be seen from AliTrack. | |
244 | ||
1fbffa23 | 245 | AddTrack(t,1); |
246 | } | |
247 | /////////////////////////////////////////////////////////////////////////// | |
248 | void AliJet::AddTrack(AliTrack& t,Int_t copy) | |
249 | { | |
250 | // Internal memberfunction to actually add a track to the jet. | |
251 | // In case the maximum number of tracks has been reached | |
252 | // space will be extended to hold an additional amount of tracks as | |
253 | // was initially reserved. | |
254 | // | |
255 | // If copy=0 NO copy of the track will be made, irrespective of the setting | |
256 | // of the TrackCopy flag. | |
257 | // This allows a proper treatment of automatically generated connecting | |
258 | // tracks between vertices. | |
5f25234b | 259 | // |
260 | // Note : | |
261 | // In case a private copy is made, this is performed via the Clone() memberfunction. | |
262 | ||
6516b62d | 263 | if (!fTracks) |
264 | { | |
265 | fTracks=new TObjArray(fNtmax); | |
266 | if (fTrackCopy) fTracks->SetOwner(); | |
267 | } | |
d88f97cc | 268 | if (fNtrk == fNtmax) // Check if maximum track number is reached |
269 | { | |
270 | fNtmax+=fNtinit; | |
271 | fTracks->Expand(fNtmax); | |
272 | } | |
273 | ||
274 | // Add the track to this jet | |
275 | fNtrk++; | |
6516b62d | 276 | if (fTrackCopy && copy) |
c1f25d1d | 277 | { |
5f25234b | 278 | fTracks->Add(t.Clone()); |
c1f25d1d | 279 | } |
280 | else | |
281 | { | |
282 | fTracks->Add(&t); | |
283 | } | |
35044448 | 284 | |
d88f97cc | 285 | (*this)+=(Ali4Vector&)t; |
286 | fQ+=t.GetCharge(); | |
35044448 | 287 | |
d88f97cc | 288 | } |
289 | /////////////////////////////////////////////////////////////////////////// | |
84bb7c66 | 290 | void AliJet::Data(TString f) |
d88f97cc | 291 | { |
292 | // Provide jet information within the coordinate frame f | |
5f25234b | 293 | const char* name=GetName(); |
294 | const char* title=GetTitle(); | |
295 | ||
296 | cout << " *AliJet::Data*"; | |
297 | if (strlen(name)) cout << " Name : " << GetName(); | |
298 | if (strlen(title)) cout << " Title : " << GetTitle(); | |
299 | cout << endl; | |
387a745b | 300 | cout << " Id : " << fUserId << " Invmass : " << GetInvmass() << " Charge : " << fQ |
d88f97cc | 301 | << " Momentum : " << GetMomentum() << " Ntracks : " << fNtrk << endl; |
c72198f1 | 302 | |
84bb7c66 | 303 | Ali4Vector::Data(f); |
d88f97cc | 304 | } |
305 | /////////////////////////////////////////////////////////////////////////// | |
306 | void AliJet::List(TString f) | |
307 | { | |
308 | // Provide jet and primary track information within the coordinate frame f | |
309 | ||
84bb7c66 | 310 | Data(f); // Information of the current jet |
d88f97cc | 311 | |
312 | // The tracks of this jet | |
313 | AliTrack* t; | |
314 | for (Int_t it=1; it<=fNtrk; it++) | |
315 | { | |
316 | t=GetTrack(it); | |
317 | if (t) | |
318 | { | |
319 | cout << " ---Track no. " << it << endl; | |
320 | cout << " "; | |
84bb7c66 | 321 | t->Data(f); |
d88f97cc | 322 | } |
323 | else | |
324 | { | |
325 | cout << " *AliJet::List* Error : No track present." << endl; | |
326 | } | |
327 | } | |
328 | } | |
329 | /////////////////////////////////////////////////////////////////////////// | |
330 | void AliJet::ListAll(TString f) | |
331 | { | |
332 | // Provide jet and prim.+sec. track information within the coordinate frame f | |
333 | ||
84bb7c66 | 334 | Data(f); // Information of the current jet |
d88f97cc | 335 | |
336 | // The tracks of this jet | |
337 | AliTrack* t; | |
338 | for (Int_t it=1; it<=fNtrk; it++) | |
339 | { | |
340 | t=GetTrack(it); | |
341 | if (t) | |
342 | { | |
343 | cout << " ---Track no. " << it << endl; | |
344 | cout << " "; | |
345 | t->ListAll(f); | |
346 | } | |
347 | else | |
348 | { | |
349 | cout << " *AliJet::List* Error : No track present." << endl; | |
350 | } | |
351 | } | |
352 | } | |
353 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 354 | Int_t AliJet::GetNtracks() const |
d88f97cc | 355 | { |
356 | // Return the current number of tracks of this jet | |
357 | return fNtrk; | |
358 | } | |
359 | /////////////////////////////////////////////////////////////////////////// | |
360 | Double_t AliJet::GetEnergy() | |
361 | { | |
362 | // Return the total energy of the jet | |
363 | return GetScalar(); | |
364 | } | |
365 | /////////////////////////////////////////////////////////////////////////// | |
366 | Double_t AliJet::GetMomentum() | |
367 | { | |
368 | // Return the value of the total jet 3-momentum | |
d071d629 | 369 | // The error can be obtained by invoking GetResultError() after |
370 | // invokation of GetMomentum(). | |
371 | Double_t norm=fV.GetNorm(); | |
372 | fDresult=fV.GetResultError(); | |
373 | return norm; | |
d88f97cc | 374 | } |
375 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 376 | Ali3Vector AliJet::Get3Momentum() const |
d88f97cc | 377 | { |
378 | // Return the the total jet 3-momentum | |
379 | Ali3Vector p=Get3Vector(); | |
380 | return p; | |
381 | } | |
382 | /////////////////////////////////////////////////////////////////////////// | |
383 | Double_t AliJet::GetInvmass() | |
384 | { | |
385 | // Return the invariant mass of the jet | |
386 | Double_t m2=Dot(*this); | |
387 | if (m2>0) | |
388 | { | |
389 | return sqrt(m2); | |
390 | } | |
391 | else | |
392 | { | |
393 | return 0; | |
394 | } | |
395 | } | |
396 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 397 | Float_t AliJet::GetCharge() const |
d88f97cc | 398 | { |
399 | // Return the total charge of the jet | |
400 | return fQ; | |
401 | } | |
402 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 403 | AliTrack* AliJet::GetTrack(Int_t i) const |
d88f97cc | 404 | { |
405 | // Return the i-th track of this jet | |
f34f4acb | 406 | if (!fTracks) |
407 | { | |
408 | cout << " *AliJet*::GetTrack* No tracks present." << endl; | |
409 | return 0; | |
410 | } | |
411 | else | |
412 | { | |
413 | if (i<=0 || i>fNtrk) | |
414 | { | |
415 | cout << " *AliJet*::GetTrack* Invalid argument i : " << i | |
416 | << " Ntrk = " << fNtrk << endl; | |
417 | return 0; | |
418 | } | |
419 | else | |
420 | { | |
421 | return (AliTrack*)fTracks->At(i-1); | |
422 | } | |
423 | } | |
d88f97cc | 424 | } |
425 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 426 | AliTrack* AliJet::GetIdTrack(Int_t id) const |
43bfa5be | 427 | { |
428 | // Return the track with user identifier "id" of this jet | |
429 | AliTrack* tx=0; | |
430 | AliTrack* t=0; | |
431 | if (!fTracks) | |
432 | { | |
433 | cout << " *AliJet*::GetIdTrack* No tracks present." << endl; | |
434 | return 0; | |
435 | } | |
436 | else | |
437 | { | |
438 | for (Int_t i=0; i<fNtrk; i++) | |
439 | { | |
440 | tx=(AliTrack*)fTracks->At(i); | |
441 | if (id == tx->GetId()) t=tx; | |
442 | } | |
443 | return t; | |
444 | } | |
445 | } | |
446 | /////////////////////////////////////////////////////////////////////////// | |
d071d629 | 447 | Double_t AliJet::GetPt() |
448 | { | |
449 | // Provide trans. momentum value w.r.t. z-axis. | |
450 | // The error on the value can be obtained by GetResultError() | |
451 | // after invokation of GetPt(). | |
452 | Ali3Vector v; | |
453 | v=GetVecTrans(); | |
454 | Double_t norm=v.GetNorm(); | |
455 | fDresult=v.GetResultError(); | |
456 | ||
457 | return norm; | |
458 | } | |
459 | /////////////////////////////////////////////////////////////////////////// | |
460 | Double_t AliJet::GetPl() | |
461 | { | |
462 | // Provide long. momentum value w.r.t. z-axis. | |
8adaf597 | 463 | // Note : the returned value can also be negative. |
d071d629 | 464 | // The error on the value can be obtained by GetResultError() |
465 | // after invokation of GetPl(). | |
466 | Ali3Vector v; | |
467 | v=GetVecLong(); | |
8adaf597 | 468 | |
469 | Double_t pl=v.GetNorm(); | |
d071d629 | 470 | fDresult=v.GetResultError(); |
471 | ||
8adaf597 | 472 | Double_t a[3]; |
473 | v.GetVector(a,"sph"); | |
474 | if (cos(a[1])<0) pl=-pl; | |
475 | ||
476 | return pl; | |
d071d629 | 477 | } |
478 | /////////////////////////////////////////////////////////////////////////// | |
479 | Double_t AliJet::GetEt() | |
480 | { | |
481 | // Provide trans. energy value w.r.t. z-axis. | |
482 | // The error on the value can be obtained by GetResultError() | |
483 | // after invokation of GetEt(). | |
484 | Double_t et=GetScaTrans(); | |
485 | ||
486 | return et; | |
487 | } | |
488 | /////////////////////////////////////////////////////////////////////////// | |
489 | Double_t AliJet::GetEl() | |
490 | { | |
491 | // Provide long. energy value w.r.t. z-axis. | |
8adaf597 | 492 | // Note : the returned value can also be negative. |
d071d629 | 493 | // The error on the value can be obtained by GetResultError() |
494 | // after invokation of GetEl(). | |
495 | Double_t el=GetScaLong(); | |
496 | ||
497 | return el; | |
498 | } | |
499 | /////////////////////////////////////////////////////////////////////////// | |
500 | Double_t AliJet::GetMt() | |
501 | { | |
502 | // Provide transverse mass value w.r.t. z-axis. | |
503 | // The error on the value can be obtained by GetResultError() | |
504 | // after invokation of GetMt(). | |
505 | Double_t pt=GetPt(); | |
506 | Double_t dpt=GetResultError(); | |
507 | Double_t m=GetInvmass(); | |
508 | Double_t dm=GetResultError(); | |
509 | ||
510 | Double_t mt=sqrt(pt*pt+m*m); | |
511 | Double_t dmt2=0; | |
512 | if (mt) dmt2=(pow((pt*dpt),2)+pow((m*dm),2))/(mt*mt); | |
513 | ||
514 | fDresult=sqrt(dmt2); | |
515 | return mt; | |
516 | } | |
517 | /////////////////////////////////////////////////////////////////////////// | |
8adaf597 | 518 | Double_t AliJet::GetRapidity() |
519 | { | |
520 | // Provide rapidity value w.r.t. z-axis. | |
521 | // The error on the value can be obtained by GetResultError() | |
522 | // after invokation of GetRapidity(). | |
523 | // Note : Also GetPseudoRapidity() is available since this class is | |
524 | // derived from Ali4Vector. | |
525 | Double_t e=GetEnergy(); | |
526 | Double_t de=GetResultError(); | |
527 | Double_t pl=GetPl(); | |
528 | Double_t dpl=GetResultError(); | |
529 | Double_t sum=e+pl; | |
530 | Double_t dif=e-pl; | |
531 | ||
532 | Double_t y=9999,dy2=0; | |
533 | if (sum && dif) y=0.5*log(sum/dif); | |
534 | ||
535 | if (sum*dif) dy2=(1./(sum*dif))*(pow((pl*de),2)+pow((e*dpl),2)); | |
536 | ||
537 | fDresult=sqrt(dy2); | |
538 | return y; | |
539 | } | |
540 | /////////////////////////////////////////////////////////////////////////// | |
c1f25d1d | 541 | void AliJet::SetTrackCopy(Int_t j) |
542 | { | |
543 | // (De)activate the creation of private copies of the added tracks. | |
544 | // j=0 ==> No private copies are made; pointers of original tracks are stored. | |
545 | // j=1 ==> Private copies of the tracks are made and these pointers are stored. | |
546 | // | |
547 | // Note : Once the storage contains pointer(s) to AliTrack(s) one cannot | |
548 | // change the TrackCopy mode anymore. | |
549 | // To change the TrackCopy mode for an existing AliJet containing | |
550 | // tracks one first has to invoke Reset(). | |
551 | if (!fTracks) | |
552 | { | |
553 | if (j==0 || j==1) | |
554 | { | |
555 | fTrackCopy=j; | |
556 | } | |
557 | else | |
558 | { | |
559 | cout << "*AliJet::SetTrackCopy* Invalid argument : " << j << endl; | |
560 | } | |
561 | } | |
562 | else | |
563 | { | |
564 | cout << "*AliJet::SetTrackCopy* Storage already contained tracks." | |
565 | << " ==> TrackCopy mode not changed." << endl; | |
566 | } | |
567 | } | |
568 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 569 | Int_t AliJet::GetTrackCopy() const |
c1f25d1d | 570 | { |
571 | // Provide value of the TrackCopy mode. | |
572 | // 0 ==> No private copies are made; pointers of original tracks are stored. | |
573 | // 1 ==> Private copies of the tracks are made and these pointers are stored. | |
574 | return fTrackCopy; | |
575 | } | |
576 | /////////////////////////////////////////////////////////////////////////// | |
43bfa5be | 577 | void AliJet::SetId(Int_t id) |
578 | { | |
579 | // Set a user defined identifier for this jet. | |
580 | fUserId=id; | |
581 | } | |
582 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 583 | Int_t AliJet::GetId() const |
43bfa5be | 584 | { |
585 | // Provide the user defined identifier of this jet. | |
586 | return fUserId; | |
587 | } | |
588 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 589 | TObject* AliJet::Clone(const char* name) const |
5f25234b | 590 | { |
591 | // Make a deep copy of the current object and provide the pointer to the copy. | |
592 | // This memberfunction enables automatic creation of new objects of the | |
593 | // correct type depending on the object type, a feature which may be very useful | |
594 | // for containers when adding objects in case the container owns the objects. | |
595 | // This feature allows e.g. AliVertex to store either AliJet objects or | |
596 | // objects derived from AliJet via the AddJet memberfunction, provided | |
597 | // these derived classes also have a proper Clone memberfunction. | |
598 | ||
599 | AliJet* jet=new AliJet(*this); | |
600 | if (name) | |
601 | { | |
602 | if (strlen(name)) jet->SetName(name); | |
603 | } | |
604 | return jet; | |
605 | } | |
606 | /////////////////////////////////////////////////////////////////////////// |