29-jun-2001 NvE TrackCopy mode introduced in AliJet.
[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;
d16062ac 124}
125///////////////////////////////////////////////////////////////////////////
81508922 126AliEvent::AliEvent(Int_t n): AliVertex(n)
d16062ac 127{
128// Create an event to hold initially a maximum of n tracks
129// All variables initialised to default values
130 fDaytime.Set();
131 fRun=0;
132 fEvent=0;
d16062ac 133}
134///////////////////////////////////////////////////////////////////////////
135AliEvent::~AliEvent()
136{
137// Default destructor
138}
139///////////////////////////////////////////////////////////////////////////
140void AliEvent::Reset()
141{
142// Reset all variables to default values
143// The max. number of tracks is set to the initial value again
144// The max. number of vertices is set to the default value again
145 fDaytime.Set();
146 fRun=0;
147 fEvent=0;
148
149 AliVertex::Reset();
150}
151///////////////////////////////////////////////////////////////////////////
152void AliEvent::SetDayTime(TDatime& stamp)
153{
154// Set the date and time stamp for this event
155 fDaytime=stamp;
156}
157///////////////////////////////////////////////////////////////////////////
158void AliEvent::SetRunNumber(Int_t run)
159{
160// Set the run number for this event
161 fRun=run;
162}
163///////////////////////////////////////////////////////////////////////////
164void AliEvent::SetEventNumber(Int_t evt)
165{
166// Set the event number for this event
167 fEvent=evt;
168}
169///////////////////////////////////////////////////////////////////////////
170TDatime AliEvent::GetDayTime()
171{
172// Provide the date and time stamp for this event
173 return fDaytime;
174}
175///////////////////////////////////////////////////////////////////////////
176Int_t AliEvent::GetRunNumber()
177{
178// Provide the run number for this event
179 return fRun;
180}
181///////////////////////////////////////////////////////////////////////////
182Int_t AliEvent::GetEventNumber()
183{
184// Provide the event number for this event
185 return fEvent;
186}
187///////////////////////////////////////////////////////////////////////////
188void AliEvent::HeaderInfo()
189{
190// Provide event header information
191 Int_t date=fDaytime.GetDate();
192 Int_t time=fDaytime.GetTime();
193
194 Int_t year=date/10000;
195 Int_t month=(date%10000)/100;
196 Int_t day=date%100;
197 Int_t hh=time/10000;
198 Int_t mm=(time%10000)/100;
199 Int_t ss=time%100;
200
201 char* c[12]={"jan","feb","mar","apr","may","jun",
202 "jul","aug","sep","oct","nov","dec"};
203
204 cout << " *AliEvent::Info* Run : " << fRun << " Event : " << fEvent;
205 cout.fill('0');
206 cout << " Date : " << setw(2) << day << "-" << c[month-1] << "-" << year
207 << " Time : " << setw(2) << hh << ":" << setw(2) << mm << ":" << setw(2) << ss << endl;
208 cout.fill(' ');
209}
210///////////////////////////////////////////////////////////////////////////
211void AliEvent::Info(TString f)
212{
213// Provide event information within the coordinate frame f
214 HeaderInfo();
215 AliVertex::Info(f);
216}
217///////////////////////////////////////////////////////////////////////////
218