]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RALICE/AliEvent.cxx
AliEvent class added into repository.
[u/mrichter/AliRoot.git] / RALICE / AliEvent.cxx
CommitLineData
d16062ac 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
16// $Id$
17
18///////////////////////////////////////////////////////////////////////////
19// Class AliEvent
20// Creation and investigation of an Alice physics event.
21// An AliEvent can be constructed by adding AliTracks, Alivertices
22// and/or AliJets.
23//
24// The basic functionality of AliEvent is identical to the one of AliVertex.
25// So, an AliEvent may be regarded as the primary vertex with some
26// additional functionality compared to AliVertex.
27//
28// Coding example to make an event consisting of a primary vertex
29// and 2 secondary vertices.
30// --------------------------------------------------------------
31// v1 contains the tracks 1,2,3 and 4
32// v2 contains the tracks 5,6 and 7
33// v3 contains the jets 1 and 2
34//
35// AliTrack t1,t2,t3,t4,t5,t6,t7;
36// ...
37// ... // code to fill the track data
38// ...
39//
40// AliJet j1,j2;
41// ...
42// ... // code to fill the jet data
43// ...
44//
45// AliEvent evt(5);
46//
47// evt.AddTrack(t1);
48// evt.AddTrack(t2);
49// evt.AddTrack(t3);
50// evt.AddTrack(t4);
51//
52// Float_t r0[3]={2.4,0.1,-8.5};
53// evt.SetPosition(r0,"car");
54//
55// AliVertex v1(2);
56// v1.AddTrack(t5);
57// v1.AddTrack(t6);
58// v1.AddTrack(t7);
59//
60// Float_t r1[3]={1.6,-3.2,5.7};
61// v1.SetPosition(r1,"car");
62//
63// AliVertex v2;
64//
65// v2.AddJet(j1);
66// v2.AddJet(j2);
67//
68// Float_t r2[3]={6.2,4.8,1.3};
69// v2.SetPosition(r2,"car");
70//
71// evt.Info("sph");
72// v1.ListAll();
73// v2.List("cyl");
74//
75// Float_t etot=evt.GetEnergy();
76// Ali3Vector ptot=evt.Get3Momentum();
77// Float_t loc[3];
78// evt.GetPosition(loc,"sph");
79// AliPosition r=v1.GetPosition();
80// r.Info();
81// Int_t nt=v2.GetNtracks();
82// AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
83//
84// Specify the vertices v2 and v3 as secondary vertices of the primary
85//
86// evt.AddVertex(v2);
87// evt.AddVertex(v3);
88//
89// evt.List();
90//
91// Int_t nv=evt.GetNvtx();
92// AliVertex* vx=evt.GetVertex(1); // Access 1st secondary vertex
93// Float_t e=vx->GetEnergy();
94//
95// Float_t M=evt.GetInvmass();
96//
97// Reconstruct the event from scratch
98//
99// evt.Reset();
100// evt.SetNvmax(25); // Increase initial no. of sec. vertices
101// evt.AddTrack(t3);
102// evt.AddTrack(t7);
103// evt.AddJet(j2);
104// Float_t pos[3]={7,9,4};
105// evt.SetPosition(pos,"car");
106//
107// Note : All quantities are in GeV, GeV/c or GeV/c**2
108//
109//--- Author: Nick van Eijndhoven 27-may-2001 UU-SAP Utrecht
110//- Modified: NvE $Date$ UU-SAP Utrecht
111///////////////////////////////////////////////////////////////////////////
112
113#include "AliEvent.h"
114
115ClassImp(AliEvent) // Class implementation to enable ROOT I/O
116
117AliEvent::AliEvent()
118{
119// Default constructor.
120// All variables initialised to default values.
121 fDaytime.Set();
122 fRun=0;
123 fEvent=0;
124 AliVertex::AliVertex();
125}
126///////////////////////////////////////////////////////////////////////////
127AliEvent::AliEvent(Int_t n)
128{
129// Create an event to hold initially a maximum of n tracks
130// All variables initialised to default values
131 fDaytime.Set();
132 fRun=0;
133 fEvent=0;
134 if (n > 0)
135 {
136 AliVertex::AliVertex(n);
137 }
138 else
139 {
140 cout << endl;
141 cout << " *AliEvent* Initial max. number of tracks entered : " << n << endl;
142 cout << " This is invalid. Default initial maximum will be used." << endl;
143 cout << endl;
144 AliVertex::AliVertex();
145 }
146}
147///////////////////////////////////////////////////////////////////////////
148AliEvent::~AliEvent()
149{
150// Default destructor
151}
152///////////////////////////////////////////////////////////////////////////
153void AliEvent::Reset()
154{
155// Reset all variables to default values
156// The max. number of tracks is set to the initial value again
157// The max. number of vertices is set to the default value again
158 fDaytime.Set();
159 fRun=0;
160 fEvent=0;
161
162 AliVertex::Reset();
163}
164///////////////////////////////////////////////////////////////////////////
165void AliEvent::SetDayTime(TDatime& stamp)
166{
167// Set the date and time stamp for this event
168 fDaytime=stamp;
169}
170///////////////////////////////////////////////////////////////////////////
171void AliEvent::SetRunNumber(Int_t run)
172{
173// Set the run number for this event
174 fRun=run;
175}
176///////////////////////////////////////////////////////////////////////////
177void AliEvent::SetEventNumber(Int_t evt)
178{
179// Set the event number for this event
180 fEvent=evt;
181}
182///////////////////////////////////////////////////////////////////////////
183TDatime AliEvent::GetDayTime()
184{
185// Provide the date and time stamp for this event
186 return fDaytime;
187}
188///////////////////////////////////////////////////////////////////////////
189Int_t AliEvent::GetRunNumber()
190{
191// Provide the run number for this event
192 return fRun;
193}
194///////////////////////////////////////////////////////////////////////////
195Int_t AliEvent::GetEventNumber()
196{
197// Provide the event number for this event
198 return fEvent;
199}
200///////////////////////////////////////////////////////////////////////////
201void AliEvent::HeaderInfo()
202{
203// Provide event header information
204 Int_t date=fDaytime.GetDate();
205 Int_t time=fDaytime.GetTime();
206
207 Int_t year=date/10000;
208 Int_t month=(date%10000)/100;
209 Int_t day=date%100;
210 Int_t hh=time/10000;
211 Int_t mm=(time%10000)/100;
212 Int_t ss=time%100;
213
214 char* c[12]={"jan","feb","mar","apr","may","jun",
215 "jul","aug","sep","oct","nov","dec"};
216
217 cout << " *AliEvent::Info* Run : " << fRun << " Event : " << fEvent;
218 cout.fill('0');
219 cout << " Date : " << setw(2) << day << "-" << c[month-1] << "-" << year
220 << " Time : " << setw(2) << hh << ":" << setw(2) << mm << ":" << setw(2) << ss << endl;
221 cout.fill(' ');
222}
223///////////////////////////////////////////////////////////////////////////
224void AliEvent::Info(TString f)
225{
226// Provide event information within the coordinate frame f
227 HeaderInfo();
228 AliVertex::Info(f);
229}
230///////////////////////////////////////////////////////////////////////////
231