Overload second find method from TObject
authormfasel <mfasel@lbl.gov>
Tue, 26 Aug 2014 09:01:44 +0000 (11:01 +0200)
committermverweij <marta.verweij@cern.ch>
Tue, 26 Aug 2014 09:08:47 +0000 (11:08 +0200)
PWGJE/EMCALJetTasks/UserTasks/AliEMCalHistoContainer.cxx
PWGJE/EMCALJetTasks/UserTasks/AliEMCalHistoContainer.h

index 6ec3496..6f4da4e 100644 (file)
@@ -517,7 +517,22 @@ namespace EMCalTriggerPtAnalysis {
                TString dirname(basename(name)), hname(histname(name));
                THashList *parent(FindGroup(dirname.Data()));
                if(!parent) return NULL;
-               return parent->FindObject(name);
+               return parent->FindObject(hname);
+       }
+
+       //______________________________________________________________________________
+       TObject* AliEMCalHistoContainer::FindObject(const TObject* obj) const {
+               /*
+                * Find and object inside the container. The object name is expected to contain the
+                * full path of the histogram object, including parent groups
+                *
+                * @param obj: the object to find
+                * @return: pointer to the object (NULL if not found)
+                */
+               TString dirname(basename(obj->GetName())), hname(histname(obj->GetName()));
+               THashList *parent(FindGroup(dirname.Data()));
+               if(!parent) return NULL;
+               return parent->FindObject(hname);
        }
 
        //______________________________________________________________________________
index 302c29e..233cbac 100644 (file)
@@ -114,6 +114,7 @@ public:
 
        THashList *GetListOfHistograms() { return fHistos; }
        virtual TObject *FindObject(const char *name) const;
+       virtual TObject *FindObject(const TObject *obj) const;
 
 private:
        AliEMCalHistoContainer(const AliEMCalHistoContainer &);