From 2ed392cf285b4ed08003ec9b3cd487f50b65a11a Mon Sep 17 00:00:00 2001 From: martinez Date: Wed, 27 Jun 2007 14:11:59 +0000 Subject: [PATCH] Consolidating definitions of FindObject methods (Laurent) --- MUON/AliMUONVDigitStore.cxx | 41 +++++++++++++++++++++++++++++++++++++ MUON/AliMUONVDigitStore.h | 13 ++++++++---- MUON/AliMUONVStore.cxx | 20 +----------------- MUON/AliMUONVStore.h | 6 ------ 4 files changed, 51 insertions(+), 29 deletions(-) diff --git a/MUON/AliMUONVDigitStore.cxx b/MUON/AliMUONVDigitStore.cxx index d787552bb04..1954ad01d70 100644 --- a/MUON/AliMUONVDigitStore.cxx +++ b/MUON/AliMUONVDigitStore.cxx @@ -28,6 +28,7 @@ #include "AliLog.h" #include "AliMUONVDigit.h" +#include #include #include @@ -90,6 +91,22 @@ AliMUONVDigitStore::Add(Int_t detElemId, return 0x0; } +//____________________________________________________________________________ +AliMUONVDigitStore* +AliMUONVDigitStore::Create(const char* digitstoreclassname) +{ + TClass* classPtr = TClass::GetClass(digitstoreclassname); + if (!classPtr) + { + return 0x0; + } + + AliMUONVDigitStore* digitStore = + reinterpret_cast(classPtr->New()); + + return digitStore; +} + //_____________________________________________________________________________ AliMUONVDigitStore* AliMUONVDigitStore::Create(TTree& tree) @@ -101,6 +118,30 @@ AliMUONVDigitStore::Create(TTree& tree) return static_cast(AliMUONVStore::Create(tree,dataType.Data())); } +//_____________________________________________________________________________ +AliMUONVDigit* +AliMUONVDigitStore::FindObject(const TObject* object) const +{ + const AliMUONVDigit* digit = dynamic_cast(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 diff --git a/MUON/AliMUONVDigitStore.h b/MUON/AliMUONVDigitStore.h index 9354a3575da..4b41ca2b913 100644 --- a/MUON/AliMUONVDigitStore.h +++ b/MUON/AliMUONVDigitStore.h @@ -39,6 +39,8 @@ public: static AliMUONVDigitStore* Create(TTree& tree); + static AliMUONVDigitStore* Create(const char* classname); + /// Create a digit virtual AliMUONVDigit* CreateDigit(Int_t detElemId, Int_t manuId, Int_t manuChannel, Int_t cathode) const = 0; @@ -77,12 +79,15 @@ public: virtual TIterator* CreateTriggerIterator() const = 0; using AliMUONVStore::FindObject; + + /// Find an object (default is to forward to FindObject(object->GetUniqueID()) + virtual AliMUONVDigit* FindObject(const TObject* object) const; - /// Find a (tracker) digit by the triplet (de,manu,channel) - virtual AliMUONVDigit* FindObject(Int_t detElemId, Int_t manuId, Int_t manuChannel) const = 0; + /// Find an object by its uniqueID + virtual AliMUONVDigit* FindObject(UInt_t uniqueID) const; - /// Find a (trigger) digit by the quadruplet (de,lb,channel,cathode) - virtual AliMUONVDigit* FindObject(Int_t detElemId, Int_t localBoardId, Int_t localBoardChannel, Int_t cathode) const = 0; + /// Find a digit by the quadruplet (de,manu,channel,cathode) + virtual AliMUONVDigit* FindObject(Int_t detElemId, Int_t manuId, Int_t manuChannel, Int_t cathode) const = 0; /// Number of digits we store virtual Int_t GetSize() const = 0; diff --git a/MUON/AliMUONVStore.cxx b/MUON/AliMUONVStore.cxx index c3441643c6e..879944a952f 100644 --- a/MUON/AliMUONVStore.cxx +++ b/MUON/AliMUONVStore.cxx @@ -154,24 +154,6 @@ AliMUONVStore::FindObject(Int_t, Int_t) const return 0; } -//_____________________________________________________________________________ -TObject* -AliMUONVStore::FindObject(Int_t,Int_t, Int_t) const -{ - /// Find an object using 3 identifiers - AliError("Not implemented"); - return 0; -} - -//_____________________________________________________________________________ -TObject* -AliMUONVStore::FindObject(Int_t, Int_t, Int_t, Int_t) const -{ - /// Find an object using 4 identifiers - AliError("Not implemented"); - return 0; -} - //______________________________________________________________________________ TObject* AliMUONVStore::FindObject(const char *name) const @@ -196,7 +178,7 @@ AliMUONVStore::FindObject(const TObject *obj) const // member function. Requires a sequential scan till the object has // been found. Returns 0 if object is not found. // Typically this function is overridden by a more efficient version - // in concrete collection classes (e.g. THashTable). + // in concrete collection classes. TIter next(CreateIterator()); TObject *ob; diff --git a/MUON/AliMUONVStore.h b/MUON/AliMUONVStore.h index 9fbb266fbc5..ad8e9195d62 100644 --- a/MUON/AliMUONVStore.h +++ b/MUON/AliMUONVStore.h @@ -58,12 +58,6 @@ public: /// Find an object using 2 ids virtual TObject* FindObject(Int_t i, Int_t j) const; - /// Find an object using 3 ids - virtual TObject* FindObject(Int_t i, Int_t j, Int_t k) const; - - /// Find an object using 4 ids - virtual TObject* FindObject(Int_t i, Int_t j, Int_t k, Int_t l) const; - /// The number of objects stored virtual Int_t GetSize() const = 0; -- 2.43.0