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.4 1999/11/03 14:23:18 fca
19 New version of RALICE introduced
21 Revision 1.3 1999/09/29 09:24:28 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////
28 // Creation and investigation of an AliVertex.
29 // An AliVertex can be constructed by adding AliTracks and/or AliJets.
31 // Note : Also (secondary) vertices can be added to a vertex.
33 // Coding example to make 3 vertices v1, v2 and v3.
34 // ------------------------------------------------
35 // v1 contains the tracks 1,2,3 and 4
36 // v2 contains the tracks 5,6 and 7
37 // v3 contains the jets 1 and 2
39 // AliTrack t1,t2,t3,t4,t5,t6,t7;
41 // ... // code to fill the track data
46 // ... // code to fill the jet data
56 // Float_t r1[3]={2.4,0.1,-8.5};
57 // v1.SetPosition(r1,"car");
64 // Float_t r2[3]={1.6,-3.2,5.7};
65 // v2.SetPosition(r2,"car");
72 // Float_t r3[3]={6.2,4.8,1.3};
73 // v3.SetPosition(r3,"car");
79 // Float_t e1=v1.GetEnergy();
80 // Ali3Vector p1=v1.Get3Momentum();
82 // v1.GetPosition(loc,"sph");
83 // AliPosition r=v2.GetPosition();
85 // Int_t nt=v2.GetNtracks();
86 // AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
88 // Specify the vertices v2 and v3 as secondary vertices of v1
95 // Int_t nv=v1.GetNvtx();
96 // AliVertex* vx=v1.GetVertex(1); // Access 1st secondary vertex of v1
97 // Float_t e=vx->GetEnergy();
99 // Float_t M=v1.GetInvmass();
101 // Reconstruct Vertex v1 from scratch
104 // v1.SetNvmax(25); // Increase initial no. of sec. vertices
108 // Float_t pos[3]={7,9,4};
109 // v1.SetPosition(pos,"car");
111 // Note : All quantities are in GeV, GeV/c or GeV/c**2
113 //--- Author: Nick van Eijndhoven 04-apr-1998 UU-SAP Utrecht
114 //- Modified: NvE 08-apr-1999 UU-SAP Utrecht to inherit from AliJet
115 ///////////////////////////////////////////////////////////////////////////
117 #include "AliVertex.h"
119 ClassImp(AliVertex) // Class implementation to enable ROOT I/O
121 AliVertex::AliVertex()
123 // Default constructor.
124 // All variables initialised to 0.
125 // Initial maximum number of tracks is set to the default value.
126 // Initial maximum number of sec. vertices is set to the default value.
134 ///////////////////////////////////////////////////////////////////////////
135 AliVertex::AliVertex(Int_t n)
137 // Create a vertex to hold initially a maximum of n tracks
138 // All variables initialised to 0
150 cout << " *AliVertex* Initial max. number of tracks entered : " << n << endl;
151 cout << " This is invalid. Default initial maximum will be used." << endl;
157 ///////////////////////////////////////////////////////////////////////////
158 AliVertex::~AliVertex()
160 // Default destructor
161 if (fVertices) delete fVertices;
170 ///////////////////////////////////////////////////////////////////////////
171 void AliVertex::SetNvmax(Int_t n)
173 // Set the initial maximum number of (secondary) vertices
182 if (fVertices) delete fVertices;
183 fVertices=new TObjArray(fNvmax);
185 ///////////////////////////////////////////////////////////////////////////
186 void AliVertex::Reset()
188 // Reset all variables to 0
189 // The max. number of tracks is set to the initial value again
190 // The max. number of vertices is set to the default value again
195 if (fNvmax>0) SetNvmax(fNvmax);
203 ///////////////////////////////////////////////////////////////////////////
204 void AliVertex::Add(AliJet& j)
206 // Add the tracks of a jet to the vertex
208 for (Int_t i=1; i<=j.GetNtracks(); i++)
214 ///////////////////////////////////////////////////////////////////////////
215 void AliVertex::Add(AliVertex& v,Int_t connect)
217 // Add a (secondary) vertex to the current vertex.
218 // In case the maximum number of (secondary) vertices has been reached,
219 // the array space will be extended automatically
221 // Note : By default the 4-momentum and charge of the current (primary) vertex
222 // are updated by automatically creating the track connecting
223 // both vertices. The track parameters are taken from the
224 // 4-momentum and charge of the secondary vertex.
225 // The automatic creation of the connecting track and updating
226 // of the (primary) vertex 4-momentum and charge can be suppressed
227 // by specifying connect=0. In this case, however, the user
228 // has to introduce the connecting track lateron by hand
229 // explicitly in order to match the kinematics and charge.
231 if (fNvtx == fNvmax) // Check if maximum vertex number is reached
234 fVertices->Expand(fNvmax);
237 // Add the linked (secondary) vertex to the list
241 // Create connecting track and update 4-momentum and charge for current vertex
244 AliPosition r1=GetPosition();
245 AliPosition r2=v.GetPosition();
246 Float_t q=v.GetCharge();
247 Ali3Vector p=v.Get3Momentum();
248 Double_t v2=v.GetInvariant();
249 Double_t dv2=v.Ali4Vector::GetResultError();
251 AliTrack* t=new AliTrack;
252 t->SetBeginPoint(r1);
256 t->SetInvariant(v2,dv2);
260 if (!fConnects) fConnects=new TObjArray(fNvmax);
264 ///////////////////////////////////////////////////////////////////////////
265 void AliVertex::Info(TString f)
267 // Provide vertex information within the coordinate frame f
268 cout << " *AliVertex::Info* Invmass : " << GetInvmass()
269 << " Charge : " << GetCharge() << " Momentum : " << GetMomentum()
270 << " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx << endl;
274 AliPosition::Info(f);
276 ///////////////////////////////////////////////////////////////////////////
277 void AliVertex::List(TString f)
279 // Provide primary track and sec. vertex information within the coordinate frame f
281 Info(f); // Information of the current vertex
283 // The tracks of this vertex
285 for (Int_t it=1; it<=GetNtracks(); it++)
290 cout << " ---Track no. " << it << endl;
296 cout << " *AliVertex::List* Error : No track present." << endl;
300 // The secondary vertices of this vertex
302 for (Int_t iv=1; iv<=GetNvertices(); iv++)
307 cout << " ---Level 1 sec. vertex no. " << iv << endl;
313 cout << " *AliVertex::List* Error : No sec. vertex present." << endl;
317 ///////////////////////////////////////////////////////////////////////////
318 void AliVertex::ListAll(TString f)
320 // Provide complete (sec) vertex and (decay) track info within the coordinate frame f
322 Info(f); // Information of the current vertex
324 // The tracks of this vertex
326 for (Int_t it=1; it<=GetNtracks(); it++)
331 cout << " ---Track no. " << it << endl;
337 cout << " *AliVertex::ListAll* Error : No track present." << endl;
342 Dump(v,1,f); // Information of all sec. vertices
344 //////////////////////////////////////////////////////////////////////////
345 void AliVertex::Dump(AliVertex* v,Int_t n,TString f)
347 // Recursively provide the info of all secondary vertices of this vertex
349 for (Int_t iv=1; iv<=v->GetNvertices(); iv++)
354 cout << " ---Level " << n << " sec. vertex no. " << iv << endl;
358 // The tracks of this vertex
360 for (Int_t it=1; it<=vs->GetNtracks(); it++)
365 cout << " ---Track no. " << it << endl;
371 cout << " *AliVertex::Dump* Error : No track present." << endl;
375 // Go for next sec. vertex level of this sec. vertex recursively
380 cout << " *AliVertex::Dump* Error : No sec. vertex present." << endl;
384 //////////////////////////////////////////////////////////////////////////
385 Int_t AliVertex::GetNvertices()
387 // Return the current number of (secondary) vertices
390 ///////////////////////////////////////////////////////////////////////////
391 AliVertex* AliVertex::GetVertex(Int_t i)
393 // Return the i-th (secondary) vertex of the current vertex
394 return (AliVertex*)fVertices->At(i-1);
396 ///////////////////////////////////////////////////////////////////////////