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 **************************************************************************/
20 #include "AliVertex.h"
22 ClassImp(AliVertex) // Class implementation to enable ROOT I/O
24 AliVertex::AliVertex()
26 // Default constructor
27 // All variables initialised to 0
28 // Initial maximum number of tracks is set to the default value
29 // Initial maximum number of sec. vertices is set to the default value
36 ///////////////////////////////////////////////////////////////////////////
37 AliVertex::AliVertex(Int_t n)
39 // Create a vertex to hold initially a maximum of n tracks
40 // All variables initialised to 0
51 cout << " *AliVertex* Initial max. number of tracks entered : " << n << endl;
52 cout << " This is invalid. Default initial maximum will be used." << endl;
58 ///////////////////////////////////////////////////////////////////////////
59 AliVertex::~AliVertex()
62 if (fVertices) delete fVertices;
65 ///////////////////////////////////////////////////////////////////////////
66 void AliVertex::SetNvmax(Int_t n)
68 // Set the initial maximum number of (secondary) vertices
77 if (fVertices) delete fVertices;
78 fVertices=new TObjArray(fNvmax);
80 ///////////////////////////////////////////////////////////////////////////
81 void AliVertex::Reset()
83 // Reset all variables to 0
84 // The max. number of tracks is set to the initial value again
85 // The max. number of vertices is set to the default value again
90 if (fNvmax>0) SetNvmax(fNvmax);
92 ///////////////////////////////////////////////////////////////////////////
93 void AliVertex::Add(AliJet& j)
95 // Add the tracks of a jet to the vertex
97 for (Int_t i=1; i<=j.GetNtracks(); i++)
103 ///////////////////////////////////////////////////////////////////////////
104 void AliVertex::Add(AliVertex& v)
106 // Add a (secondary) vertex to the current vertex.
107 // In case the maximum number of (secondary) vertices has been reached,
108 // the array space will be extended automatically
110 // Note : The 4-momentum of the current (primary) vertex
111 // is updated automatically, but the track connecting
112 // both vertices has to be entered separately by the user.
114 if (fNvtx == fNvmax) // Check if maximum vertex number is reached
117 fVertices->Expand(fNvmax);
120 // Update 4-momentum for current vertex
123 (*(Ali4Vector*)this)+=v;
125 ///////////////////////////////////////////////////////////////////////////
126 void AliVertex::Info(TString f)
128 // Provide vertex information within the coordinate frame f
129 cout << " *AliVertex::Info* Invmass : " << GetInvmass()
130 << " Charge : " << GetCharge() << " Momentum : " << GetMomentum()
131 << " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx << endl;
135 AliPosition::Info(f);
137 ///////////////////////////////////////////////////////////////////////////
138 void AliVertex::List(TString f)
140 // Provide primary track and sec. vertex information within the coordinate frame f
142 Info(f); // Information of the current vertex
144 // The tracks of this vertex
146 for (Int_t it=1; it<=GetNtracks(); it++)
151 cout << " ---Track no. " << it << endl;
157 cout << " *AliVertex::List* Error : No track present." << endl;
161 // The secondary vertices of this vertex
163 for (Int_t iv=1; iv<=GetNvertices(); iv++)
168 cout << " ---Level 1 sec. vertex no. " << iv << endl;
174 cout << " *AliVertex::List* Error : No sec. vertex present." << endl;
178 ///////////////////////////////////////////////////////////////////////////
179 void AliVertex::ListAll(TString f)
181 // Provide complete (sec) vertex and (decay) track info within the coordinate frame f
183 Info(f); // Information of the current vertex
185 // The tracks of this vertex
187 for (Int_t it=1; it<=GetNtracks(); it++)
192 cout << " ---Track no. " << it << endl;
198 cout << " *AliVertex::ListAll* Error : No track present." << endl;
203 Dump(v,1,f); // Information of all sec. vertices
205 //////////////////////////////////////////////////////////////////////////
206 void AliVertex::Dump(AliVertex* v,Int_t n,TString f)
208 // Recursively provide the info of all secondary vertices of this vertex
210 for (Int_t iv=1; iv<=v->GetNvertices(); iv++)
215 cout << " ---Level " << n << " sec. vertex no. " << iv << endl;
219 // The tracks of this vertex
221 for (Int_t it=1; it<=vs->GetNtracks(); it++)
226 cout << " ---Track no. " << it << endl;
232 cout << " *AliVertex::Dump* Error : No track present." << endl;
236 // Go for next sec. vertex level of this sec. vertex recursively
241 cout << " *AliVertex::Dump* Error : No sec. vertex present." << endl;
245 //////////////////////////////////////////////////////////////////////////
246 Int_t AliVertex::GetNvertices()
248 // Return the current number of (secondary) vertices
251 ///////////////////////////////////////////////////////////////////////////
252 AliVertex* AliVertex::GetVertex(Int_t i)
254 // Return the i-th (secondary) vertex of the current vertex
255 return (AliVertex*)fVertices->At(i-1);
257 ///////////////////////////////////////////////////////////////////////////