AliEvent class added into repository.
authornick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Jun 2001 13:22:48 +0000 (13:22 +0000)
committernick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 6 Jun 2001 13:22:48 +0000 (13:22 +0000)
RALICE/AliEvent.cxx [new file with mode: 0644]
RALICE/AliEvent.h [new file with mode: 0644]

diff --git a/RALICE/AliEvent.cxx b/RALICE/AliEvent.cxx
new file mode 100644 (file)
index 0000000..acdf4cd
--- /dev/null
@@ -0,0 +1,231 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+// $Id$
+
+///////////////////////////////////////////////////////////////////////////
+// Class AliEvent
+// Creation and investigation of an Alice physics event.
+// An AliEvent can be constructed by adding AliTracks, Alivertices
+// and/or AliJets.
+//
+// The basic functionality of AliEvent is identical to the one of AliVertex.
+// So, an AliEvent may be regarded as the primary vertex with some
+// additional functionality compared to AliVertex.
+//
+// Coding example to make an event consisting of a primary vertex
+// and 2 secondary vertices.
+// --------------------------------------------------------------
+// v1 contains the tracks 1,2,3 and 4
+// v2 contains the tracks 5,6 and 7
+// v3 contains the jets 1 and 2
+//
+//        AliTrack t1,t2,t3,t4,t5,t6,t7;
+//         ...
+//         ... // code to fill the track data
+//         ...
+//
+//        AliJet j1,j2;
+//         ...
+//         ... // code to fill the jet data
+//         ...
+//
+//        AliEvent evt(5);
+//
+//        evt.AddTrack(t1);
+//        evt.AddTrack(t2);
+//        evt.AddTrack(t3);
+//        evt.AddTrack(t4);
+//
+//        Float_t r0[3]={2.4,0.1,-8.5};
+//        evt.SetPosition(r0,"car");
+//
+//        AliVertex v1(2);
+//        v1.AddTrack(t5);
+//        v1.AddTrack(t6);
+//        v1.AddTrack(t7);
+//
+//        Float_t r1[3]={1.6,-3.2,5.7};
+//        v1.SetPosition(r1,"car");
+//
+//        AliVertex v2;
+//
+//        v2.AddJet(j1);
+//        v2.AddJet(j2);
+//
+//        Float_t r2[3]={6.2,4.8,1.3};
+//        v2.SetPosition(r2,"car");
+//
+//        evt.Info("sph");
+//        v1.ListAll();
+//        v2.List("cyl");
+//
+//        Float_t etot=evt.GetEnergy();
+//        Ali3Vector ptot=evt.Get3Momentum();
+//        Float_t loc[3];
+//        evt.GetPosition(loc,"sph");
+//        AliPosition r=v1.GetPosition();
+//        r.Info(); 
+//        Int_t nt=v2.GetNtracks();
+//        AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
+//
+// Specify the vertices v2 and v3 as secondary vertices of the primary
+//
+//        evt.AddVertex(v2);
+//        evt.AddVertex(v3);
+//
+//        evt.List();
+//
+//        Int_t nv=evt.GetNvtx();
+//        AliVertex* vx=evt.GetVertex(1); // Access 1st secondary vertex
+//        Float_t e=vx->GetEnergy();
+//
+//        Float_t M=evt.GetInvmass(); 
+//
+// Reconstruct the event from scratch
+//
+//        evt.Reset();
+//        evt.SetNvmax(25); // Increase initial no. of sec. vertices
+//        evt.AddTrack(t3);
+//        evt.AddTrack(t7);
+//        evt.AddJet(j2);
+//        Float_t pos[3]={7,9,4};
+//        evt.SetPosition(pos,"car");
+//
+// Note : All quantities are in GeV, GeV/c or GeV/c**2
+//
+//--- Author: Nick van Eijndhoven 27-may-2001 UU-SAP Utrecht
+//- Modified: NvE $Date$ UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
+#include "AliEvent.h"
+ClassImp(AliEvent) // Class implementation to enable ROOT I/O
+AliEvent::AliEvent()
+{
+// Default constructor.
+// All variables initialised to default values.
+ fDaytime.Set();
+ fRun=0;
+ fEvent=0;
+ AliVertex::AliVertex();
+}
+///////////////////////////////////////////////////////////////////////////
+AliEvent::AliEvent(Int_t n)
+{
+// Create an event to hold initially a maximum of n tracks
+// All variables initialised to default values
+ fDaytime.Set();
+ fRun=0;
+ fEvent=0;
+ if (n > 0)
+ {
+  AliVertex::AliVertex(n);
+ }
+ else
+ {
+  cout << endl;
+  cout << " *AliEvent* Initial max. number of tracks entered : " << n << endl;
+  cout << " This is invalid. Default initial maximum will be used." << endl;
+  cout << endl;
+  AliVertex::AliVertex();
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+AliEvent::~AliEvent()
+{
+// Default destructor
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::Reset()
+{
+// Reset all variables to default values
+// The max. number of tracks is set to the initial value again
+// The max. number of vertices is set to the default value again
+ fDaytime.Set();
+ fRun=0;
+ fEvent=0;
+
+ AliVertex::Reset();
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::SetDayTime(TDatime& stamp)
+{
+// Set the date and time stamp for this event
+ fDaytime=stamp;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::SetRunNumber(Int_t run)
+{
+// Set the run number for this event
+ fRun=run;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::SetEventNumber(Int_t evt)
+{
+// Set the event number for this event
+ fEvent=evt;
+}
+///////////////////////////////////////////////////////////////////////////
+TDatime AliEvent::GetDayTime()
+{
+// Provide the date and time stamp for this event
+ return fDaytime;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliEvent::GetRunNumber()
+{
+// Provide the run number for this event
+ return fRun;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliEvent::GetEventNumber()
+{
+// Provide the event number for this event
+ return fEvent;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::HeaderInfo()
+{
+// Provide event header information
+ Int_t date=fDaytime.GetDate();
+ Int_t time=fDaytime.GetTime();
+
+ Int_t year=date/10000;
+ Int_t month=(date%10000)/100;
+ Int_t day=date%100;
+ Int_t hh=time/10000;
+ Int_t mm=(time%10000)/100;
+ Int_t ss=time%100;
+
+ char* c[12]={"jan","feb","mar","apr","may","jun",
+              "jul","aug","sep","oct","nov","dec"};
+
+ cout << " *AliEvent::Info* Run : " << fRun << " Event : " << fEvent;
+ cout.fill('0');
+ cout << " Date : " << setw(2) << day << "-" << c[month-1] << "-" << year
+      << " Time : " << setw(2) << hh << ":" << setw(2) << mm << ":" << setw(2) << ss << endl;
+ cout.fill(' ');
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::Info(TString f)
+{
+// Provide event information within the coordinate frame f
+ HeaderInfo();
+ AliVertex::Info(f);
+} 
+///////////////////////////////////////////////////////////////////////////
+
diff --git a/RALICE/AliEvent.h b/RALICE/AliEvent.h
new file mode 100644 (file)
index 0000000..408fdb4
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALIEVENT_H
+#define ALIEVENT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// $Id$
+
+#include <iomanip.h>
+#include <math.h>
+#include "TObject.h"
+#include "TObjArray.h"
+#include "TDatime.h"
+#include "AliVertex.h"
+class AliEvent : public AliVertex
+{
+ public:
+  AliEvent();                             // Default constructor
+  AliEvent(Int_t n);                      // Create an event to hold initially n tracks
+  ~AliEvent();                            // Default destructor
+  void SetDayTime(TDatime& stamp);        // Set the date and time stamp
+  void SetRunNumber(Int_t run);           // Set the run number
+  void SetEventNumber(Int_t evt);         // Set the event number
+  void Reset();                           // Reset all values
+  TDatime GetDayTime();                   // Provide the date and time stamp
+  Int_t GetRunNumber();                   // Provide the run number
+  Int_t GetEventNumber();                 // Provide the event number
+  void HeaderInfo();                      // Print the event header information
+  void Info(TString f="car");             // Print the event info within coordinate frame f
+
+ protected:
+  TDatime fDaytime;      // The date and time stamp
+  Int_t fRun;            // The run number
+  Int_t fEvent;          // The event number
+
+ ClassDef(AliEvent,1) // Creation and investigation of an Alice physics event.
+};
+#endif