]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliEvent.cxx
08-mar-2003 NvE Compiler option /GR introduced for MSVC++ in mklibs.bat to explicitly...
[u/mrichter/AliRoot.git] / RALICE / AliEvent.cxx
index 4ef2b3cab35274290b3383fa09fe239e4548441f..84414d23c169702b67e2dd3b116c49bac5d1f4b0 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliEvent.cxx,v 1.9 2003/01/09 16:06:35 nick Exp $
+// $Id: AliEvent.cxx,v 1.11 2003/02/25 12:36:28 nick Exp $
 
 ///////////////////////////////////////////////////////////////////////////
 // Class AliEvent
 // 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: 2003/01/09 16:06:35 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2003/02/25 12:36:28 $ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliEvent.h"
+#include "Riostream.h"
  
 ClassImp(AliEvent) // Class implementation to enable ROOT I/O
  
-AliEvent::AliEvent()
+AliEvent::AliEvent() : AliVertex()
 {
 // Default constructor.
 // All variables initialised to default values.
@@ -216,10 +217,14 @@ AliEvent::AliEvent()
  fCalCopy=0;
 }
 ///////////////////////////////////////////////////////////////////////////
-AliEvent::AliEvent(Int_t n): AliVertex(n)
+AliEvent::AliEvent(Int_t n) : AliVertex(n)
 {
 // Create an event to hold initially a maximum of n tracks
 // All variables initialised to default values
+ if (n<=0)
+ {
+  cout << " *** This AliVertex initialisation was invoked via the AliEvent ctor." << endl;
+ }
  fDaytime.Set();
  fRun=0;
  fEvent=0;
@@ -246,12 +251,55 @@ AliEvent::~AliEvent()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+AliEvent::AliEvent(AliEvent& evt) : AliVertex(evt)
+{
+// Copy constructor.
+ fDaytime=evt.fDaytime;
+ fRun=evt.fRun;
+ fEvent=evt.fEvent;
+ fAproj=evt.fAproj;
+ fZproj=evt.fZproj;
+ fPnucProj=evt.fPnucProj;
+ fIdProj=evt.fIdProj;
+ fAtarg=evt.fAtarg;
+ fZtarg=evt.fZtarg;
+ fPnucTarg=evt.fPnucTarg;
+ fIdTarg=evt.fIdTarg;
+ fNcals=evt.fNcals;
+ fCalCopy=evt.fCalCopy;
+
+ fCalorimeters=0;
+ if (fNcals)
+ {
+  fCalorimeters=new TObjArray(fNcals);
+  if (fCalCopy) fCalorimeters->SetOwner();
+  for (Int_t i=1; i<=fNcals; i++)
+  {
+   AliCalorimeter* cal=evt.GetCalorimeter(i);
+   if (cal)
+   {
+    if (fCalCopy)
+    {
+     fCalorimeters->Add(new AliCalorimeter(*cal));
+    }
+    else
+    {
+     fCalorimeters->Add(cal);
+    }
+   }
+  }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
 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
 // Note : The CalCopy mode is maintained as it was set by the user before.
+
+ AliVertex::Reset();
+
  fDaytime.Set();
  fRun=0;
  fEvent=0;
@@ -270,8 +318,6 @@ void AliEvent::Reset()
   delete fCalorimeters;
   fCalorimeters=0;
  }
-
- AliVertex::Reset();
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetOwner(Bool_t own)
@@ -410,25 +456,10 @@ Int_t AliEvent::GetTargetId()
 void AliEvent::HeaderData()
 {
 // 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;
+ cout << " *AliEvent::Data* Run : " << fRun << " Event : " << fEvent
+      << " Date : " << fDaytime.AsString() << endl;
 
- char* c[12]={"jan","feb","mar","apr","may","jun",
-              "jul","aug","sep","oct","nov","dec"};
-
- cout << " *AliEvent::Data* 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;
- cout.fill(' ');
- cout << " Ncalorimeters : " << fNcals << endl;
+ ShowCalorimeters();
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::Data(TString f)
@@ -457,11 +488,11 @@ void AliEvent::AddCalorimeter(AliCalorimeter& c)
  fNcals++;
  if (fCalCopy)
  {
-  fCalorimeters->AddLast((AliCalorimeter*)c.Clone());
+  fCalorimeters->Add(new AliCalorimeter(c));
  }
  else
  {
-  fCalorimeters->AddLast(&c);
+  fCalorimeters->Add(&c);
  }
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -550,4 +581,22 @@ AliCalorimeter* AliEvent::GetCalorimeter(TString name)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliEvent::ShowCalorimeters()
+{
+// Provide an overview of the available calorimeter systems.
+ if (fNcals>0)
+ {
+  cout << " The following " << fNcals << " calorimeter systems are available :" << endl; 
+  for (Int_t i=1; i<=fNcals; i++)
+  {
+   AliCalorimeter* cal=GetCalorimeter(i);
+   if (cal) cout << " Calorimeter number : " << i << " Name : " << (cal->GetName()).Data() << endl;
+  }
+ }
+ else
+ {
+  cout << " No calorimeters present for this event." << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////