AliRoot Core  edcc906 (edcc906)
AliMergeableCollection Class Reference

#include <AliMergeableCollection.h>

Inheritance diagram for AliMergeableCollection:

Public Member Functions

 AliMergeableCollection (const char *name="", const char *title="")
 
virtual ~AliMergeableCollection ()
 
virtual AliMergeableCollectionClone (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="")
 
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
 
TH1 * H1 (const char *identifier, const char *objectName) const
 
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 AliMergeableCollectionProxyCreateProxy (const char *identifier, Bool_t createIfNeeded=kFALSE)
 
virtual TIterator * CreateIterator (Bool_t dir=kIterForward) const
 
virtual TList * CreateListOfKeys (Int_t index) const
 
virtual TList * CreateListOfObjectNames (const char *identifier) const
 
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)
 
AliMergeableCollectionProject (const char *identifier) const
 
UInt_t EstimateSize (Bool_t show=kFALSE) const
 
void ShowEmptyObjects (Bool_t show=kTRUE)
 Turn on the display of empty objects for the Print method. More...
 
void PruneEmptyObjects ()
 
Int_t Prune (const char *identifier)
 
TObject * GetSum (const char *idPattern) const
 
Bool_t IsEmptyObject (TObject *obj) const
 
TObjArraySortAllIdentifiers () const
 
TString NormalizeName (const char *identifier, const char *action) const
 
TMap * Map () const
 

Static Public Member Functions

static Bool_t MergeObject (TObject *baseObject, TObject *objToAdd)
 
static void CorrectIdentifier (TString &sidentifier)
 

Private Member Functions

 AliMergeableCollection (const AliMergeableCollection &rhs)
 
