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