#ifndef ALIMERGEABLECOLLECTION_H
#define ALIMERGEABLECOLLECTION_H
#ifndef ROOT_TNamed
# include "TNamed.h"
#endif
#ifndef ROOT_TString
# include "TString.h"
#endif
#ifndef ROOT_TCollection
# include "TCollection.h"
#endif
#ifndef ROOT_TFolder
# include "TFolder.h"
#endif
#include "Riostream.h"
#include <map>
#include <string>
class TMap;
class AliMergeableCollectionIterator;
class TH1;
class TH2;
class TProfile;
class AliMergeableCollection : public TFolder
{
friend class AliMergeableCollectionIterator;
public:
AliMergeableCollection(const char* name="", const char* title="");
virtual ~AliMergeableCollection();
virtual AliMergeableCollection* Clone(const char* name="") const;
Bool_t Attach(AliMergeableCollection* mc, const char* identifier, Bool_t pruneFirstIfAlreadyExists=kFALSE);
Bool_t Adopt(TObject* obj);
Bool_t Adopt(const char* identifier, TObject* obj);
virtual void Browse(TBrowser* b);
virtual void Clear(Option_t *option="") { Delete(option); }
virtual TObject* FindObject(const char* fullIdentifier) const;
virtual TObject* FindObject(const TObject* object) const;
virtual void Delete(Option_t *option="");
virtual Int_t NumberOfObjects() const;
virtual Int_t NumberOfKeys() const;
TObject* GetObject(const char* fullIdentifier) const;
TObject* GetObject(const char* identifier, const char* objectName) const;
TH1* Histo(const char* fullIdentifier) const;
TH1* Histo(const char* identifier, const char* objectName) const;
TH1* H1(const char* fullIdentifier) const { return Histo(fullIdentifier); }
TH1* H1(const char* identifier, const char* objectName) const { return Histo(identifier,objectName); }
TH2* H2(const char* fullIdentifier) const;
TH2* H2(const char* identifier, const char* objectName) const;
TProfile* Prof(const char* fullIdentifier) const;
TProfile* Prof(const char* identifier, const char* objectName) const;
virtual TIterator* CreateIterator(Bool_t dir = kIterForward) const;
virtual TList* CreateListOfKeys(Int_t index) const;
virtual TList* CreateListOfObjectNames(const char* identifier) const;
using TFolder::Remove;
virtual TObject* Remove(const char* fullIdentifier);
Int_t RemoveByType(const char* typeName);
TString GetKey(const char* identifier, Int_t index, Bool_t idContainsObjName = kFALSE) const;
TString GetIdentifier(const char* fullIdentifier) const;
TString GetObjectName(const char* fullIdentifier) const;
void Print(Option_t *option="") const;
void ClearMessages();
void PrintMessages(const char* prefix="") const;
Long64_t Merge(TCollection* list);
AliMergeableCollection* Project(const char* identifier) const;
UInt_t EstimateSize(Bool_t show=kFALSE) const;
void ShowEmptyObjects(Bool_t show=kTRUE) {
fMustShowEmptyObject = show;
}
void PruneEmptyObjects();
Int_t Prune(const char* identifier);
static Bool_t MergeObject(TObject* baseObject, TObject* objToAdd);
TObject* GetSum(const char* idPattern) const;
Bool_t IsEmptyObject(TObject* obj) const;
private:
AliMergeableCollection(const AliMergeableCollection& rhs);
AliMergeableCollection& operator=(const AliMergeableCollection& rhs);
TH1* HistoWithAction(const char* identifier, TObject* o, const TString& action) const;
Bool_t InternalAdopt(const char* identifier, TObject* obj);
TString InternalDecode(const char* fullIdentifier, Int_t index) const;
TObject* InternalObject(const char* identifier, const char* objectName) const;
public:
TObjArray* SortAllIdentifiers() const;
TString NormalizeName(const char* identifier, const char* action) const;
TMap* Map() const;
private:
mutable TMap* fMap;
Bool_t fMustShowEmptyObject;
mutable Int_t fMapVersion;
mutable std::map<std::string,int> fMessages;
ClassDef(AliMergeableCollection,4)
};
class AliMergeableCollectionIterator : public TIterator
{
public:
virtual ~AliMergeableCollectionIterator();
AliMergeableCollectionIterator(const AliMergeableCollection* hcol, Bool_t direction=kIterForward);
AliMergeableCollectionIterator& operator=(const TIterator &rhs);
const TCollection *GetCollection() const { return 0x0; }
TObject* Next();
void Reset();
private:
const AliMergeableCollection* fkMergeableCollection;
TIterator* fMapIterator;
TIterator* fHashListIterator;
Bool_t fDirection;
AliMergeableCollectionIterator() : fkMergeableCollection(0x0), fMapIterator(0x0), fHashListIterator(0x0), fDirection(kIterForward) {}
AliMergeableCollectionIterator& operator=(const AliMergeableCollectionIterator &rhs);
AliMergeableCollectionIterator(const AliMergeableCollectionIterator &iter);
ClassDef(AliMergeableCollectionIterator,0)
};
#endif
AliMergeableCollection.h:1 AliMergeableCollection.h:2 AliMergeableCollection.h:3 AliMergeableCollection.h:4 AliMergeableCollection.h:5 AliMergeableCollection.h:6 AliMergeableCollection.h:7 AliMergeableCollection.h:8 AliMergeableCollection.h:9 AliMergeableCollection.h:10 AliMergeableCollection.h:11 AliMergeableCollection.h:12 AliMergeableCollection.h:13 AliMergeableCollection.h:14 AliMergeableCollection.h:15 AliMergeableCollection.h:16 AliMergeableCollection.h:17 AliMergeableCollection.h:18 AliMergeableCollection.h:19 AliMergeableCollection.h:20 AliMergeableCollection.h:21 AliMergeableCollection.h:22 AliMergeableCollection.h:23 AliMergeableCollection.h:24 AliMergeableCollection.h:25 AliMergeableCollection.h:26 AliMergeableCollection.h:27 AliMergeableCollection.h:28 AliMergeableCollection.h:29 AliMergeableCollection.h:30 AliMergeableCollection.h:31 AliMergeableCollection.h:32 AliMergeableCollection.h:33 AliMergeableCollection.h:34 AliMergeableCollection.h:35 AliMergeableCollection.h:36 AliMergeableCollection.h:37 AliMergeableCollection.h:38 AliMergeableCollection.h:39 AliMergeableCollection.h:40 AliMergeableCollection.h:41 AliMergeableCollection.h:42 AliMergeableCollection.h:43 AliMergeableCollection.h:44 AliMergeableCollection.h:45 AliMergeableCollection.h:46 AliMergeableCollection.h:47 AliMergeableCollection.h:48 AliMergeableCollection.h:49 AliMergeableCollection.h:50 AliMergeableCollection.h:51 AliMergeableCollection.h:52 AliMergeableCollection.h:53 AliMergeableCollection.h:54 AliMergeableCollection.h:55 AliMergeableCollection.h:56 AliMergeableCollection.h:57 AliMergeableCollection.h:58 AliMergeableCollection.h:59 AliMergeableCollection.h:60 AliMergeableCollection.h:61 AliMergeableCollection.h:62 AliMergeableCollection.h:63 AliMergeableCollection.h:64 AliMergeableCollection.h:65 AliMergeableCollection.h:66 AliMergeableCollection.h:67 AliMergeableCollection.h:68 AliMergeableCollection.h:69 AliMergeableCollection.h:70 AliMergeableCollection.h:71 AliMergeableCollection.h:72 AliMergeableCollection.h:73 AliMergeableCollection.h:74 AliMergeableCollection.h:75 AliMergeableCollection.h:76 AliMergeableCollection.h:77 AliMergeableCollection.h:78 AliMergeableCollection.h:79 AliMergeableCollection.h:80 AliMergeableCollection.h:81 AliMergeableCollection.h:82 AliMergeableCollection.h:83 AliMergeableCollection.h:84 AliMergeableCollection.h:85 AliMergeableCollection.h:86 AliMergeableCollection.h:87 AliMergeableCollection.h:88 AliMergeableCollection.h:89 AliMergeableCollection.h:90 AliMergeableCollection.h:91 AliMergeableCollection.h:92 AliMergeableCollection.h:93 AliMergeableCollection.h:94 AliMergeableCollection.h:95 AliMergeableCollection.h:96 AliMergeableCollection.h:97 AliMergeableCollection.h:98 AliMergeableCollection.h:99 AliMergeableCollection.h:100 AliMergeableCollection.h:101 AliMergeableCollection.h:102 AliMergeableCollection.h:103 AliMergeableCollection.h:104 AliMergeableCollection.h:105 AliMergeableCollection.h:106 AliMergeableCollection.h:107 AliMergeableCollection.h:108 AliMergeableCollection.h:109 AliMergeableCollection.h:110 AliMergeableCollection.h:111 AliMergeableCollection.h:112 AliMergeableCollection.h:113 AliMergeableCollection.h:114 AliMergeableCollection.h:115 AliMergeableCollection.h:116 AliMergeableCollection.h:117 AliMergeableCollection.h:118 AliMergeableCollection.h:119 AliMergeableCollection.h:120 AliMergeableCollection.h:121 AliMergeableCollection.h:122 AliMergeableCollection.h:123 AliMergeableCollection.h:124 AliMergeableCollection.h:125 AliMergeableCollection.h:126 AliMergeableCollection.h:127 AliMergeableCollection.h:128 AliMergeableCollection.h:129 AliMergeableCollection.h:130 AliMergeableCollection.h:131 AliMergeableCollection.h:132 AliMergeableCollection.h:133 AliMergeableCollection.h:134 AliMergeableCollection.h:135 AliMergeableCollection.h:136 AliMergeableCollection.h:137 AliMergeableCollection.h:138 AliMergeableCollection.h:139 AliMergeableCollection.h:140 AliMergeableCollection.h:141 AliMergeableCollection.h:142 AliMergeableCollection.h:143 AliMergeableCollection.h:144 AliMergeableCollection.h:145 AliMergeableCollection.h:146 AliMergeableCollection.h:147 AliMergeableCollection.h:148 AliMergeableCollection.h:149 AliMergeableCollection.h:150 AliMergeableCollection.h:151 AliMergeableCollection.h:152 AliMergeableCollection.h:153 AliMergeableCollection.h:154 AliMergeableCollection.h:155 AliMergeableCollection.h:156 AliMergeableCollection.h:157 AliMergeableCollection.h:158 AliMergeableCollection.h:159 AliMergeableCollection.h:160 AliMergeableCollection.h:161 AliMergeableCollection.h:162 AliMergeableCollection.h:163 AliMergeableCollection.h:164 AliMergeableCollection.h:165 AliMergeableCollection.h:166 AliMergeableCollection.h:167 AliMergeableCollection.h:168 AliMergeableCollection.h:169 AliMergeableCollection.h:170 AliMergeableCollection.h:171 AliMergeableCollection.h:172 AliMergeableCollection.h:173 AliMergeableCollection.h:174 AliMergeableCollection.h:175 AliMergeableCollection.h:176 AliMergeableCollection.h:177 AliMergeableCollection.h:178 AliMergeableCollection.h:179 AliMergeableCollection.h:180 AliMergeableCollection.h:181 AliMergeableCollection.h:182 AliMergeableCollection.h:183 AliMergeableCollection.h:184 AliMergeableCollection.h:185 AliMergeableCollection.h:186 AliMergeableCollection.h:187 AliMergeableCollection.h:188 AliMergeableCollection.h:189 AliMergeableCollection.h:190