]>
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 AliVertex | |
20 | // Creation and investigation of an AliVertex. | |
21 | // An AliVertex can be constructed by adding AliTracks and/or AliJets. | |
22 | // | |
23 | // Note : Also (secondary) vertices can be added to a vertex. | |
24 | // | |
f34f4acb | 25 | // To provide maximal flexibility to the user, two modes of vertex storage |
26 | // are provided by means of the memberfunction SetVertexCopy(). | |
27 | // The same holds for the storage of jets via SetJetCopy(). | |
28 | // | |
29 | // a) SetVertexCopy(0) (which is the default). | |
30 | // Only the pointers of the 'added' vertices are stored. | |
31 | // This mode is typically used by making vertex studies based on a fixed list | |
32 | // of vertices which stays under user control or is contained for instance | |
33 | // in an AliEvent. | |
34 | // In this way the AliVertex just represents a 'logical structure' for the | |
35 | // physics analysis which can be embedded in e.g. an AliEvent or AliVertex. | |
35044448 | 36 | // |
37 | // Note : | |
f34f4acb | 38 | // Modifications made to the original vertices also affect the AliVertex objects |
35044448 | 39 | // which are stored. |
40 | // | |
f34f4acb | 41 | // b) SetVertexCopy(1). |
42 | // Of every 'added' vertex a private copy will be made of which the pointer | |
43 | // will be stored. | |
44 | // In this way the AliVertex represents an entity on its own and modifications | |
45 | // made to the original vertices do not affect the AliVertex objects which are | |
46 | // stored. | |
47 | // This mode will allow 'adding' many different AliVertex objects by | |
48 | // creating only one AliVertex instance in the main programme and using the | |
35044448 | 49 | // AliVertex::Reset, AliVertex::AddTrack and parameter setting memberfunctions. |
f34f4acb | 50 | // |
8e8e6c7f | 51 | // See also the documentation provided for the memberfunction SetOwner(). |
52 | // | |
959fbac5 | 53 | // Coding example to make 3 vertices v1, v2 and v3. |
54 | // ------------------------------------------------ | |
55 | // v1 contains the tracks 1,2,3 and 4 | |
f34f4acb | 56 | // v2 contains many different tracks |
959fbac5 | 57 | // v3 contains the jets 1 and 2 |
58 | // | |
f34f4acb | 59 | // AliTrack t1,t2,t3,t4; |
959fbac5 | 60 | // ... |
61 | // ... // code to fill the track data | |
62 | // ... | |
63 | // | |
64 | // AliJet j1,j2; | |
65 | // ... | |
66 | // ... // code to fill the jet data | |
67 | // ... | |
68 | // | |
f34f4acb | 69 | // AliVertex v1; |
70 | // v1.SetVertexCopy(1); | |
959fbac5 | 71 | // |
f531a546 | 72 | // v1.AddTrack(t1); |
73 | // v1.AddTrack(t2); | |
74 | // v1.AddTrack(t3); | |
75 | // v1.AddTrack(t4); | |
959fbac5 | 76 | // |
77 | // Float_t r1[3]={2.4,0.1,-8.5}; | |
78 | // v1.SetPosition(r1,"car"); | |
79 | // | |
f34f4acb | 80 | // AliVertex v2; |
81 | // v2.SetTrackCopy(1); | |
82 | // | |
83 | // AliTrack* tx=new AliTrack(); | |
84 | // for (Int_t i=0; i<10; i++) | |
85 | // { | |
86 | // ... | |
87 | // ... // code to fill the track data | |
88 | // ... | |
89 | // v2.AddTrack(tx); | |
90 | // tx->Reset(); | |
91 | // } | |
959fbac5 | 92 | // |
93 | // Float_t r2[3]={1.6,-3.2,5.7}; | |
94 | // v2.SetPosition(r2,"car"); | |
95 | // | |
96 | // AliVertex v3; | |
97 | // | |
f531a546 | 98 | // v3.AddJet(j1); |
99 | // v3.AddJet(j2); | |
959fbac5 | 100 | // |
101 | // Float_t r3[3]={6.2,4.8,1.3}; | |
102 | // v3.SetPosition(r3,"car"); | |
103 | // | |
84bb7c66 | 104 | // v1.Data("sph"); |
959fbac5 | 105 | // v2.ListAll(); |
106 | // v3.List("cyl"); | |
107 | // | |
108 | // Float_t e1=v1.GetEnergy(); | |
109 | // Ali3Vector p1=v1.Get3Momentum(); | |
110 | // Float_t loc[3]; | |
111 | // v1.GetPosition(loc,"sph"); | |
112 | // AliPosition r=v2.GetPosition(); | |
84bb7c66 | 113 | // r.Data(); |
959fbac5 | 114 | // Int_t nt=v2.GetNtracks(); |
115 | // AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2 | |
116 | // | |
117 | // Specify the vertices v2 and v3 as secondary vertices of v1 | |
118 | // | |
f531a546 | 119 | // v1.AddVertex(v2); |
120 | // v1.AddVertex(v3); | |
959fbac5 | 121 | // |
122 | // v1.List(); | |
123 | // | |
124 | // Int_t nv=v1.GetNvtx(); | |
125 | // AliVertex* vx=v1.GetVertex(1); // Access 1st secondary vertex of v1 | |
126 | // Float_t e=vx->GetEnergy(); | |
127 | // | |
128 | // Float_t M=v1.GetInvmass(); | |
129 | // | |
130 | // Reconstruct Vertex v1 from scratch | |
131 | // | |
132 | // v1.Reset(); | |
133 | // v1.SetNvmax(25); // Increase initial no. of sec. vertices | |
f531a546 | 134 | // v1.AddTrack(t3); |
f34f4acb | 135 | // v1.AddTrack(t4); |
f531a546 | 136 | // v1.AddJet(j2); |
959fbac5 | 137 | // Float_t pos[3]={7,9,4}; |
138 | // v1.SetPosition(pos,"car"); | |
139 | // | |
25eefd00 | 140 | // Note : By default all quantities are in meter, GeV, GeV/c or GeV/c**2 |
141 | // but the user can indicate the usage of a different scale for | |
142 | // the metric and/or energy-momentum units via the SetUnitScale() | |
143 | // and SetEscale() memberfunctions, respectively. | |
144 | // The actual metric and energy-momentum unit scales in use can be | |
145 | // obtained via the GetUnitScale() and GetEscale() memberfunctions. | |
959fbac5 | 146 | // |
147 | //--- Author: Nick van Eijndhoven 04-apr-1998 UU-SAP Utrecht | |
f531a546 | 148 | //- Modified: NvE $Date$ UU-SAP Utrecht |
959fbac5 | 149 | /////////////////////////////////////////////////////////////////////////// |
150 | ||
d88f97cc | 151 | #include "AliVertex.h" |
c72198f1 | 152 | #include "Riostream.h" |
d88f97cc | 153 | |
154 | ClassImp(AliVertex) // Class implementation to enable ROOT I/O | |
155 | ||
c72198f1 | 156 | AliVertex::AliVertex() : AliJet(),AliPosition() |
d88f97cc | 157 | { |
959fbac5 | 158 | // Default constructor. |
159 | // All variables initialised to 0. | |
160 | // Initial maximum number of tracks is set to the default value. | |
161 | // Initial maximum number of sec. vertices is set to the default value. | |
6516b62d | 162 | Init(); |
d88f97cc | 163 | Reset(); |
d88f97cc | 164 | SetNvmax(); |
f34f4acb | 165 | SetNjmax(); |
d88f97cc | 166 | } |
167 | /////////////////////////////////////////////////////////////////////////// | |
6516b62d | 168 | void AliVertex::Init() |
d88f97cc | 169 | { |
6516b62d | 170 | // Initialisation of pointers etc... |
d88f97cc | 171 | fNvmax=0; |
172 | fVertices=0; | |
29beb80d | 173 | fConnects=0; |
f34f4acb | 174 | fVertexCopy=0; |
175 | fNjmax=0; | |
176 | fJets=0; | |
6516b62d | 177 | fJetTracks=0; |
f34f4acb | 178 | fJetCopy=0; |
a37bb40e | 179 | fLines=0; |
6516b62d | 180 | } |
181 | /////////////////////////////////////////////////////////////////////////// | |
c72198f1 | 182 | AliVertex::AliVertex(Int_t n) : AliJet(n),AliPosition() |
6516b62d | 183 | { |
184 | // Create a vertex to hold initially a maximum of n tracks | |
185 | // All variables initialised to 0 | |
c72198f1 | 186 | if (n<=0) |
d88f97cc | 187 | { |
c72198f1 | 188 | cout << " *** This AliJet initialisation was invoked via the AliVertex ctor." << endl; |
d88f97cc | 189 | } |
c72198f1 | 190 | Init(); |
191 | Reset(); | |
d88f97cc | 192 | SetNvmax(); |
f34f4acb | 193 | SetNjmax(); |
d88f97cc | 194 | } |
195 | /////////////////////////////////////////////////////////////////////////// | |
196 | AliVertex::~AliVertex() | |
197 | { | |
198 | // Default destructor | |
f34f4acb | 199 | if (fVertices) |
200 | { | |
f34f4acb | 201 | delete fVertices; |
202 | fVertices=0; | |
203 | } | |
29beb80d | 204 | if (fConnects) |
205 | { | |
29beb80d | 206 | delete fConnects; |
207 | fConnects=0; | |
208 | } | |
f34f4acb | 209 | if (fJets) |
210 | { | |
f34f4acb | 211 | delete fJets; |
212 | fJets=0; | |
213 | } | |
6516b62d | 214 | if (fJetTracks) |
215 | { | |
216 | delete fJetTracks; | |
217 | fJetTracks=0; | |
218 | } | |
a37bb40e | 219 | if (fLines) |
220 | { | |
221 | delete fLines; | |
222 | fLines=0; | |
223 | } | |
6516b62d | 224 | } |
225 | /////////////////////////////////////////////////////////////////////////// | |
8e8e6c7f | 226 | void AliVertex::SetOwner(Bool_t own) |
227 | { | |
228 | // Set ownership of all added objects. | |
229 | // The default parameter is own=kTRUE. | |
230 | // | |
231 | // Invokation of this memberfunction also sets all the copy modes | |
232 | // (e.g. TrackCopy & co.) according to the value of own. | |
233 | // | |
234 | // This function (with own=kTRUE) is particularly useful when reading data | |
235 | // from a tree/file, since Reset() will then actually remove all the | |
236 | // added objects from memory irrespective of the copy mode settings | |
237 | // during the tree/file creation process. In this way it provides a nice way | |
238 | // of preventing possible memory leaks in the reading/analysis process. | |
239 | // | |
240 | // In addition this memberfunction can also be used as a shortcut to set all | |
241 | // copy modes in one go during a tree/file creation process. | |
242 | // However, in this case the user has to take care to only set/change the | |
243 | // ownership (and copy mode) for empty objects (e.g. newly created objects | |
244 | // or after invokation of the Reset() memberfunction) otherwise it will | |
245 | // very likely result in inconsistent destructor behaviour. | |
246 | ||
247 | Int_t mode=1; | |
248 | if (!own) mode=0; | |
249 | if (fVertices) fVertices->SetOwner(own); | |
250 | fVertexCopy=mode; | |
251 | if (fJets) fJets->SetOwner(own); | |
252 | fJetCopy=mode; | |
253 | ||
254 | AliJet::SetOwner(own); | |
255 | } | |
256 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 257 | AliVertex::AliVertex(const AliVertex& v) : AliJet(v.fNtinit),AliPosition(v) |
6516b62d | 258 | { |
259 | // Copy constructor | |
260 | Init(); | |
c72198f1 | 261 | fNvtx=0; |
262 | fNjets=0; | |
263 | SetNvmax(v.fNvmax); | |
264 | SetNjmax(v.fNjmax); | |
6516b62d | 265 | SetTrackCopy(v.GetTrackCopy()); |
266 | SetVertexCopy(v.GetVertexCopy()); | |
267 | SetJetCopy(v.GetJetCopy()); | |
268 | SetId(v.GetId()); | |
6516b62d | 269 | |
270 | // Copy all tracks except the ones coming from jets | |
271 | AliTrack* tx=0; | |
272 | Int_t jetflag=0,connect=0; | |
273 | AliTrack* tx2=0; | |
325b076c | 274 | for (Int_t it=1; it<=v.fNtrk; it++) |
6516b62d | 275 | { |
276 | tx=v.GetTrack(it); | |
277 | if (tx) | |
278 | { | |
279 | jetflag=v.IsJetTrack(tx); | |
280 | connect=v.IsConnectTrack(tx); | |
281 | ||
282 | if (!jetflag && !connect) AddTrack(tx); | |
283 | ||
284 | if (connect) | |
285 | { | |
286 | if (!fConnects) | |
287 | { | |
288 | fConnects=new TObjArray(fNvmax); | |
289 | if (!fTrackCopy) fConnects->SetOwner(); | |
290 | } | |
291 | tx2=new AliTrack(*tx); | |
292 | fConnects->Add(tx2); | |
293 | AddTrack(tx2,0); | |
294 | } | |
295 | } | |
296 | } | |
297 | ||
298 | // Copy all the (secondary) vertices without re-creating connecting tracks | |
299 | // The connecting tracks have already been copied above | |
300 | AliVertex* vx=0; | |
301 | for (Int_t iv=1; iv<=v.GetNvertices(); iv++) | |
302 | { | |
303 | vx=v.GetVertex(iv); | |
304 | if (vx) AddVertex(vx,0); | |
305 | } | |
306 | ||
307 | // Copy all the jets including the jet tracks for these jets for which | |
308 | // this was also the case in the original vertex | |
309 | AliJet* jx=0; | |
310 | for (Int_t ij=1; ij<=v.GetNjets(); ij++) | |
311 | { | |
312 | jx=v.GetJet(ij); | |
313 | if (jx) | |
314 | { | |
315 | jetflag=0; | |
316 | if (jx->GetNtracks()) | |
317 | { | |
318 | tx=jx->GetTrack(1); | |
319 | if (tx) | |
320 | { | |
321 | jetflag=v.IsJetTrack(tx); | |
322 | } | |
323 | } | |
324 | AddJet(jx,jetflag); | |
325 | } | |
326 | } | |
d88f97cc | 327 | } |
328 | /////////////////////////////////////////////////////////////////////////// | |
329 | void AliVertex::SetNvmax(Int_t n) | |
330 | { | |
331 | // Set the initial maximum number of (secondary) vertices | |
332 | if (n > 0) | |
333 | { | |
334 | fNvmax=n; | |
335 | } | |
336 | else | |
337 | { | |
338 | fNvmax=1; | |
339 | } | |
f34f4acb | 340 | if (fVertices) |
341 | { | |
f34f4acb | 342 | delete fVertices; |
343 | fVertices=0; | |
344 | } | |
345 | } | |
346 | /////////////////////////////////////////////////////////////////////////// | |
347 | void AliVertex::SetNjmax(Int_t n) | |
348 | { | |
349 | // Set the initial maximum number of jets | |
350 | if (n > 0) | |
351 | { | |
352 | fNjmax=n; | |
353 | } | |
354 | else | |
355 | { | |
356 | fNjmax=1; | |
357 | } | |
358 | if (fJets) | |
359 | { | |
f34f4acb | 360 | delete fJets; |
361 | fJets=0; | |
362 | } | |
d88f97cc | 363 | } |
364 | /////////////////////////////////////////////////////////////////////////// | |
365 | void AliVertex::Reset() | |
366 | { | |
7849a8ab | 367 | // Reset all variables to 0 and reset all stored vertex and jet lists. |
d88f97cc | 368 | // The max. number of tracks is set to the initial value again |
369 | // The max. number of vertices is set to the default value again | |
7849a8ab | 370 | // The max. number of jets is set to the default value again |
d88f97cc | 371 | |
372 | AliJet::Reset(); | |
373 | ||
f531a546 | 374 | Double_t a[3]={0,0,0}; |
375 | SetPosition(a,"sph"); | |
376 | SetPositionErrors(a,"car"); | |
377 | ||
d88f97cc | 378 | fNvtx=0; |
379 | if (fNvmax>0) SetNvmax(fNvmax); | |
29beb80d | 380 | if (fConnects) |
381 | { | |
29beb80d | 382 | delete fConnects; |
383 | fConnects=0; | |
384 | } | |
f34f4acb | 385 | |
386 | fNjets=0; | |
387 | if (fNjmax>0) SetNjmax(fNjmax); | |
6516b62d | 388 | if (fJetTracks) |
389 | { | |
390 | delete fJetTracks; | |
391 | fJetTracks=0; | |
392 | } | |
a37bb40e | 393 | |
394 | if (fLines) | |
395 | { | |
396 | delete fLines; | |
397 | fLines=0; | |
398 | } | |
d88f97cc | 399 | } |
400 | /////////////////////////////////////////////////////////////////////////// | |
7849a8ab | 401 | void AliVertex::ResetVertices() |
402 | { | |
403 | // Reset the stored vertex list and delete all connecting tracks which | |
404 | // were generated automatically via connect=1 in AddVertex(). | |
405 | // The max. number of vertices is set to the default value again. | |
35044448 | 406 | // All physics quantities are updated according to the removal of the |
407 | // connecting tracks. | |
7849a8ab | 408 | AliTrack* t; |
409 | if (fConnects) | |
410 | { | |
411 | for (Int_t i=0; i<=fConnects->GetLast(); i++) | |
412 | { | |
413 | t=(AliTrack*)fConnects->At(i); | |
414 | AliTrack* test=(AliTrack*)fTracks->Remove(t); | |
35044448 | 415 | if (test) |
416 | { | |
417 | fNtrk--; | |
418 | (Ali4Vector&)(*this)-=(Ali4Vector&)(*t); | |
419 | fQ-=t->GetCharge(); | |
6516b62d | 420 | if (fTrackCopy) delete t; |
35044448 | 421 | } |
7849a8ab | 422 | } |
423 | fTracks->Compress(); | |
424 | } | |
425 | ||
7849a8ab | 426 | fNvtx=0; |
427 | if (fNvmax>0) SetNvmax(fNvmax); | |
428 | if (fConnects) | |
429 | { | |
7849a8ab | 430 | delete fConnects; |
431 | fConnects=0; | |
432 | } | |
433 | } | |
434 | /////////////////////////////////////////////////////////////////////////// | |
f34f4acb | 435 | void AliVertex::AddJet(AliJet& j,Int_t tracks) |
d88f97cc | 436 | { |
f34f4acb | 437 | // Add a jet (and its tracks) to the vertex |
438 | // In case the maximum number of jets has been reached, | |
439 | // the array space will be extended automatically | |
440 | // | |
441 | // Note : By default the tracks of the jet are added to the current (primary) | |
442 | // vertex. | |
443 | // The automatic addition of the tracks of the jet can be suppressed | |
444 | // by specifying tracks=0. In this case only the AliJet object will | |
445 | // be stored according to the mode specified by SetJetCopy(). | |
446 | // The latter will enable jet studies based on a fixed list of tracks | |
447 | // as contained e.g. in an AliVertex or AliEvent. | |
5f25234b | 448 | // |
449 | // In case a private copy is made, this is performed via the Clone() memberfunction. | |
450 | // All AliJet and derived classes have the default TObject::Clone() memberfunction. | |
451 | // However, derived classes generally contain an internal data structure which may | |
452 | // include pointers to other objects. Therefore it is recommended to provide | |
453 | // for all derived classes a specific copy constructor and override the default Clone() | |
454 | // memberfunction using this copy constructor. | |
455 | // An example for this may be seen from AliJet. | |
456 | ||
6516b62d | 457 | if (!fJets) |
458 | { | |
459 | fJets=new TObjArray(fNjmax); | |
460 | if (fJetCopy) fJets->SetOwner(); | |
461 | } | |
f34f4acb | 462 | if (fNjets == fNjmax) // Check if maximum jet number is reached |
d88f97cc | 463 | { |
f34f4acb | 464 | fNjmax++; |
465 | fJets->Expand(fNjmax); | |
466 | } | |
467 | ||
468 | // Add the jet to the list | |
6516b62d | 469 | AliJet* jx=&j; |
5f25234b | 470 | if (fJetCopy) jx=(AliJet*)j.Clone(); |
6516b62d | 471 | |
472 | if (jx) | |
f34f4acb | 473 | { |
6516b62d | 474 | fNjets++; |
475 | fJets->Add(jx); | |
f34f4acb | 476 | } |
477 | ||
478 | // Add the tracks of the jet to this vertex | |
479 | if (tracks) | |
480 | { | |
6516b62d | 481 | if (!fJetTracks) |
482 | { | |
483 | fJetTracks=new TObjArray(); | |
484 | } | |
485 | Int_t copy=1-(jx->GetTrackCopy()); | |
f34f4acb | 486 | AliTrack* tj; |
6516b62d | 487 | for (Int_t i=1; i<=jx->GetNtracks(); i++) |
f34f4acb | 488 | { |
6516b62d | 489 | tj=jx->GetTrack(i); |
490 | if (tj) | |
491 | { | |
492 | AddTrack(tj,copy); | |
493 | fJetTracks->Add(tj); | |
494 | } | |
f34f4acb | 495 | } |
d88f97cc | 496 | } |
497 | } | |
498 | /////////////////////////////////////////////////////////////////////////// | |
f531a546 | 499 | void AliVertex::AddVertex(AliVertex& v,Int_t connect) |
d88f97cc | 500 | { |
501 | // Add a (secondary) vertex to the current vertex. | |
502 | // In case the maximum number of (secondary) vertices has been reached, | |
503 | // the array space will be extended automatically | |
504 | // | |
29beb80d | 505 | // Note : By default the 4-momentum and charge of the current (primary) vertex |
506 | // are updated by automatically creating the track connecting | |
507 | // both vertices. The track parameters are taken from the | |
508 | // 4-momentum and charge of the secondary vertex. | |
509 | // The automatic creation of the connecting track and updating | |
510 | // of the (primary) vertex 4-momentum and charge can be suppressed | |
511 | // by specifying connect=0. In this case, however, the user | |
512 | // has to introduce the connecting track lateron by hand | |
513 | // explicitly in order to match the kinematics and charge. | |
d88f97cc | 514 | // |
5f25234b | 515 | // In case a private copy is made, this is performed via the Clone() memberfunction. |
516 | // All AliVertex and derived classes have the default TObject::Clone() memberfunction. | |
517 | // However, derived classes generally contain an internal data structure which may | |
518 | // include pointers to other objects. Therefore it is recommended to provide | |
519 | // for all derived classes a specific copy constructor and override the default Clone() | |
520 | // memberfunction using this copy constructor. | |
521 | // An example for this may be seen from AliVertex. | |
522 | ||
6516b62d | 523 | if (!fVertices) |
524 | { | |
525 | fVertices=new TObjArray(fNvmax); | |
526 | if (fVertexCopy) fVertices->SetOwner(); | |
527 | } | |
d88f97cc | 528 | if (fNvtx == fNvmax) // Check if maximum vertex number is reached |
529 | { | |
530 | fNvmax++; | |
531 | fVertices->Expand(fNvmax); | |
532 | } | |
29beb80d | 533 | |
534 | // Add the linked (secondary) vertex to the list | |
6516b62d | 535 | AliVertex* vx=&v; |
5f25234b | 536 | if (fVertexCopy) vx=(AliVertex*)v.Clone(); |
6516b62d | 537 | |
538 | if (vx) | |
f34f4acb | 539 | { |
6516b62d | 540 | fNvtx++; |
541 | fVertices->Add(vx); | |
542 | } | |
29beb80d | 543 | |
544 | // Create connecting track and update 4-momentum and charge for current vertex | |
545 | if (connect) | |
546 | { | |
43bfa5be | 547 | AliTrack* t=new AliTrack(); |
6516b62d | 548 | t->SetBeginPoint(GetPosition()); |
549 | t->SetEndPoint(v.GetPosition()); | |
550 | t->SetCharge(v.GetCharge()); | |
551 | t->Set4Momentum((Ali4Vector&)v); | |
29beb80d | 552 | |
6516b62d | 553 | AddTrack(t,0); |
29beb80d | 554 | |
6516b62d | 555 | if (!fConnects) |
556 | { | |
557 | fConnects=new TObjArray(fNvmax); | |
558 | if (!fTrackCopy) fConnects->SetOwner(); | |
559 | } | |
29beb80d | 560 | fConnects->Add(t); |
561 | } | |
d88f97cc | 562 | } |
563 | /////////////////////////////////////////////////////////////////////////// | |
1f241680 | 564 | void AliVertex::Data(TString f,TString u) |
d88f97cc | 565 | { |
566 | // Provide vertex information within the coordinate frame f | |
1f241680 | 567 | // |
568 | // The string argument "u" allows to choose between different angular units | |
569 | // in case e.g. a spherical frame is selected. | |
570 | // u = "rad" : angles provided in radians | |
571 | // "deg" : angles provided in degrees | |
572 | // | |
573 | // The defaults are f="car" and u="rad". | |
574 | ||
47dddbe4 | 575 | const char* name=GetName(); |
576 | const char* title=GetTitle(); | |
577 | cout << " *AliVertex::Data*"; | |
578 | if (strlen(name)) cout << " Name : " << GetName(); | |
579 | if (strlen(title)) cout << " Title : " << GetTitle(); | |
580 | cout << endl; | |
387a745b | 581 | cout << " Id : " << fUserId << " Invmass : " << GetInvmass() |
d88f97cc | 582 | << " Charge : " << GetCharge() << " Momentum : " << GetMomentum() |
25eefd00 | 583 | << " Ntracks : " << GetNtracks() << endl; |
584 | cout << " Nvertices : " << fNvtx << " Njets : " << fNjets | |
585 | << " Energy scale : " << fEscale << " GeV" << endl; | |
d88f97cc | 586 | cout << " "; |
1f241680 | 587 | Ali4Vector::Data(f,u); |
d88f97cc | 588 | cout << " Position"; |
1f241680 | 589 | AliPosition::Data(f,u); |
d88f97cc | 590 | } |
591 | /////////////////////////////////////////////////////////////////////////// | |
1f241680 | 592 | void AliVertex::List(TString f,TString u) |
d88f97cc | 593 | { |
594 | // Provide primary track and sec. vertex information within the coordinate frame f | |
1f241680 | 595 | // |
596 | // The string argument "u" allows to choose between different angular units | |
597 | // in case e.g. a spherical frame is selected. | |
598 | // u = "rad" : angles provided in radians | |
599 | // "deg" : angles provided in degrees | |
600 | // | |
601 | // The defaults are f="car" and u="rad". | |
d88f97cc | 602 | |
1f241680 | 603 | Data(f,u); // Information of the current vertex |
d88f97cc | 604 | |
605 | // The tracks of this vertex | |
606 | AliTrack* t; | |
607 | for (Int_t it=1; it<=GetNtracks(); it++) | |
608 | { | |
609 | t=GetTrack(it); | |
610 | if (t) | |
611 | { | |
612 | cout << " ---Track no. " << it << endl; | |
613 | cout << " "; | |
1f241680 | 614 | t->Data(f,u); |
d88f97cc | 615 | } |
616 | else | |
617 | { | |
618 | cout << " *AliVertex::List* Error : No track present." << endl; | |
619 | } | |
620 | } | |
621 | ||
622 | // The secondary vertices of this vertex | |
623 | AliVertex* v; | |
624 | for (Int_t iv=1; iv<=GetNvertices(); iv++) | |
625 | { | |
626 | v=GetVertex(iv); | |
627 | if (v) | |
628 | { | |
629 | cout << " ---Level 1 sec. vertex no. " << iv << endl; | |
630 | cout << " "; | |
1f241680 | 631 | v->Data(f,u); |
d88f97cc | 632 | } |
633 | else | |
634 | { | |
635 | cout << " *AliVertex::List* Error : No sec. vertex present." << endl; | |
636 | } | |
637 | } | |
638 | } | |
639 | /////////////////////////////////////////////////////////////////////////// | |
1f241680 | 640 | void AliVertex::ListAll(TString f,TString u) |
d88f97cc | 641 | { |
642 | // Provide complete (sec) vertex and (decay) track info within the coordinate frame f | |
1f241680 | 643 | // |
644 | // The string argument "u" allows to choose between different angular units | |
645 | // in case e.g. a spherical frame is selected. | |
646 | // u = "rad" : angles provided in radians | |
647 | // "deg" : angles provided in degrees | |
648 | // | |
649 | // The defaults are f="car" and u="rad". | |
d88f97cc | 650 | |
1f241680 | 651 | Data(f,u); // Information of the current vertex |
d88f97cc | 652 | |
653 | // The tracks of this vertex | |
654 | AliTrack* t; | |
655 | for (Int_t it=1; it<=GetNtracks(); it++) | |
656 | { | |
657 | t=GetTrack(it); | |
658 | if (t) | |
659 | { | |
660 | cout << " ---Track no. " << it << endl; | |
661 | cout << " "; | |
1f241680 | 662 | t->ListAll(f,u); |
d88f97cc | 663 | } |
664 | else | |
665 | { | |
666 | cout << " *AliVertex::ListAll* Error : No track present." << endl; | |
667 | } | |
668 | } | |
669 | ||
670 | AliVertex* v=this; | |
1f241680 | 671 | Dumps(v,1,f,u); // Information of all sec. vertices |
d88f97cc | 672 | } |
673 | ////////////////////////////////////////////////////////////////////////// | |
1f241680 | 674 | void AliVertex::Dumps(AliVertex* v,Int_t n,TString f,TString u) |
d88f97cc | 675 | { |
676 | // Recursively provide the info of all secondary vertices of this vertex | |
677 | AliVertex* vs; | |
678 | for (Int_t iv=1; iv<=v->GetNvertices(); iv++) | |
679 | { | |
680 | vs=v->GetVertex(iv); | |
681 | if (vs) | |
682 | { | |
683 | cout << " ---Level " << n << " sec. vertex no. " << iv << endl; | |
684 | cout << " "; | |
1f241680 | 685 | vs->Data(f,u); |
d88f97cc | 686 | |
687 | // The tracks of this vertex | |
688 | AliTrack* t; | |
689 | for (Int_t it=1; it<=vs->GetNtracks(); it++) | |
690 | { | |
691 | t=vs->GetTrack(it); | |
692 | if (t) | |
693 | { | |
694 | cout << " ---Track no. " << it << endl; | |
695 | cout << " "; | |
1f241680 | 696 | t->ListAll(f,u); |
d88f97cc | 697 | } |
698 | else | |
699 | { | |
1c01b4f8 | 700 | cout << " *AliVertex::Dumps* Error : No track present." << endl; |
d88f97cc | 701 | } |
702 | } | |
703 | ||
704 | // Go for next sec. vertex level of this sec. vertex recursively | |
1f241680 | 705 | Dumps(vs,n+1,f,u); |
d88f97cc | 706 | } |
707 | else | |
708 | { | |
1c01b4f8 | 709 | cout << " *AliVertex::Dumps* Error : No sec. vertex present." << endl; |
d88f97cc | 710 | } |
711 | } | |
712 | } | |
713 | ////////////////////////////////////////////////////////////////////////// | |
261c0caf | 714 | Int_t AliVertex::GetNvertices() const |
d88f97cc | 715 | { |
716 | // Return the current number of (secondary) vertices | |
717 | return fNvtx; | |
718 | } | |
719 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 720 | AliVertex* AliVertex::GetVertex(Int_t i) const |
d88f97cc | 721 | { |
722 | // Return the i-th (secondary) vertex of the current vertex | |
f34f4acb | 723 | if (!fVertices) |
724 | { | |
725 | cout << " *AliVertex*::GetVertex* No (secondary) vertices present." << endl; | |
726 | return 0; | |
727 | } | |
728 | else | |
729 | { | |
730 | if (i<=0 || i>fNvtx) | |
731 | { | |
732 | cout << " *AliVertex*::GetVertex* Invalid argument i : " << i | |
733 | << " Nvtx = " << fNvtx << endl; | |
734 | return 0; | |
735 | } | |
736 | else | |
737 | { | |
738 | return (AliVertex*)fVertices->At(i-1); | |
739 | } | |
740 | } | |
741 | } | |
742 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 743 | AliVertex* AliVertex::GetIdVertex(Int_t id) const |
43bfa5be | 744 | { |
745 | // Return the (sec.) vertex with user identifier "id" | |
746 | AliVertex* vx=0; | |
747 | AliVertex* v=0; | |
748 | if (!fVertices) | |
749 | { | |
750 | cout << " *AliVertex*::GetIdVertex* No (secondary) vertices present." << endl; | |
751 | return 0; | |
752 | } | |
753 | else | |
754 | { | |
755 | for (Int_t i=0; i<fNvtx; i++) | |
756 | { | |
757 | vx=(AliVertex*)fVertices->At(i); | |
758 | if (id == vx->GetId()) v=vx; | |
759 | } | |
760 | return v; | |
761 | } | |
762 | } | |
763 | /////////////////////////////////////////////////////////////////////////// | |
f34f4acb | 764 | void AliVertex::SetVertexCopy(Int_t j) |
765 | { | |
766 | // (De)activate the creation of private copies of the added vertices. | |
767 | // j=0 ==> No private copies are made; pointers of original vertices are stored. | |
768 | // j=1 ==> Private copies of the vertices are made and these pointers are stored. | |
769 | // | |
770 | // Note : Once the storage contains pointer(s) to AliVertex objects one cannot | |
771 | // change the VertexCopy mode anymore. | |
772 | // To change the VertexCopy mode for an existing AliVertex containing | |
773 | // vertices one first has to invoke Reset(). | |
774 | if (!fVertices) | |
775 | { | |
776 | if (j==0 || j==1) | |
777 | { | |
778 | fVertexCopy=j; | |
779 | } | |
780 | else | |
781 | { | |
782 | cout << "*AliVertex::SetVertexCopy* Invalid argument : " << j << endl; | |
783 | } | |
784 | } | |
785 | else | |
786 | { | |
787 | cout << "*AliVertex::SetVertexCopy* Storage already contained vertices." | |
788 | << " ==> VertexCopy mode not changed." << endl; | |
789 | } | |
790 | } | |
791 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 792 | Int_t AliVertex::GetVertexCopy() const |
f34f4acb | 793 | { |
794 | // Provide value of the VertexCopy mode. | |
795 | // 0 ==> No private copies are made; pointers of original vertices are stored. | |
796 | // 1 ==> Private copies of the vertices are made and these pointers are stored. | |
797 | return fVertexCopy; | |
798 | } | |
799 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 800 | Int_t AliVertex::GetNjets() const |
f34f4acb | 801 | { |
802 | // Return the current number of jets | |
803 | return fNjets; | |
804 | } | |
805 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 806 | AliJet* AliVertex::GetJet(Int_t i) const |
f34f4acb | 807 | { |
808 | // Return the i-th jet of the current vertex | |
809 | if (!fJets) | |
810 | { | |
811 | cout << " *AliVertex*::GetJet* No jets present." << endl; | |
812 | return 0; | |
813 | } | |
814 | else | |
815 | { | |
816 | if (i<=0 || i>fNjets) | |
817 | { | |
818 | cout << " *AliVertex*::GetJet* Invalid argument i : " << i | |
819 | << " Njets = " << fNjets << endl; | |
820 | return 0; | |
821 | } | |
822 | else | |
823 | { | |
824 | return (AliJet*)fJets->At(i-1); | |
825 | } | |
826 | } | |
827 | } | |
828 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 829 | AliJet* AliVertex::GetIdJet(Int_t id) const |
43bfa5be | 830 | { |
831 | // Return the jet with user identifier "id" | |
832 | AliJet* jx=0; | |
833 | AliJet* j=0; | |
834 | if (!fJets) | |
835 | { | |
836 | cout << " *AliVertex*::GetIdJet* No jets present." << endl; | |
837 | return 0; | |
838 | } | |
839 | else | |
840 | { | |
841 | for (Int_t i=0; i<fNjets; i++) | |
842 | { | |
843 | jx=(AliJet*)fJets->At(i); | |
844 | if (id == jx->GetId()) j=jx; | |
845 | } | |
846 | return j; | |
847 | } | |
848 | } | |
849 | /////////////////////////////////////////////////////////////////////////// | |
f34f4acb | 850 | void AliVertex::SetJetCopy(Int_t j) |
851 | { | |
852 | // (De)activate the creation of private copies of the added jets. | |
853 | // j=0 ==> No private copies are made; pointers of original jets are stored. | |
854 | // j=1 ==> Private copies of the jets are made and these pointers are stored. | |
855 | // | |
856 | // Note : Once the storage contains pointer(s) to AliJet objects one cannot | |
857 | // change the JetCopy mode anymore. | |
858 | // To change the JetCopy mode for an existing AliVertex containing | |
859 | // jets one first has to invoke Reset(). | |
860 | if (!fJets) | |
861 | { | |
862 | if (j==0 || j==1) | |
863 | { | |
864 | fJetCopy=j; | |
865 | } | |
866 | else | |
867 | { | |
868 | cout << "*AliVertex::SetJetCopy* Invalid argument : " << j << endl; | |
869 | } | |
870 | } | |
871 | else | |
872 | { | |
873 | cout << "*AliVertex::SetJetCopy* Storage already contained jets." | |
874 | << " ==> JetCopy mode not changed." << endl; | |
875 | } | |
876 | } | |
877 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 878 | Int_t AliVertex::GetJetCopy() const |
f34f4acb | 879 | { |
880 | // Provide value of the JetCopy mode. | |
881 | // 0 ==> No private copies are made; pointers of original jets are stored. | |
882 | // 1 ==> Private copies of the jets are made and these pointers are stored. | |
883 | return fJetCopy; | |
d88f97cc | 884 | } |
885 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 886 | Int_t AliVertex::IsConnectTrack(AliTrack* t) const |
6516b62d | 887 | { |
888 | // Indicate whether a track from the tracklist was created via the | |
889 | // connection of a (secondary) vertex or not. | |
890 | // In case the track was the result of (secondary) vertex addition the | |
891 | // return value is 1, otherwise the value 0 will be returned. | |
892 | Int_t connect=0; | |
893 | if (fConnects) | |
894 | { | |
895 | if (fConnects->FindObject(t)) connect=1; | |
896 | } | |
897 | return connect; | |
898 | } | |
899 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 900 | Int_t AliVertex::IsJetTrack(AliTrack* t) const |
6516b62d | 901 | { |
902 | // Indicate whether a track from the tracklist was created via the | |
903 | // addition of a jet or not. | |
904 | // In case the track was the result of jet addition the return value is 1, | |
905 | // otherwise the value 0 will be returned. | |
906 | Int_t jetflag=0; | |
907 | if (fJetTracks) | |
908 | { | |
909 | if (fJetTracks->FindObject(t)) jetflag=1; | |
910 | } | |
911 | return jetflag; | |
912 | } | |
913 | /////////////////////////////////////////////////////////////////////////// | |
a37bb40e | 914 | void AliVertex::Draw(Int_t secs,Int_t cons,Int_t jets) |
915 | { | |
916 | // 3-Dimensional visualisation of an AliVertex with its attributes. | |
917 | // The displayed tracklength is proportional to the momentum of the track. | |
918 | // | |
919 | // Color conventions : | |
920 | // ------------------- | |
921 | // positive track : red | |
922 | // neutral track : green | |
923 | // negative track : blue | |
924 | // jet-track : magenta (if explicit marking selected) | |
925 | // | |
1c01b4f8 | 926 | // secs = 1 --> Draw secondary vertices. (Default) |
a37bb40e | 927 | // 0 --> Don't draw secondary vertices. |
928 | // | |
1c01b4f8 | 929 | // cons = 1 --> Draw (auto generated) connecting tracks. (Default) |
a37bb40e | 930 | // 0 --> Don't draw (auto generated) connecting tracks. |
931 | // | |
932 | // jets = 1 --> Mark tracks belonging to jets. | |
1c01b4f8 | 933 | // 0 --> Don't mark jet-tracks. (Default) |
a37bb40e | 934 | // |
935 | // Notes : | |
936 | // ------- | |
937 | // Auto generated connecting tracks will be drawn as thin lines. | |
938 | // Tracks belonging to jets will be marked as somewhat thinner magenta lines. | |
939 | // This memberfunction is used recursively. | |
940 | // | |
941 | Double_t vec[3]={0,0,0}; | |
942 | AliTrack* tx=0; | |
943 | AliVertex* vx=0; | |
c72198f1 | 944 | AliPosition* r=0; |
a37bb40e | 945 | Ali3Vector p; |
1c01b4f8 | 946 | Float_t charge; |
a37bb40e | 947 | |
c72198f1 | 948 | AliPosition dummy; |
949 | ||
a37bb40e | 950 | if (fLines) delete fLines; |
951 | fLines=new TObjArray(); | |
952 | fLines->SetOwner(); | |
953 | ||
954 | Int_t ntk=GetNtracks(); | |
955 | for (Int_t jtk=1; jtk<=ntk; jtk++) | |
956 | { | |
957 | tx=GetTrack(jtk); | |
958 | ||
959 | if (!tx) continue; | |
960 | ||
1c01b4f8 | 961 | charge=tx->GetCharge(); |
a37bb40e | 962 | |
963 | TPolyLine3D* line=new TPolyLine3D(); | |
964 | fLines->Add(line); | |
965 | ||
966 | if (IsConnectTrack(tx)) | |
967 | { | |
968 | if (cons==1) | |
969 | { | |
970 | r=tx->GetBeginPoint(); | |
c72198f1 | 971 | if (!r) r=&dummy; |
972 | r->GetPosition(vec,"car"); | |
a37bb40e | 973 | line->SetNextPoint(vec[0],vec[1],vec[2]); |
974 | r=tx->GetEndPoint(); | |
c72198f1 | 975 | if (!r) r=&dummy; |
976 | r->GetPosition(vec,"car"); | |
a37bb40e | 977 | line->SetNextPoint(vec[0],vec[1],vec[2]); |
978 | line->SetLineWidth(1); | |
979 | } | |
980 | } | |
981 | else | |
982 | { | |
983 | r=tx->GetClosestPoint(); | |
c72198f1 | 984 | if (!r) r=&dummy; |
985 | r->GetPosition(vec,"car"); | |
a37bb40e | 986 | line->SetNextPoint(vec[0],vec[1],vec[2]); |
987 | p=tx->Get3Momentum(); | |
c72198f1 | 988 | p=p+(*r); |
a37bb40e | 989 | p.GetVector(vec,"car"); |
990 | line->SetNextPoint(vec[0],vec[1],vec[2]); | |
991 | line->SetLineWidth(3); | |
992 | } | |
993 | ||
1c01b4f8 | 994 | line->SetLineColor(kGreen); // Neutral track |
995 | if (charge>0) line->SetLineColor(kRed); // Positive track | |
996 | if (charge<0) line->SetLineColor(kBlue); // Negative track | |
a37bb40e | 997 | |
998 | // Mark tracks belonging to jets | |
999 | if (IsJetTrack(tx)) | |
1000 | { | |
1001 | if (jets==1) | |
1002 | { | |
1003 | line->SetLineWidth(2); | |
1004 | line->SetLineColor(kMagenta); | |
1005 | } | |
1006 | } | |
1007 | ||
1008 | line->Draw(); | |
1009 | } | |
1010 | ||
1011 | // Go for secondary vertices if selected | |
1012 | if (secs==1) | |
1013 | { | |
1014 | Int_t nvtx=GetNvertices(); | |
1015 | for (Int_t jvtx=1; jvtx<=nvtx; jvtx++) | |
1016 | { | |
1017 | vx=GetVertex(jvtx); | |
1018 | if (vx) vx->Draw(secs,cons,jets); | |
1019 | } | |
1020 | } | |
1021 | } | |
1022 | /////////////////////////////////////////////////////////////////////////// | |
4962c850 | 1023 | TObjArray* AliVertex::SortJets(Int_t mode,TObjArray* jets) |
1024 | { | |
1025 | // Order the references to an array of jets by looping over the input array "jets" | |
1026 | // and checking the value of a certain observable. | |
1027 | // The ordered array is returned as a TObjArray. | |
1028 | // In case jets=0 (default), the registered jets of the current vertex are used. | |
1029 | // Note that the original jet array is not modified. | |
1030 | // Via the "mode" argument the user can specify the observable to be checked upon | |
1031 | // and specify whether sorting should be performed in decreasing order (mode<0) | |
1032 | // or in increasing order (mode>0). | |
1033 | // | |
1034 | // The convention for the observable selection is the following : | |
1035 | // mode : 1 ==> Number of tracks in the jet | |
1036 | // 2 ==> Jet energy | |
1037 | // 3 ==> Jet momentum | |
1038 | // 4 ==> Invariant mass of the jet | |
1039 | // 5 ==> Transverse momentum of the jet | |
1040 | // 6 ==> Longitudinal momentum of the jet | |
1041 | // 7 ==> Transverse energy of the jet | |
1042 | // 8 ==> Longitudinal energy of the jet | |
1043 | // 9 ==> Transverse mass of the jet | |
1044 | // 10 ==> Jet rapidity | |
1045 | // 11 ==> Pseudo-rapidity of the jet | |
25eefd00 | 1046 | // 12 ==> Number of associated signals |
1047 | // 13 ==> Total charge of the jet | |
4962c850 | 1048 | // |
1049 | // The default is mode=-1. | |
1050 | // | |
1051 | // Note : This sorting routine uses a common area in memory, which is used | |
1052 | // by various other sorting facilities as well. | |
1053 | // This means that the resulting sorted TObjArray may be overwritten | |
1054 | // when another sorting is invoked. | |
1055 | // To retain the sorted list of pointers, the user is advised to copy | |
1056 | // the pointers contained in the returned TObjArray into a private | |
1057 | // TObjArray instance. | |
1058 | ||
1059 | if (fSelected) | |
1060 | { | |
1061 | delete fSelected; | |
1062 | fSelected=0; | |
1063 | } | |
1064 | ||
1065 | if (!jets) jets=fJets; | |
1066 | ||
25eefd00 | 1067 | if (!mode || abs(mode)>13 || !jets) return fSelected; |
4962c850 | 1068 | |
1069 | Int_t njets=jets->GetEntries(); | |
1070 | if (!njets) | |
1071 | { | |
1072 | return fSelected; | |
1073 | } | |
1074 | else | |
1075 | { | |
1076 | fSelected=new TObjArray(njets); | |
1077 | } | |
1078 | ||
1079 | Double_t val1,val2; // Values of the observable to be tested upon | |
1080 | ||
1081 | Int_t nord=0; | |
1082 | for (Int_t i=0; i<njets; i++) // Loop over all jets of the array | |
1083 | { | |
1084 | AliJet* jx=(AliJet*)jets->At(i); | |
1085 | ||
1086 | if (!jx) continue; | |
1087 | ||
1088 | if (nord == 0) // store the first jet at the first ordered position | |
1089 | { | |
1090 | nord++; | |
1091 | fSelected->AddAt(jx,nord-1); | |
1092 | continue; | |
1093 | } | |
1094 | ||
1095 | for (Int_t j=0; j<=nord; j++) // put jet in the right ordered position | |
1096 | { | |
1097 | if (j == nord) // jet has smallest (mode<0) or largest (mode>0) observable value seen so far | |
1098 | { | |
1099 | nord++; | |
1100 | fSelected->AddAt(jx,j); // add jet at the end | |
1101 | break; // go for next jet | |
1102 | } | |
64b63904 | 1103 | |
1104 | val1=0; | |
1105 | val2=0; | |
4962c850 | 1106 | |
1107 | switch (abs(mode)) | |
1108 | { | |
1109 | case 1: | |
1110 | val1=jx->GetNtracks(); | |
1111 | val2=((AliJet*)fSelected->At(j))->GetNtracks(); | |
1112 | break; | |
1113 | case 2: | |
25eefd00 | 1114 | val1=jx->GetEnergy(1); |
1115 | val2=((AliJet*)fSelected->At(j))->GetEnergy(1); | |
4962c850 | 1116 | break; |
1117 | case 3: | |
25eefd00 | 1118 | val1=jx->GetMomentum(1); |
1119 | val2=((AliJet*)fSelected->At(j))->GetMomentum(1); | |
4962c850 | 1120 | break; |
1121 | case 4: | |
25eefd00 | 1122 | val1=jx->GetInvmass(1); |
1123 | val2=((AliJet*)fSelected->At(j))->GetInvmass(1); | |
4962c850 | 1124 | break; |
1125 | case 5: | |
25eefd00 | 1126 | val1=jx->GetPt(1); |
1127 | val2=((AliJet*)fSelected->At(j))->GetPt(1); | |
4962c850 | 1128 | break; |
1129 | case 6: | |
25eefd00 | 1130 | val1=jx->GetPl(1); |
1131 | val2=((AliJet*)fSelected->At(j))->GetPl(1); | |
4962c850 | 1132 | break; |
1133 | case 7: | |
25eefd00 | 1134 | val1=jx->GetEt(1); |
1135 | val2=((AliJet*)fSelected->At(j))->GetEt(1); | |
4962c850 | 1136 | break; |
1137 | case 8: | |
25eefd00 | 1138 | val1=jx->GetEl(1); |
1139 | val2=((AliJet*)fSelected->At(j))->GetEl(1); | |
4962c850 | 1140 | break; |
1141 | case 9: | |
25eefd00 | 1142 | val1=jx->GetMt(1); |
1143 | val2=((AliJet*)fSelected->At(j))->GetMt(1); | |
4962c850 | 1144 | break; |
1145 | case 10: | |
1146 | val1=jx->GetRapidity(); | |
1147 | val2=((AliJet*)fSelected->At(j))->GetRapidity(); | |
1148 | break; | |
1149 | case 11: | |
1150 | val1=jx->GetPseudoRapidity(); | |
1151 | val2=((AliJet*)fSelected->At(j))->GetPseudoRapidity(); | |
1152 | break; | |
25eefd00 | 1153 | case 12: |
1154 | val1=jx->GetNsignals(); | |
1155 | val2=((AliJet*)fSelected->At(j))->GetNsignals(); | |
1156 | break; | |
1157 | case 13: | |
1158 | val1=jx->GetCharge(); | |
1159 | val2=((AliJet*)fSelected->At(j))->GetCharge(); | |
1160 | break; | |
4962c850 | 1161 | } |
1162 | ||
f5b75967 | 1163 | if (mode<0 && val1 <= val2) continue; |
1164 | if (mode>0 && val1 >= val2) continue; | |
4962c850 | 1165 | |
1166 | nord++; | |
1167 | for (Int_t k=nord-1; k>j; k--) // create empty position | |
1168 | { | |
1169 | fSelected->AddAt(fSelected->At(k-1),k); | |
1170 | } | |
1171 | fSelected->AddAt(jx,j); // put jet at empty position | |
1172 | break; // go for next jet | |
1173 | } | |
1174 | } | |
1175 | return fSelected; | |
1176 | } | |
1177 | /////////////////////////////////////////////////////////////////////////// | |
261c0caf | 1178 | TObject* AliVertex::Clone(const char* name) const |
5f25234b | 1179 | { |
1180 | // Make a deep copy of the current object and provide the pointer to the copy. | |
1181 | // This memberfunction enables automatic creation of new objects of the | |
1182 | // correct type depending on the object type, a feature which may be very useful | |
1183 | // for containers when adding objects in case the container owns the objects. | |
1184 | // This feature allows e.g. AliEvent to store either AliVertex objects or | |
1185 | // objects derived from AliVertex via the AddVertex memberfunction, provided | |
1186 | // these derived classes also have a proper Clone memberfunction. | |
1187 | ||
1188 | AliVertex* vtx=new AliVertex(*this); | |
1189 | if (name) | |
1190 | { | |
1191 | if (strlen(name)) vtx->SetName(name); | |
1192 | } | |
1193 | return vtx; | |
1194 | } | |
1195 | /////////////////////////////////////////////////////////////////////////// |