1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.3 1999/09/29 09:24:28 fca
19 Introduction of the Copyright and cvs Log
23 ///////////////////////////////////////////////////////////////////////////
25 // Creation and investigation of an AliVertex.
26 // An AliVertex can be constructed by adding AliTracks and/or AliJets.
28 // Note : Also (secondary) vertices can be added to a vertex.
30 // Coding example to make 3 vertices v1, v2 and v3.
31 // ------------------------------------------------
32 // v1 contains the tracks 1,2,3 and 4
33 // v2 contains the tracks 5,6 and 7
34 // v3 contains the jets 1 and 2
36 // AliTrack t1,t2,t3,t4,t5,t6,t7;
38 // ... // code to fill the track data
43 // ... // code to fill the jet data
53 // Float_t r1[3]={2.4,0.1,-8.5};
54 // v1.SetPosition(r1,"car");
61 // Float_t r2[3]={1.6,-3.2,5.7};
62 // v2.SetPosition(r2,"car");
69 // Float_t r3[3]={6.2,4.8,1.3};
70 // v3.SetPosition(r3,"car");
76 // Float_t e1=v1.GetEnergy();
77 // Ali3Vector p1=v1.Get3Momentum();
79 // v1.GetPosition(loc,"sph");
80 // AliPosition r=v2.GetPosition();
82 // Int_t nt=v2.GetNtracks();
83 // AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
85 // Specify the vertices v2 and v3 as secondary vertices of v1
92 // Int_t nv=v1.GetNvtx();
93 // AliVertex* vx=v1.GetVertex(1); // Access 1st secondary vertex of v1
94 // Float_t e=vx->GetEnergy();
96 // Float_t M=v1.GetInvmass();
98 // Reconstruct Vertex v1 from scratch
101 // v1.SetNvmax(25); // Increase initial no. of sec. vertices
105 // Float_t pos[3]={7,9,4};
106 // v1.SetPosition(pos,"car");
108 // Note : All quantities are in GeV, GeV/c or GeV/c**2
110 //--- Author: Nick van Eijndhoven 04-apr-1998 UU-SAP Utrecht
111 //- Modified: NvE 08-apr-1999 UU-SAP Utrecht to inherit from AliJet
112 ///////////////////////////////////////////////////////////////////////////
114 #include "AliVertex.h"
116 ClassImp(AliVertex) // Class implementation to enable ROOT I/O
118 AliVertex::AliVertex()
120 // Default constructor.
121 // All variables initialised to 0.
122 // Initial maximum number of tracks is set to the default value.
123 // Initial maximum number of sec. vertices is set to the default value.
130 ///////////////////////////////////////////////////////////////////////////
131 AliVertex::AliVertex(Int_t n)
133 // Create a vertex to hold initially a maximum of n tracks
134 // All variables initialised to 0
145 cout << " *AliVertex* Initial max. number of tracks entered : " << n << endl;
146 cout << " This is invalid. Default initial maximum will be used." << endl;
152 ///////////////////////////////////////////////////////////////////////////
153 AliVertex::~AliVertex()
155 // Default destructor
156 if (fVertices) delete fVertices;
159 ///////////////////////////////////////////////////////////////////////////
160 void AliVertex::SetNvmax(Int_t n)
162 // Set the initial maximum number of (secondary) vertices
171 if (fVertices) delete fVertices;
172 fVertices=new TObjArray(fNvmax);
174 ///////////////////////////////////////////////////////////////////////////
175 void AliVertex::Reset()
177 // Reset all variables to 0
178 // The max. number of tracks is set to the initial value again
179 // The max. number of vertices is set to the default value again
184 if (fNvmax>0) SetNvmax(fNvmax);
186 ///////////////////////////////////////////////////////////////////////////
187 void AliVertex::Add(AliJet& j)
189 // Add the tracks of a jet to the vertex
191 for (Int_t i=1; i<=j.GetNtracks(); i++)
197 ///////////////////////////////////////////////////////////////////////////
198 void AliVertex::Add(AliVertex& v)
200 // Add a (secondary) vertex to the current vertex.
201 // In case the maximum number of (secondary) vertices has been reached,
202 // the array space will be extended automatically
204 // Note : The 4-momentum of the current (primary) vertex
205 // is updated automatically, but the track connecting
206 // both vertices has to be entered separately by the user.
208 if (fNvtx == fNvmax) // Check if maximum vertex number is reached
211 fVertices->Expand(fNvmax);
214 // Update 4-momentum for current vertex
217 (Ali4Vector)(*this)+=v;
219 ///////////////////////////////////////////////////////////////////////////
220 void AliVertex::Info(TString f)
222 // Provide vertex information within the coordinate frame f
223 cout << " *AliVertex::Info* Invmass : " << GetInvmass()
224 << " Charge : " << GetCharge() << " Momentum : " << GetMomentum()
225 << " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx << endl;
229 AliPosition::Info(f);
231 ///////////////////////////////////////////////////////////////////////////
232 void AliVertex::List(TString f)
234 // Provide primary track and sec. vertex information within the coordinate frame f
236 Info(f); // Information of the current vertex
238 // The tracks of this vertex
240 for (Int_t it=1; it<=GetNtracks(); it++)
245 cout << " ---Track no. " << it << endl;
251 cout << " *AliVertex::List* Error : No track present." << endl;
255 // The secondary vertices of this vertex
257 for (Int_t iv=1; iv<=GetNvertices(); iv++)
262 cout << " ---Level 1 sec. vertex no. " << iv << endl;
268 cout << " *AliVertex::List* Error : No sec. vertex present." << endl;
272 ///////////////////////////////////////////////////////////////////////////
273 void AliVertex::ListAll(TString f)
275 // Provide complete (sec) vertex and (decay) track info within the coordinate frame f
277 Info(f); // Information of the current vertex
279 // The tracks of this vertex
281 for (Int_t it=1; it<=GetNtracks(); it++)
286 cout << " ---Track no. " << it << endl;
292 cout << " *AliVertex::ListAll* Error : No track present." << endl;
297 Dump(v,1,f); // Information of all sec. vertices
299 //////////////////////////////////////////////////////////////////////////
300 void AliVertex::Dump(AliVertex* v,Int_t n,TString f)
302 // Recursively provide the info of all secondary vertices of this vertex
304 for (Int_t iv=1; iv<=v->GetNvertices(); iv++)
309 cout << " ---Level " << n << " sec. vertex no. " << iv << endl;
313 // The tracks of this vertex
315 for (Int_t it=1; it<=vs->GetNtracks(); it++)
320 cout << " ---Track no. " << it << endl;
326 cout << " *AliVertex::Dump* Error : No track present." << endl;
330 // Go for next sec. vertex level of this sec. vertex recursively
335 cout << " *AliVertex::Dump* Error : No sec. vertex present." << endl;
339 //////////////////////////////////////////////////////////////////////////
340 Int_t AliVertex::GetNvertices()
342 // Return the current number of (secondary) vertices
345 ///////////////////////////////////////////////////////////////////////////
346 AliVertex* AliVertex::GetVertex(Int_t i)
348 // Return the i-th (secondary) vertex of the current vertex
349 return (AliVertex*)fVertices->At(i-1);
351 ///////////////////////////////////////////////////////////////////////////