]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliEvent.cxx
Coding Convention Violation correction
[u/mrichter/AliRoot.git] / RALICE / AliEvent.cxx
index e8e6c170c4f6f65cfb492a538115771d50f43ee0..54ca223f729144fd365195138d70f9faf36825ff 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliEvent.cxx,v 1.13 2003/08/29 09:05:11 nick Exp $
+// $Id: AliEvent.cxx,v 1.18 2004/01/12 08:23:22 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/08/29 09:05:11 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2004/01/12 08:23:22 $ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliEvent.h"
@@ -358,12 +358,26 @@ void AliEvent::SetOwner(Bool_t own)
  AliVertex::SetOwner(own);
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::SetDayTime(TDatime& stamp)
+void AliEvent::SetDayTime(TTimeStamp& stamp)
 {
-// Set the date and time stamp for this event
+// Set the date and time stamp for this event.
+// An exact copy of the entered date/time stamp will be saved with an
+// accuracy of 1 nanosecond.
  fDaytime=stamp;
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliEvent::SetDayTime(TDatime& stamp)
+{
+// Set the date and time stamp for this event.
+// The entered date/time will be interpreted as being the local date/time
+// and the accuracy is 1 second.
+// This function with the TDatime argument is mainly kept for backward
+// compatibility reasons. It is recommended to use the corresponding
+// function with the TTimeStamp argument.
+
+ fDaytime.Set(stamp.GetDate(),stamp.GetTime(),0,kFALSE,0);
+}
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetRunNumber(Int_t run)
 {
 // Set the run number for this event
@@ -376,7 +390,7 @@ void AliEvent::SetEventNumber(Int_t evt)
  fEvent=evt;
 }
 ///////////////////////////////////////////////////////////////////////////
-TDatime AliEvent::GetDayTime()
+TTimeStamp AliEvent::GetDayTime()
 {
 // Provide the date and time stamp for this event
  return fDaytime;
@@ -465,10 +479,18 @@ Int_t AliEvent::GetTargetId()
 void AliEvent::HeaderData()
 {
 // Provide event header information
- cout << " *" << ClassName() << "::Data* Run : " << fRun << " Event : " << fEvent
-      << " Date : " << fDaytime.AsString() << endl;
+ const char* name=GetName();
+ const char* title=GetTitle();
+ Int_t ndevs=GetNdevices();
+ cout << " *" << ClassName() << "::Data*";
+ if (strlen(name))  cout << " Name : " << GetName();
+ if (strlen(title)) cout << " Title : " << GetTitle();
+ cout << endl;
+ cout << "  " << fDaytime.AsString() << endl;
+ cout << "  Run : " << fRun << " Event : " << fEvent
+      << " Number of devices : " << ndevs << endl;
 
- ShowDevices();
if (ndevs) ShowDevices();
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::Data(TString f)
@@ -583,7 +605,6 @@ TObject* AliEvent::GetDevice(Int_t i)
 
  if (!fDevices)
  {
-  cout << " *AliEvent::GetDevice* No devices present." << endl;
   return 0;
  }
  else
@@ -607,7 +628,6 @@ TObject* AliEvent::GetDevice(TString name)
 // Return the device with name tag "name"
  if (!fDevices)
  {
-  cout << " *" << ClassName() << "::GetDevice* No devices present." << endl;
   return 0;
  }
  else
@@ -652,4 +672,22 @@ void AliEvent::ShowDevices()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+TObject* AliEvent::Clone(const char* name)
+{
+// Make a deep copy of the current object and provide the pointer to the copy.
+// This memberfunction enables automatic creation of new objects of the
+// correct type depending on the object type, a feature which may be very useful
+// for containers when adding objects in case the container owns the objects.
+// This feature allows to store either AliEvent objects or objects derived from
+// AliEvent via some generic AddEvent memberfunction, provided these derived
+// classes also have a proper Clone memberfunction. 
+
+ AliEvent* evt=new AliEvent(*this);
+ if (name)
+ {
+  if (strlen(name)) evt->SetName(name);
+ }
+ return evt;
+}
+///////////////////////////////////////////////////////////////////////////