Unnecessary includes removes, one included. (Jacek M. Holeczek)
[u/mrichter/AliRoot.git] / RALICE / AliVertex.cxx
CommitLineData
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//
959fbac5 51// Coding example to make 3 vertices v1, v2 and v3.
52// ------------------------------------------------
53// v1 contains the tracks 1,2,3 and 4
f34f4acb 54// v2 contains many different tracks
959fbac5 55// v3 contains the jets 1 and 2
56//
f34f4acb 57// AliTrack t1,t2,t3,t4;
959fbac5 58// ...
59// ... // code to fill the track data
60// ...
61//
62// AliJet j1,j2;
63// ...
64// ... // code to fill the jet data
65// ...
66//
f34f4acb 67// AliVertex v1;
68// v1.SetVertexCopy(1);
959fbac5 69//
f531a546 70// v1.AddTrack(t1);
71// v1.AddTrack(t2);
72// v1.AddTrack(t3);
73// v1.AddTrack(t4);
959fbac5 74//
75// Float_t r1[3]={2.4,0.1,-8.5};
76// v1.SetPosition(r1,"car");
77//
f34f4acb 78// AliVertex v2;
79// v2.SetTrackCopy(1);
80//
81// AliTrack* tx=new AliTrack();
82// for (Int_t i=0; i<10; i++)
83// {
84// ...
85// ... // code to fill the track data
86// ...
87// v2.AddTrack(tx);
88// tx->Reset();
89// }
959fbac5 90//
91// Float_t r2[3]={1.6,-3.2,5.7};
92// v2.SetPosition(r2,"car");
93//
94// AliVertex v3;
95//
f531a546 96// v3.AddJet(j1);
97// v3.AddJet(j2);
959fbac5 98//
99// Float_t r3[3]={6.2,4.8,1.3};
100// v3.SetPosition(r3,"car");
101//
102// v1.Info("sph");
103// v2.ListAll();
104// v3.List("cyl");
105//
106// Float_t e1=v1.GetEnergy();
107// Ali3Vector p1=v1.Get3Momentum();
108// Float_t loc[3];
109// v1.GetPosition(loc,"sph");
110// AliPosition r=v2.GetPosition();
111// r.Info();
112// Int_t nt=v2.GetNtracks();
113// AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
114//
115// Specify the vertices v2 and v3 as secondary vertices of v1
116//
f531a546 117// v1.AddVertex(v2);
118// v1.AddVertex(v3);
959fbac5 119//
120// v1.List();
121//
122// Int_t nv=v1.GetNvtx();
123// AliVertex* vx=v1.GetVertex(1); // Access 1st secondary vertex of v1
124// Float_t e=vx->GetEnergy();
125//
126// Float_t M=v1.GetInvmass();
127//
128// Reconstruct Vertex v1 from scratch
129//
130// v1.Reset();
131// v1.SetNvmax(25); // Increase initial no. of sec. vertices
f531a546 132// v1.AddTrack(t3);
f34f4acb 133// v1.AddTrack(t4);
f531a546 134// v1.AddJet(j2);
959fbac5 135// Float_t pos[3]={7,9,4};
136// v1.SetPosition(pos,"car");
137//
138// Note : All quantities are in GeV, GeV/c or GeV/c**2
139//
140//--- Author: Nick van Eijndhoven 04-apr-1998 UU-SAP Utrecht
f531a546 141//- Modified: NvE $Date$ UU-SAP Utrecht
959fbac5 142///////////////////////////////////////////////////////////////////////////
143
d88f97cc 144#include "AliVertex.h"
145
146ClassImp(AliVertex) // Class implementation to enable ROOT I/O
147
148AliVertex::AliVertex()
149{
959fbac5 150// Default constructor.
151// All variables initialised to 0.
152// Initial maximum number of tracks is set to the default value.
153// Initial maximum number of sec. vertices is set to the default value.
6516b62d 154 Init();
d88f97cc 155 Reset();
156 SetNtinit();
157 SetNvmax();
f34f4acb 158 SetNjmax();
d88f97cc 159}
160///////////////////////////////////////////////////////////////////////////
6516b62d 161void AliVertex::Init()
d88f97cc 162{
6516b62d 163// Initialisation of pointers etc...
164 AliJet::Init();
d88f97cc 165 fNvmax=0;
166 fVertices=0;
29beb80d 167 fConnects=0;
f34f4acb 168 fVertexCopy=0;
169 fNjmax=0;
170 fJets=0;
6516b62d 171 fJetTracks=0;
f34f4acb 172 fJetCopy=0;
6516b62d 173}
174///////////////////////////////////////////////////////////////////////////
175AliVertex::AliVertex(Int_t n)
176{
177// Create a vertex to hold initially a maximum of n tracks
178// All variables initialised to 0
179 Init();
d88f97cc 180 Reset();
181 if (n > 0)
182 {
183 SetNtinit(n);
184 }
185 else
186 {
187 cout << endl;
188 cout << " *AliVertex* Initial max. number of tracks entered : " << n << endl;
189 cout << " This is invalid. Default initial maximum will be used." << endl;
190 cout << endl;
191 SetNtinit();
192 }
193 SetNvmax();
f34f4acb 194 SetNjmax();
d88f97cc 195}
196///////////////////////////////////////////////////////////////////////////
197AliVertex::~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 }
220}
221///////////////////////////////////////////////////////////////////////////
222AliVertex::AliVertex(AliVertex& v)
223{
224// Copy constructor
225 Init();
226 Reset();
227 SetNtinit();
228 SetNvmax();
229 SetNjmax();
230 SetTrackCopy(v.GetTrackCopy());
231 SetVertexCopy(v.GetVertexCopy());
232 SetJetCopy(v.GetJetCopy());
233 SetId(v.GetId());
234 SetPosition(v.GetPosition());
235
236 // Copy all tracks except the ones coming from jets
237 AliTrack* tx=0;
238 Int_t jetflag=0,connect=0;
239 AliTrack* tx2=0;
240 for (Int_t it=1; it<=v.GetNtracks(); it++)
241 {
242 tx=v.GetTrack(it);
243 if (tx)
244 {
245 jetflag=v.IsJetTrack(tx);
246 connect=v.IsConnectTrack(tx);
247
248 if (!jetflag && !connect) AddTrack(tx);
249
250 if (connect)
251 {
252 if (!fConnects)
253 {
254 fConnects=new TObjArray(fNvmax);
255 if (!fTrackCopy) fConnects->SetOwner();
256 }
257 tx2=new AliTrack(*tx);
258 fConnects->Add(tx2);
259 AddTrack(tx2,0);
260 }
261 }
262 }
263
264 // Copy all the (secondary) vertices without re-creating connecting tracks
265 // The connecting tracks have already been copied above
266 AliVertex* vx=0;
267 for (Int_t iv=1; iv<=v.GetNvertices(); iv++)
268 {
269 vx=v.GetVertex(iv);
270 if (vx) AddVertex(vx,0);
271 }
272
273 // Copy all the jets including the jet tracks for these jets for which
274 // this was also the case in the original vertex
275 AliJet* jx=0;
276 for (Int_t ij=1; ij<=v.GetNjets(); ij++)
277 {
278 jx=v.GetJet(ij);
279 if (jx)
280 {
281 jetflag=0;
282 if (jx->GetNtracks())
283 {
284 tx=jx->GetTrack(1);
285 if (tx)
286 {
287 jetflag=v.IsJetTrack(tx);
288 }
289 }
290 AddJet(jx,jetflag);
291 }
292 }
d88f97cc 293}
294///////////////////////////////////////////////////////////////////////////
295void AliVertex::SetNvmax(Int_t n)
296{
297// Set the initial maximum number of (secondary) vertices
298 if (n > 0)
299 {
300 fNvmax=n;
301 }
302 else
303 {
304 fNvmax=1;
305 }
f34f4acb 306 if (fVertices)
307 {
f34f4acb 308 delete fVertices;
309 fVertices=0;
310 }
311}
312///////////////////////////////////////////////////////////////////////////
313void AliVertex::SetNjmax(Int_t n)
314{
315// Set the initial maximum number of jets
316 if (n > 0)
317 {
318 fNjmax=n;
319 }
320 else
321 {
322 fNjmax=1;
323 }
324 if (fJets)
325 {
f34f4acb 326 delete fJets;
327 fJets=0;
328 }
d88f97cc 329}
330///////////////////////////////////////////////////////////////////////////
331void AliVertex::Reset()
332{
7849a8ab 333// Reset all variables to 0 and reset all stored vertex and jet lists.
d88f97cc 334// The max. number of tracks is set to the initial value again
335// The max. number of vertices is set to the default value again
7849a8ab 336// The max. number of jets is set to the default value again
d88f97cc 337
338 AliJet::Reset();
339
f531a546 340 Double_t a[3]={0,0,0};
341 SetPosition(a,"sph");
342 SetPositionErrors(a,"car");
343
d88f97cc 344 fNvtx=0;
345 if (fNvmax>0) SetNvmax(fNvmax);
29beb80d 346 if (fConnects)
347 {
29beb80d 348 delete fConnects;
349 fConnects=0;
350 }
f34f4acb 351
352 fNjets=0;
353 if (fNjmax>0) SetNjmax(fNjmax);
6516b62d 354 if (fJetTracks)
355 {
356 delete fJetTracks;
357 fJetTracks=0;
358 }
d88f97cc 359}
360///////////////////////////////////////////////////////////////////////////
7849a8ab 361void AliVertex::ResetVertices()
362{
363// Reset the stored vertex list and delete all connecting tracks which
364// were generated automatically via connect=1 in AddVertex().
365// The max. number of vertices is set to the default value again.
35044448 366// All physics quantities are updated according to the removal of the
367// connecting tracks.
7849a8ab 368 AliTrack* t;
369 if (fConnects)
370 {
371 for (Int_t i=0; i<=fConnects->GetLast(); i++)
372 {
373 t=(AliTrack*)fConnects->At(i);
374 AliTrack* test=(AliTrack*)fTracks->Remove(t);
35044448 375 if (test)
376 {
377 fNtrk--;
378 (Ali4Vector&)(*this)-=(Ali4Vector&)(*t);
379 fQ-=t->GetCharge();
6516b62d 380 if (fTrackCopy) delete t;
35044448 381 }
7849a8ab 382 }
383 fTracks->Compress();
384 }
385
7849a8ab 386 fNvtx=0;
387 if (fNvmax>0) SetNvmax(fNvmax);
388 if (fConnects)
389 {
7849a8ab 390 delete fConnects;
391 fConnects=0;
392 }
393}
394///////////////////////////////////////////////////////////////////////////
f34f4acb 395void AliVertex::AddJet(AliJet& j,Int_t tracks)
d88f97cc 396{
f34f4acb 397// Add a jet (and its tracks) to the vertex
398// In case the maximum number of jets has been reached,
399// the array space will be extended automatically
400//
401// Note : By default the tracks of the jet are added to the current (primary)
402// vertex.
403// The automatic addition of the tracks of the jet can be suppressed
404// by specifying tracks=0. In this case only the AliJet object will
405// be stored according to the mode specified by SetJetCopy().
406// The latter will enable jet studies based on a fixed list of tracks
407// as contained e.g. in an AliVertex or AliEvent.
6516b62d 408 if (!fJets)
409 {
410 fJets=new TObjArray(fNjmax);
411 if (fJetCopy) fJets->SetOwner();
412 }
f34f4acb 413 if (fNjets == fNjmax) // Check if maximum jet number is reached
d88f97cc 414 {
f34f4acb 415 fNjmax++;
416 fJets->Expand(fNjmax);
417 }
418
419 // Add the jet to the list
6516b62d 420 AliJet* jx=&j;
421 if (fJetCopy) jx=new AliJet(j);
422
423 if (jx)
f34f4acb 424 {
6516b62d 425 fNjets++;
426 fJets->Add(jx);
f34f4acb 427 }
428
429 // Add the tracks of the jet to this vertex
430 if (tracks)
431 {
6516b62d 432 if (!fJetTracks)
433 {
434 fJetTracks=new TObjArray();
435 }
436 Int_t copy=1-(jx->GetTrackCopy());
f34f4acb 437 AliTrack* tj;
6516b62d 438 for (Int_t i=1; i<=jx->GetNtracks(); i++)
f34f4acb 439 {
6516b62d 440 tj=jx->GetTrack(i);
441 if (tj)
442 {
443 AddTrack(tj,copy);
444 fJetTracks->Add(tj);
445 }
f34f4acb 446 }
d88f97cc 447 }
448}
449///////////////////////////////////////////////////////////////////////////
f531a546 450void AliVertex::AddVertex(AliVertex& v,Int_t connect)
d88f97cc 451{
452// Add a (secondary) vertex to the current vertex.
453// In case the maximum number of (secondary) vertices has been reached,
454// the array space will be extended automatically
455//
29beb80d 456// Note : By default the 4-momentum and charge of the current (primary) vertex
457// are updated by automatically creating the track connecting
458// both vertices. The track parameters are taken from the
459// 4-momentum and charge of the secondary vertex.
460// The automatic creation of the connecting track and updating
461// of the (primary) vertex 4-momentum and charge can be suppressed
462// by specifying connect=0. In this case, however, the user
463// has to introduce the connecting track lateron by hand
464// explicitly in order to match the kinematics and charge.
d88f97cc 465//
6516b62d 466 if (!fVertices)
467 {
468 fVertices=new TObjArray(fNvmax);
469 if (fVertexCopy) fVertices->SetOwner();
470 }
d88f97cc 471 if (fNvtx == fNvmax) // Check if maximum vertex number is reached
472 {
473 fNvmax++;
474 fVertices->Expand(fNvmax);
475 }
29beb80d 476
477 // Add the linked (secondary) vertex to the list
6516b62d 478 AliVertex* vx=&v;
479 if (fVertexCopy) vx=new AliVertex(v);
480
481 if (vx)
f34f4acb 482 {
6516b62d 483 fNvtx++;
484 fVertices->Add(vx);
485 }
29beb80d 486
487 // Create connecting track and update 4-momentum and charge for current vertex
488 if (connect)
489 {
43bfa5be 490 AliTrack* t=new AliTrack();
6516b62d 491 t->SetBeginPoint(GetPosition());
492 t->SetEndPoint(v.GetPosition());
493 t->SetCharge(v.GetCharge());
494 t->Set4Momentum((Ali4Vector&)v);
29beb80d 495
6516b62d 496 AddTrack(t,0);
29beb80d 497
6516b62d 498 if (!fConnects)
499 {
500 fConnects=new TObjArray(fNvmax);
501 if (!fTrackCopy) fConnects->SetOwner();
502 }
29beb80d 503 fConnects->Add(t);
504 }
d88f97cc 505}
506///////////////////////////////////////////////////////////////////////////
507void AliVertex::Info(TString f)
508{
509// Provide vertex information within the coordinate frame f
43bfa5be 510 cout << " *AliVertex::Info* Id : " << fUserId << " Invmass : " << GetInvmass()
d88f97cc 511 << " Charge : " << GetCharge() << " Momentum : " << GetMomentum()
f34f4acb 512 << " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx
513 << " Njets : " << fNjets << endl;
d88f97cc 514 cout << " ";
515 Ali4Vector::Info(f);
516 cout << " Position";
517 AliPosition::Info(f);
518}
519///////////////////////////////////////////////////////////////////////////
520void AliVertex::List(TString f)
521{
522// Provide primary track and sec. vertex information within the coordinate frame f
523
524 Info(f); // Information of the current vertex
525
526 // The tracks of this vertex
527 AliTrack* t;
528 for (Int_t it=1; it<=GetNtracks(); it++)
529 {
530 t=GetTrack(it);
531 if (t)
532 {
533 cout << " ---Track no. " << it << endl;
534 cout << " ";
535 t->Info(f);
536 }
537 else
538 {
539 cout << " *AliVertex::List* Error : No track present." << endl;
540 }
541 }
542
543 // The secondary vertices of this vertex
544 AliVertex* v;
545 for (Int_t iv=1; iv<=GetNvertices(); iv++)
546 {
547 v=GetVertex(iv);
548 if (v)
549 {
550 cout << " ---Level 1 sec. vertex no. " << iv << endl;
551 cout << " ";
552 v->Info(f);
553 }
554 else
555 {
556 cout << " *AliVertex::List* Error : No sec. vertex present." << endl;
557 }
558 }
559}
560///////////////////////////////////////////////////////////////////////////
561void AliVertex::ListAll(TString f)
562{
563// Provide complete (sec) vertex and (decay) track info within the coordinate frame f
564
565 Info(f); // Information of the current vertex
566
567 // The tracks of this vertex
568 AliTrack* t;
569 for (Int_t it=1; it<=GetNtracks(); it++)
570 {
571 t=GetTrack(it);
572 if (t)
573 {
574 cout << " ---Track no. " << it << endl;
575 cout << " ";
576 t->ListAll(f);
577 }
578 else
579 {
580 cout << " *AliVertex::ListAll* Error : No track present." << endl;
581 }
582 }
583
584 AliVertex* v=this;
585 Dump(v,1,f); // Information of all sec. vertices
586}
587//////////////////////////////////////////////////////////////////////////
588void AliVertex::Dump(AliVertex* v,Int_t n,TString f)
589{
590// Recursively provide the info of all secondary vertices of this vertex
591 AliVertex* vs;
592 for (Int_t iv=1; iv<=v->GetNvertices(); iv++)
593 {
594 vs=v->GetVertex(iv);
595 if (vs)
596 {
597 cout << " ---Level " << n << " sec. vertex no. " << iv << endl;
598 cout << " ";
599 vs->Info(f);
600
601 // The tracks of this vertex
602 AliTrack* t;
603 for (Int_t it=1; it<=vs->GetNtracks(); it++)
604 {
605 t=vs->GetTrack(it);
606 if (t)
607 {
608 cout << " ---Track no. " << it << endl;
609 cout << " ";
610 t->ListAll(f);
611 }
612 else
613 {
614 cout << " *AliVertex::Dump* Error : No track present." << endl;
615 }
616 }
617
618 // Go for next sec. vertex level of this sec. vertex recursively
619 Dump(vs,n+1,f);
620 }
621 else
622 {
623 cout << " *AliVertex::Dump* Error : No sec. vertex present." << endl;
624 }
625 }
626}
627//////////////////////////////////////////////////////////////////////////
628Int_t AliVertex::GetNvertices()
629{
630// Return the current number of (secondary) vertices
631 return fNvtx;
632}
633///////////////////////////////////////////////////////////////////////////
634AliVertex* AliVertex::GetVertex(Int_t i)
635{
636// Return the i-th (secondary) vertex of the current vertex
f34f4acb 637 if (!fVertices)
638 {
639 cout << " *AliVertex*::GetVertex* No (secondary) vertices present." << endl;
640 return 0;
641 }
642 else
643 {
644 if (i<=0 || i>fNvtx)
645 {
646 cout << " *AliVertex*::GetVertex* Invalid argument i : " << i
647 << " Nvtx = " << fNvtx << endl;
648 return 0;
649 }
650 else
651 {
652 return (AliVertex*)fVertices->At(i-1);
653 }
654 }
655}
656///////////////////////////////////////////////////////////////////////////
43bfa5be 657AliVertex* AliVertex::GetIdVertex(Int_t id)
658{
659// Return the (sec.) vertex with user identifier "id"
660 AliVertex* vx=0;
661 AliVertex* v=0;
662 if (!fVertices)
663 {
664 cout << " *AliVertex*::GetIdVertex* No (secondary) vertices present." << endl;
665 return 0;
666 }
667 else
668 {
669 for (Int_t i=0; i<fNvtx; i++)
670 {
671 vx=(AliVertex*)fVertices->At(i);
672 if (id == vx->GetId()) v=vx;
673 }
674 return v;
675 }
676}
677///////////////////////////////////////////////////////////////////////////
f34f4acb 678void AliVertex::SetVertexCopy(Int_t j)
679{
680// (De)activate the creation of private copies of the added vertices.
681// j=0 ==> No private copies are made; pointers of original vertices are stored.
682// j=1 ==> Private copies of the vertices are made and these pointers are stored.
683//
684// Note : Once the storage contains pointer(s) to AliVertex objects one cannot
685// change the VertexCopy mode anymore.
686// To change the VertexCopy mode for an existing AliVertex containing
687// vertices one first has to invoke Reset().
688 if (!fVertices)
689 {
690 if (j==0 || j==1)
691 {
692 fVertexCopy=j;
693 }
694 else
695 {
696 cout << "*AliVertex::SetVertexCopy* Invalid argument : " << j << endl;
697 }
698 }
699 else
700 {
701 cout << "*AliVertex::SetVertexCopy* Storage already contained vertices."
702 << " ==> VertexCopy mode not changed." << endl;
703 }
704}
705///////////////////////////////////////////////////////////////////////////
706Int_t AliVertex::GetVertexCopy()
707{
708// Provide value of the VertexCopy mode.
709// 0 ==> No private copies are made; pointers of original vertices are stored.
710// 1 ==> Private copies of the vertices are made and these pointers are stored.
711 return fVertexCopy;
712}
713///////////////////////////////////////////////////////////////////////////
714Int_t AliVertex::GetNjets()
715{
716// Return the current number of jets
717 return fNjets;
718}
719///////////////////////////////////////////////////////////////////////////
720AliJet* AliVertex::GetJet(Int_t i)
721{
722// Return the i-th jet of the current vertex
723 if (!fJets)
724 {
725 cout << " *AliVertex*::GetJet* No jets present." << endl;
726 return 0;
727 }
728 else
729 {
730 if (i<=0 || i>fNjets)
731 {
732 cout << " *AliVertex*::GetJet* Invalid argument i : " << i
733 << " Njets = " << fNjets << endl;
734 return 0;
735 }
736 else
737 {
738 return (AliJet*)fJets->At(i-1);
739 }
740 }
741}
742///////////////////////////////////////////////////////////////////////////
43bfa5be 743AliJet* AliVertex::GetIdJet(Int_t id)
744{
745// Return the jet with user identifier "id"
746 AliJet* jx=0;
747 AliJet* j=0;
748 if (!fJets)
749 {
750 cout << " *AliVertex*::GetIdJet* No jets present." << endl;
751 return 0;
752 }
753 else
754 {
755 for (Int_t i=0; i<fNjets; i++)
756 {
757 jx=(AliJet*)fJets->At(i);
758 if (id == jx->GetId()) j=jx;
759 }
760 return j;
761 }
762}
763///////////////////////////////////////////////////////////////////////////
f34f4acb 764void AliVertex::SetJetCopy(Int_t j)
765{
766// (De)activate the creation of private copies of the added jets.
767// j=0 ==> No private copies are made; pointers of original jets are stored.
768// j=1 ==> Private copies of the jets are made and these pointers are stored.
769//
770// Note : Once the storage contains pointer(s) to AliJet objects one cannot
771// change the JetCopy mode anymore.
772// To change the JetCopy mode for an existing AliVertex containing
773// jets one first has to invoke Reset().
774 if (!fJets)
775 {
776 if (j==0 || j==1)
777 {
778 fJetCopy=j;
779 }
780 else
781 {
782 cout << "*AliVertex::SetJetCopy* Invalid argument : " << j << endl;
783 }
784 }
785 else
786 {
787 cout << "*AliVertex::SetJetCopy* Storage already contained jets."
788 << " ==> JetCopy mode not changed." << endl;
789 }
790}
791///////////////////////////////////////////////////////////////////////////
792Int_t AliVertex::GetJetCopy()
793{
794// Provide value of the JetCopy mode.
795// 0 ==> No private copies are made; pointers of original jets are stored.
796// 1 ==> Private copies of the jets are made and these pointers are stored.
797 return fJetCopy;
d88f97cc 798}
799///////////////////////////////////////////////////////////////////////////
6516b62d 800Int_t AliVertex::IsConnectTrack(AliTrack* t)
801{
802// Indicate whether a track from the tracklist was created via the
803// connection of a (secondary) vertex or not.
804// In case the track was the result of (secondary) vertex addition the
805// return value is 1, otherwise the value 0 will be returned.
806 Int_t connect=0;
807 if (fConnects)
808 {
809 if (fConnects->FindObject(t)) connect=1;
810 }
811 return connect;
812}
813///////////////////////////////////////////////////////////////////////////
814Int_t AliVertex::IsJetTrack(AliTrack* t)
815{
816// Indicate whether a track from the tracklist was created via the
817// addition of a jet or not.
818// In case the track was the result of jet addition the return value is 1,
819// otherwise the value 0 will be returned.
820 Int_t jetflag=0;
821 if (fJetTracks)
822 {
823 if (fJetTracks->FindObject(t)) jetflag=1;
824 }
825 return jetflag;
826}
827///////////////////////////////////////////////////////////////////////////