X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUON2DMap.cxx;h=19551381f41f880c1b3bfe816b13fa520cf72dd5;hb=595d1b92219fda589db8cf7a5f22bcbd84bb4699;hp=fc3a4771c9ee961ace0bdce9af7fda7f65f957eb;hpb=7332f2137636d05e01a719ff4e7b21a214894a29;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUON2DMap.cxx b/MUON/AliMUON2DMap.cxx index fc3a4771c9e..19551381f41 100644 --- a/MUON/AliMUON2DMap.cxx +++ b/MUON/AliMUON2DMap.cxx @@ -21,6 +21,7 @@ #include "AliMUON2DMapIterator.h" #include "AliMUON2DMapIteratorByI.h" #include "AliMpExMap.h" +#include "AliMpExMapIterator.h" //----------------------------------------------------------------------------- /// \class AliMUON2DMap @@ -37,31 +38,26 @@ ClassImp(AliMUON2DMap) const Int_t AliMUON2DMap::fgkOptimalSizeForDEManu = 228; -namespace +//_____________________________________________________________________________ +AliMUON2DMap::AliMUON2DMap(TRootIOCtor*) +: AliMUONVStore(), +fMap(0x0), +fOptimizeForDEManu(kFALSE) { - //___________________________________________________________________________ - TObject* GetValue(TExMapIter& iter, Int_t& theKey) - { - /// return the next value corresponding to theKey in iterator iter - theKey = -1; - Long_t key, value; - Bool_t ok = iter.Next(key,value); - if (!ok) return 0x0; - theKey = (Int_t)(key & 0xFFFF); - return reinterpret_cast(value); - } + /// Root I/O constructor. } //_____________________________________________________________________________ AliMUON2DMap::AliMUON2DMap(Bool_t optimizeForDEManu) : AliMUONVStore(), - fMap(new AliMpExMap(kTRUE)), + fMap(new AliMpExMap), fOptimizeForDEManu(optimizeForDEManu) { /// Default constructor. // hard-coded constant in order not to depend on mapping // if this number ever change, it will not break the code, simply the // automatic resizing will give a warning... + if ( fOptimizeForDEManu ) fMap->SetSize(fgkOptimalSizeForDEManu); } @@ -79,8 +75,11 @@ AliMUON2DMap& AliMUON2DMap::operator=(const AliMUON2DMap& other) { /// Assignment operator - *fMap = *other.fMap; - fOptimizeForDEManu = other.fOptimizeForDEManu; + if ( this != &other ) + { + *fMap = *other.fMap; + fOptimizeForDEManu = other.fOptimizeForDEManu; + } return *this; } @@ -112,6 +111,17 @@ AliMUON2DMap::Add(TObject* object) return Set(i,j,object,kFALSE); } +//_____________________________________________________________________________ +TObject* +AliMUON2DMap::FindObject(UInt_t uid) const +{ + /// Return the value at position uid + + Int_t j = ( uid & 0xFFFF0000 ) >> 16; + Int_t i = ( uid & 0xFFFF); + return FindObject(i,j); +} + //_____________________________________________________________________________ TObject* AliMUON2DMap::FindObject(Int_t i, Int_t j) const @@ -152,13 +162,17 @@ Int_t AliMUON2DMap::GetSize() const { /// Return the number of objects we hold - TExMapIter iter(fMap->GetIterator()); - Int_t i; + TIter next(fMap->CreateIterator()); Int_t theSize(0); + AliMpExMap* m; - while ( GetValue(iter,i) ) + while ( ( m = static_cast(next()) ) ) { - theSize += GetSize(i); + TIter next2(m->CreateIterator()); + while ( next2() ) + { + ++theSize; + } } return theSize; } @@ -184,7 +198,7 @@ AliMUON2DMap::Set(Int_t i, Int_t j, TObject* object, Bool_t replace) TObject* o = fMap->GetValue(i); if ( !o ) { - AliMpExMap* m = new AliMpExMap(true); + AliMpExMap* m = new AliMpExMap; if ( fOptimizeForDEManu ) { m->SetSize(451); // same remark as for the SetSize in ctor...