]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONVDigitStore.cxx
Using custom streamer to guarantie back compatibility (Peter Christiansen)
[u/mrichter/AliRoot.git] / MUON / AliMUONVDigitStore.cxx
index d787552bb043008135881388a9bddfbc2242b9d6..72f0f9f62ea5b56b04181b1d140652d64db13a22 100644 (file)
@@ -15,6 +15,7 @@
 
 // $Id$
 
+//-----------------------------------------------------------------------------
 /// \class AliMUONVDigitStore
 ///
 /// Interface for a digit (or sdigit) container
 /// can create iterators to loop over (part of) the elements.
 ///
 /// \author Laurent Aphecetche, Subatech
+//-----------------------------------------------------------------------------
 
 #include "AliMUONVDigitStore.h"
 
 #include "AliLog.h"
 #include "AliMUONVDigit.h"
+#include <TClass.h>
 #include <TString.h>
 #include <TTree.h>
 
@@ -90,6 +93,24 @@ AliMUONVDigitStore::Add(Int_t detElemId,
   return 0x0;
 }
 
+//____________________________________________________________________________
+AliMUONVDigitStore* 
+AliMUONVDigitStore::Create(const char* digitstoreclassname)
+{
+  /// Create a concrete digitStore, given its classname
+  
+  TClass* classPtr = TClass::GetClass(digitstoreclassname);
+  if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore"))
+  {
+    return 0x0;
+  }
+  
+  AliMUONVDigitStore* digitStore = 
+    reinterpret_cast<AliMUONVDigitStore*>(classPtr->New());
+  
+  return digitStore;
+}
+
 //_____________________________________________________________________________
 AliMUONVDigitStore*
 AliMUONVDigitStore::Create(TTree& tree)
@@ -101,6 +122,31 @@ AliMUONVDigitStore::Create(TTree& tree)
   return static_cast<AliMUONVDigitStore*>(AliMUONVStore::Create(tree,dataType.Data()));
 }
 
+//_____________________________________________________________________________
+AliMUONVDigit* 
+AliMUONVDigitStore::FindObject(const TObject* object) const
+{
+  /// Find an object, if of AliMUONVDigit type.
+  const AliMUONVDigit* digit = dynamic_cast<const AliMUONVDigit*>(object);
+  if (digit)
+  {
+    return FindObject(digit->GetUniqueID());
+  }
+  return 0x0;
+}
+
+//_____________________________________________________________________________
+AliMUONVDigit* 
+AliMUONVDigitStore::FindObject(UInt_t uniqueID) const
+{
+  /// Find digit by its uniqueID
+  
+  return FindObject(AliMUONVDigit::DetElemId(uniqueID),
+                    AliMUONVDigit::ManuId(uniqueID),
+                    AliMUONVDigit::ManuChannel(uniqueID),
+                    AliMUONVDigit::Cathode(uniqueID));
+}
+
 //_____________________________________________________________________________
 Int_t 
 AliMUONVDigitStore::GetSize(Int_t detElemId, Int_t cathode) const