#ifndef HORDCATEGORY_H #define HORDCATEGORY_H #include "TArrayI.h" #include "TObjString.h" #include "hlocation.h" #include "hordclonesarray.h" #include "hcompositecategory.h" class HOrdCatIter; class PatternSetup : public TObject{ public: Int_t nLevels; TArrayI maxSizes; TArrayI offsets; TArrayI lenghts; PatternSetup(){;} ~PatternSetup(){;} TArrayI* getSize() {return &maxSizes;} TArrayI* getOffset() {return &offsets;} TArrayI* getLenghts() {return &lenghts;} Int_t* getArrayOffs(){ return offsets.fArray; } Int_t* getArrayLen() { return lenghts.fArray; } void reset() { for (Int_t i=0;iGetClass();} void makeBranch(TBranch *parent); void activateBranch(TTree *tree,Int_t splitLevel); Int_t getEntries() {return fData->GetEntriesFast();} inline Int_t getEntries(HLocation &loc); TObject *&getNewSlot(HLocation &aLoc,Int_t* pIndex=0); TObject *&getSlot(HLocation &aLoc,Int_t* pIndex=0); TObject *&getSlot(Int_t index); TObject *getObject(HLocation &aLoc); TObject *getObject(HLocation &aLoc,Int_t index); TObject *getObject(Int_t index); Int_t getNDataObjects(HLocation &aLoc); Bool_t filter(HFilter &aFilter); Bool_t filter(HLocation &aLoc,HFilter &aFilter); void Clear(void); void Compress() {fData->Compress();} inline Bool_t isSelfSplitable(void); TIterator *MakeIterator(Option_t* opt="catIter",Bool_t dir=kIterForward); Int_t getIndex(HLocation &aLoc) {return aLoc[0];} const TCollection* getCollection(){return fData;} Int_t getCurrentOffset(){ return currentOffset;} Int_t getCurrentLenght() {return currentLenght;} ////////////////////// inline Int_t init(); inline Int_t init(HLocation *loc); Int_t* getOffsets(){ return (setup->offsets).fArray;} Int_t* getLenghts() { return (setup->lenghts).fArray;} Int_t getNLevels(){ return setup->nLevels;} TArrayI getMaxSizes(){ return setup->maxSizes;} Int_t getMaxSize(){ return maxSize;} void setLenghts(Int_t loc, Int_t val){ setup->lenghts[loc] = val; } void setOffsets(Int_t loc, Int_t val){ setup->offsets[loc] = val; } Bool_t isaComposite(){ return isComposite;} inline void reSet(Int_t* arr); inline void setPattern(Int_t* off,Int_t* len ); void setCurrLinearAddr(Int_t j){ currentlinearAddr=j;} Int_t getCurrentLinearAddr() { return currentlinearAddr;} Int_t getCurrentLinearOffset() { return (setup->offsets[currentlinearAddr]);} Int_t getCurrentLinearLenght() { return (setup->lenghts[currentlinearAddr]);} Bool_t noSetup(){ return isNotset; } inline void copy(HLocation &loc1,HLocation &loc2); HLocation* getLocation(){ return &location;} TIterator *MakeIterator(HLocation *loc , Option_t *opt="catIter", Bool_t dir=kIterForward); ClassDef(HOrdCategory,1) //Generic data category }; // //** Inlines functions // inline Bool_t HOrdCategory::isSelfSplitable(void) { return kFALSE; } inline Int_t HOrdCategory::getEntries(HLocation &loc){ return (setup->lenghts[loc.getLinearIndex(&(setup->maxSizes))]); } inline Int_t HOrdCategory::init(){ // Initialize the linear addresses & offsets & lenghts // for a sub part of this category. if (maxSize == 0) { maxSize=fData->getMaxSize(setup->nLevels, (setup->maxSizes).fArray); #if DEBUG_LEVEL>0 printf("init called maxSize:%i , \ nLevels:%i \n",maxSize,setup->nLevels); #endif } setCurrLinearAddr(location.getLinearIndex( &(setup->maxSizes) ) ); if ((currentlinearAddr>maxSize) || (location.getNIndex()>setup->nLevels)) return -1; currentOffset=setup->offsets[currentlinearAddr]; currentLenght=setup->lenghts[currentlinearAddr]; #if DEBUG_LEVEL>0 Warning("init", " linear addresse: %i maxSize:%i \n \ Off: %i Len:%i \n", currentlinearAddr,maxSize,currentOffset,currentLenght); #endif isNotset=kFALSE; return 0; } inline Int_t HOrdCategory::init(HLocation *location){ // Initialize the linear addresses & offsets & lenghts // for a sub part of this category. if (maxSize == 0) { maxSize=fData->getMaxSize(setup->nLevels, (setup->maxSizes).fArray); #if DEBUG_LEVEL>0 printf("init called maxSize:%i , \ nLevels:%i \n",maxSize,setup->nLevels); #endif } setCurrLinearAddr(location->getLinearIndex( &(setup->maxSizes))); if ((currentlinearAddr>maxSize)|| (location->getNIndex()>setup->nLevels)) return -1; currentOffset=setup->offsets[currentlinearAddr]; currentLenght=setup->lenghts[currentlinearAddr]; #if DEBUG_LEVEL>0 Warning("init with location ", " linear addresse: %i maxSize:%i \n \ Off: %i Len:%i \n", currentlinearAddr,maxSize,currentOffset,currentLenght); #endif isNotset=kFALSE; return 0; } inline void HOrdCategory::copy(HLocation &loc1,HLocation &loc2){ //copy of too location since // operator = had some problems TArrayI* un=loc1.getIndexes(); TArrayI* deux=loc2.getIndexes(); un->fN=0; un->Set(loc2.getNIndex(),deux->fArray); } inline void HOrdCategory::reSet(Int_t* arr){ for(Int_t i=0;ioffsets[i] = off[i]; setup->lenghts[i] = len[i]; } #if DEBUG_LEVEL>0 for (Int_t i=0;ioffsets[i], setup->lenghts[i]); #endif } #endif /* !HORDCATEGORY_H */