]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliEvent.cxx
26-nov-2004 NvE Printout of UniqueID added in AliSignal::Data() and AliEvent::ShowDev...
[u/mrichter/AliRoot.git] / RALICE / AliEvent.cxx
index 652ff126a6fb23925c5d7c5fe960c4bc546a356f..6b2c807c44d972baa5b1861008b68926a4a88823 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliEvent.cxx,v 1.24 2004/07/06 13:34:16 nick Exp $
+// $Id: AliEvent.cxx,v 1.25 2004/10/20 10:49:44 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: 2004/07/06 13:34:16 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2004/10/20 10:49:44 $ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliEvent.h"
@@ -731,6 +731,24 @@ TObject* AliEvent::GetDevice(TString name) const
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+TObject* AliEvent::GetIdDevice(Int_t id) const
+{
+// Return the device with unique identifier "id".
+ if (!fDevices || id<0) return 0;
+
+ Int_t idx=0;
+ for (Int_t i=0; i<GetNdevices(); i++)
+ {
+  TObject* dev=fDevices->At(i);
+  if (dev)
+  {
+   idx=dev->GetUniqueID();
+   if (idx==id) return dev;
+  }
+ }
+ return 0; // No matching id found
+}
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::ShowDevices() const
 {
 // Provide an overview of the available devices.
@@ -745,7 +763,7 @@ void AliEvent::ShowDevices() const
    {
     const char* name=dev->GetName();
     cout << " Device number : " << i;
-    cout << " Class : " << dev->ClassName();
+    cout << " Class : " << dev->ClassName() << " Id : " << dev->GetUniqueID();
     if (strlen(name)) cout << " Name : " << name;
     if (dev->InheritsFrom("AliDevice")) cout << " Nhits : " << ((AliDevice*)dev)->GetNhits();
     cout << endl;
@@ -783,6 +801,28 @@ TObjArray* AliEvent::GetHits(const char* classname)
  return fHits;
 }
 ///////////////////////////////////////////////////////////////////////////
+AliSignal* AliEvent::GetIdHit(Int_t id,const char* classname)
+{
+// Return the hit with unique identifier "id" for the specified device class.
+ if (id<0) return 0;
+
+ Int_t nhits=GetNhits(classname);
+ if (!nhits) return 0;
+
+ AliSignal* sx=0;
+ Int_t sid=0;
+ for (Int_t i=0; i<nhits; i++)
+ {
+  sx=(AliSignal*)fHits->At(i);
+  if (sx)
+  {
+   sid=sx->GetUniqueID();
+   if (id==sid) return sx;
+  }
+ }
+ return 0; // No matching id found
+}
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::LoadHits(const char* classname)
 {
 // Load the references to the various hits registered to the specified