]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliEvent.cxx
Replacing rindex by strrchr
[u/mrichter/AliRoot.git] / RALICE / AliEvent.cxx
index bfe920ead8ef8f0b5f472fcac7453323068148d4..0914cf9f9f9ee8f9746bb1e2517f59636c8a4bec 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliEvent.cxx,v 1.14 2003/10/26 14:53:44 nick Exp $
+// $Id: AliEvent.cxx,v 1.17 2003/12/18 09:28:06 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/10/26 14:53:44 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2003/12/18 09:28:06 $ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliEvent.h"
@@ -365,7 +365,7 @@ void AliEvent::SetDayTime(TTimeStamp& stamp)
 {
 // 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 second.
+// accuracy of 1 nanosecond.
  fDaytime=stamp;
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -483,12 +483,18 @@ Int_t AliEvent::GetTargetId()
 void AliEvent::HeaderData()
 {
 // Provide event header information
- cout << " *" << ClassName() << "::Data* Name : " << GetName()
-      << " Title : " << GetTitle() << 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 << endl;
+ cout << "  Run : " << fRun << " Event : " << fEvent
+      << " Number of devices : " << ndevs << endl;
 
- ShowDevices();
if (ndevs) ShowDevices();
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::Data(TString f)
@@ -603,7 +609,6 @@ TObject* AliEvent::GetDevice(Int_t i)
 
  if (!fDevices)
  {
-  cout << " *AliEvent::GetDevice* No devices present." << endl;
   return 0;
  }
  else
@@ -627,7 +632,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
@@ -672,4 +676,22 @@ void AliEvent::ShowDevices()
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+TObject* AliEvent::Clone(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;
+}
+///////////////////////////////////////////////////////////////////////////