AliMergeableCollectionoperator= (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
 

Private Attributes

TMap * fMap
 
Bool_t fMustShowEmptyObject
 map of TMap of THashList* of TObject*... More...
 
Int_t fMapVersion
 Whether or not to show empty objects with the Print method. More...
 
std::map< std::string, int > fMessages
 internal version of map (to avoid custom streamer...) More...
 

Friends

class AliMergeableCollectionIterator
 
class AliMergeableCollectionProxy
 

Detailed Description

Definition at line 37 of file AliMergeableCollection.h.

Constructor & Destructor Documentation

AliMergeableCollection::AliMergeableCollection ( const char *  name = "",
const char *  title = "" 
)

Ctor

Definition at line 57 of file AliMergeableCollection.cxx.

Referenced by Clone(), Project(), and ShowEmptyObjects().

AliMergeableCollection::~AliMergeableCollection ( )
virtual

dtor. Note that the map is owner

Definition at line 64 of file AliMergeableCollection.cxx.

AliMergeableCollection::AliMergeableCollection ( const AliMergeableCollection rhs)
private

Member Function Documentation

Bool_t AliMergeableCollection::Adopt ( const char *  identifier,
TObject *  obj 
)

Adopt a given object, and associate it with pair key

Definition at line 94 of file AliMergeableCollection.cxx.

Bool_t AliMergeableCollection::Attach ( AliMergeableCollection mc,
const char *  identifier,
Bool_t  pruneFirstIfAlreadyExists = kFALSE 
)

Attach an already existing mergeable collection to this one. It is attached at level identifier/ We take ownership of mc If identifier is already existing we kill it if pruneFirstIfAlreadyExists is kTRUE (and attach mc) otherwise we return kFALSE (and do not attach mc)

Definition at line 105 of file AliMergeableCollection.cxx.

void AliMergeableCollection::Browse ( TBrowser *  b)
virtual

Create a TFolder structure pointing to our objects, so we can be "browsed"

Definition at line 148 of file AliMergeableCollection.cxx.

virtual void AliMergeableCollection::Clear ( Option_t *  option = "")
inlinevirtual

Definition at line 56 of file AliMergeableCollection.h.

void AliMergeableCollection::ClearMessages ( )

clear pending messages

Definition at line 211 of file AliMergeableCollection.cxx.

Referenced by H1().

AliMergeableCollection * AliMergeableCollection::Clone ( const char *  name = "") const
virtual

Clone this collection. We loose the messages.

Definition at line 256 of file AliMergeableCollection.cxx.

Referenced by AliMUONBusPatchEvolutionSubprocessor::ReadFile().

void AliMergeableCollection::CorrectIdentifier ( TString &  sidentifier)
static

Insure identifier has the right number of slashes...

Definition at line 80 of file AliMergeableCollection.cxx.

Referenced by Adopt(), CreateProxy(), and ShowEmptyObjects().

TIterator * AliMergeableCollection::CreateIterator ( Bool_t  dir = kIterForward) const
virtual
TList * AliMergeableCollection::CreateListOfKeys ( Int_t  index) const
virtual

Create the list of keys at level index

Definition at line 310 of file AliMergeableCollection.cxx.

Referenced by Browse(), and H1().

TList * AliMergeableCollection::CreateListOfObjectNames ( const char *  identifier) const
virtual

Create list of object names for /key1/key2/key... Returned list must be deleted by client

Definition at line 336 of file AliMergeableCollection.cxx.

Referenced by Browse(), H1(), and AliMUONBusPatchEvolution::Normalize().

AliMergeableCollectionProxy * AliMergeableCollection::CreateProxy ( const char *  identifier,
Bool_t  createIfNeeded = kFALSE 
)
virtual

Create a proxy starting at identifier. If createIfNeeded is true, then the identifier is inserted into the collection if it does not exist yet (in which case this method always returns a non null proxy)

Definition at line 227 of file AliMergeableCollection.cxx.

Referenced by H1().

void AliMergeableCollection::Delete ( Option_t *  option = "")
virtual

Delete all the objects

Definition at line 272 of file AliMergeableCollection.cxx.

Referenced by Clear().

UInt_t AliMergeableCollection::EstimateSize ( Bool_t  show = kFALSE) const

Estimate the memory (in kilobytes) used by some objects

Definition at line 1204 of file AliMergeableCollection.cxx.

Referenced by H1(), and AliMUONBusPatchEvolutionSubprocessor::Initialize().

TObject * AliMergeableCollection::FindObject ( const char *  fullIdentifier) const
virtual

Find an object by its full identifier.

Definition at line 285 of file AliMergeableCollection.cxx.

Referenced by Clear().

TObject * AliMergeableCollection::FindObject ( const TObject *  object) const
virtual

Find an object

Definition at line 294 of file AliMergeableCollection.cxx.

TString AliMergeableCollection::GetIdentifier ( const char *  fullIdentifier) const

Extract the identifier from the fullIdentifier

Definition at line 369 of file AliMergeableCollection.cxx.

Referenced by AssertHistogramsRange(), GetObject(), H1(), Histo(), and Remove().

TString AliMergeableCollection::GetKey ( const char *  identifier,
Int_t  index,
Bool_t  idContainsObjName = kFALSE 
) const

Extract the index element of the key pair from the fullIdentifier

Definition at line 388 of file AliMergeableCollection.cxx.

Referenced by CreateListOfKeys(), GetSum(), H1(), and Print().

TObject * AliMergeableCollection::GetObject ( const char *  fullIdentifier) const

Get object key1/key2/.../objectName Note that no action is allowed for generic objects (only for histograms, see Histo() methods)

Definition at line 604 of file AliMergeableCollection.cxx.

Referenced by Browse(), Clear(), FindObject(), H2(), Histo(), Merge(), Prof(), and Remove().

TObject * AliMergeableCollection::GetObject ( const char *  identifier,
const char *  objectName 
) const

Get object for (identifier,objectName) triplet

Definition at line 626 of file AliMergeableCollection.cxx.

TString AliMergeableCollection::GetObjectName ( const char *  fullIdentifier) const

Extract the object name from an identifier

Definition at line 404 of file AliMergeableCollection.cxx.

Referenced by GetObject(), H1(), and Histo().

TObject * AliMergeableCollection::GetSum ( const char *  idPattern) const

Sum objects The pattern must be in the form: /key1_1,key1_2,.../key2_1,key2_2,.../.../objectName_1,objectName_2... The logical or between patterns separated by commas is taken Exact match is required for keys and objectNames

Definition at line 640 of file AliMergeableCollection.cxx.

Referenced by ShowEmptyObjects().

TH1* AliMergeableCollection::H1 ( const char *  fullIdentifier) const
inline

Definition at line 74 of file AliMergeableCollection.h.

TH1* AliMergeableCollection::H1 ( const char *  identifier,
const char *  objectName 
) const
inline

Definition at line 75 of file AliMergeableCollection.h.

TH2 * AliMergeableCollection::H2 ( const char *  fullIdentifier) const

Short-cut method to grab a 2D histogram Will return 0x0 if the object if not a TH2xxx

Definition at line 538 of file AliMergeableCollection.cxx.

Referenced by H1(), and AliMergeableCollectionProxy::H1().

TH2 * AliMergeableCollection::H2 ( const char *  identifier,
const char *  objectName 
) const

Short-cut method to grab a 2D histogram Will return 0x0 if the object if not a TH2xxx

Definition at line 554 of file AliMergeableCollection.cxx.

TH1 * AliMergeableCollection::Histo ( const char *  fullIdentifier) const
TH1 * AliMergeableCollection::Histo ( const char *  identifier,
const char *  objectName 
) const

Get histogram key1/key2/.../objectName:action action is used for 2D histograms : might be px for projection along x-axis py for projection along y-axis pfx for profile along x-axis pfy for profile along y-axis

Definition at line 460 of file AliMergeableCollection.cxx.

TH1 * AliMergeableCollection::HistoWithAction ( const char *  identifier,
TObject *  o,
const TString &  action 
) const
private

Convert o to an histogram if possible, applying a given action if there

Definition at line 499 of file AliMergeableCollection.cxx.

Referenced by Histo(), AliMergeableCollectionProxy::Histo(), and ShowEmptyObjects().

Bool_t AliMergeableCollection::InternalAdopt ( const char *  identifier,
TObject *  obj 
)
private

Adopt an obj

Definition at line 729 of file AliMergeableCollection.cxx.

Referenced by Adopt(), Project(), and ShowEmptyObjects().

TString AliMergeableCollection::InternalDecode ( const char *  fullIdentifier,
Int_t  index 
) const
private

Extract the index-th element of the identifier (/key1/key2/.../keyN/objectName) object is index=-1 (i.e. last)

Definition at line 774 of file AliMergeableCollection.cxx.

Referenced by GetIdentifier(), GetKey(), GetObjectName(), and ShowEmptyObjects().

TObject * AliMergeableCollection::InternalObject ( const char *  identifier,
const char *  objectName 
) const
private

Get object for (identifier,objectName)

Definition at line 816 of file AliMergeableCollection.cxx.

Referenced by GetObject(), and ShowEmptyObjects().

Bool_t AliMergeableCollection::IsEmptyObject ( TObject *  obj) const

Check if object is empty (done only for TH1, so far)

Definition at line 845 of file AliMergeableCollection.cxx.

Referenced by Print(), PruneEmptyObjects(), and ShowEmptyObjects().

TMap * AliMergeableCollection::Map ( ) const
Long64_t AliMergeableCollection::Merge ( TCollection *  list)

Definition at line 912 of file AliMergeableCollection.cxx.

Referenced by H1().

Bool_t AliMergeableCollection::MergeObject ( TObject *  baseObject,
TObject *  objToAdd 
)
static

Add objToAdd to baseObject

Definition at line 976 of file AliMergeableCollection.cxx.

Referenced by GetSum(), Merge(), and ShowEmptyObjects().

TString AliMergeableCollection::NormalizeName ( const char *  identifier,
const char *  action 
) const

Replace / by _ to build a root-compliant histo name

Definition at line 1001 of file AliMergeableCollection.cxx.

Referenced by HistoWithAction(), and ShowEmptyObjects().

Int_t AliMergeableCollection::NumberOfKeys ( ) const
virtual

Get the number of keys we have

Definition at line 1028 of file AliMergeableCollection.cxx.

Referenced by Clear(), and Print().

Int_t AliMergeableCollection::NumberOfObjects ( ) const
virtual

Get the number of objects we hold

Definition at line 1017 of file AliMergeableCollection.cxx.

Referenced by Clear(), Print(), and AliMUONBusPatchEvolutionSubprocessor::Process().

AliMergeableCollection& AliMergeableCollection::operator= ( const AliMergeableCollection rhs)
private
void AliMergeableCollection::Print ( Option_t *  option = "") const

Print all the objects we hold, in a hopefully visually pleasing way.

Option can be used to select given part only, using the schema : /*/*/*/*/* Where the stars are wilcards for /key1/key2/.../objectName

if * is used it is assumed to be a wildcard for objectName

For other selections the full syntax /*/*/*/*/* must be used.

Use "-" as objectName to disable object's name output

One might also use /*/*/*/*/:classname syntax to restrict output to only those objects matching a given classname pattern

Definition at line 1036 of file AliMergeableCollection.cxx.

Referenced by H1(), AliMergeableCollectionProxy::H1(), and AliMUONBusPatchEvolutionSubprocessor::Print().

void AliMergeableCollection::PrintMessages ( const char *  prefix = "") const

Print pending messages

Definition at line 1189 of file AliMergeableCollection.cxx.

Referenced by H1().

TProfile * AliMergeableCollection::Prof ( const char *  fullIdentifier) const

Short-cut method to grab a TProfile histogram Will return 0x0 if the object if not a TProfile

Definition at line 571 of file AliMergeableCollection.cxx.

Referenced by H1(), and AliMergeableCollectionProxy::H1().

TProfile * AliMergeableCollection::Prof ( const char *  identifier,
const char *  objectName 
) const

Short-cut method to grab a TProfile histogram Will return 0x0 if the object if not a TProfile

Definition at line 587 of file AliMergeableCollection.cxx.

AliMergeableCollection * AliMergeableCollection::Project ( const char *  identifier) const

To be implemented : would create a new collection starting at /key1/key2/...

Definition at line 1355 of file AliMergeableCollection.cxx.

Referenced by H1().

Int_t AliMergeableCollection::Prune ( const char *  identifier)

Definition at line 1299 of file AliMergeableCollection.cxx.

Referenced by Attach(), and ShowEmptyObjects().

void AliMergeableCollection::PruneEmptyObjects ( )

Delete the empty objects (Implemented for TH1 only)

Definition at line 1323 of file AliMergeableCollection.cxx.

Referenced by ShowEmptyObjects().

TObject * AliMergeableCollection::Remove ( const char *  fullIdentifier)
virtual

Remove a given object (given its fullIdentifier=/key1/key2/.../objectName)

Note that we do not remove the /key1/key2/... entry even if there's no more object for this triplet.

Not very efficient. Could be improved ?

Definition at line 1395 of file AliMergeableCollection.cxx.

Referenced by AssertHistogramsRange(), H1(), and PruneEmptyObjects().

Int_t AliMergeableCollection::RemoveByType ( const char *  typeName)

Remove all the objects in this collection that are of a given type

Definition at line 1434 of file AliMergeableCollection.cxx.

Referenced by H1().

void AliMergeableCollection::ShowEmptyObjects ( Bool_t  show = kTRUE)
inline

Turn on the display of empty objects for the Print method.

Definition at line 113 of file AliMergeableCollection.h.

TObjArray * AliMergeableCollection::SortAllIdentifiers ( ) const

Sort our internal identifiers. Returned array must be deleted.

Definition at line 1462 of file AliMergeableCollection.cxx.

Referenced by Browse(), CreateListOfKeys(), AliMUONBusPatchEvolution::Normalize(), Print(), and ShowEmptyObjects().

Friends And Related Function Documentation

friend class AliMergeableCollectionProxy
friend

Definition at line 40 of file AliMergeableCollection.h.

Referenced by CreateProxy().

Member Data Documentation

TMap* AliMergeableCollection::fMap
mutableprivate
Int_t AliMergeableCollection::fMapVersion
mutableprivate

Whether or not to show empty objects with the Print method.

Definition at line 153 of file AliMergeableCollection.h.

Referenced by Clone(), and Map().

std::map<std::string,int> AliMergeableCollection::fMessages
mutableprivate

internal version of map (to avoid custom streamer...)

Definition at line 154 of file AliMergeableCollection.h.

Referenced by ClearMessages(), InternalObject(), and PrintMessages().

Bool_t AliMergeableCollection::fMustShowEmptyObject
private

map of TMap of THashList* of TObject*...

Definition at line 152 of file AliMergeableCollection.h.

Referenced by Clone(), Print(), and ShowEmptyObjects().


The documentation for this class was generated from the following files: