internally. Should be revised for better performance...
(Laurent)
--- /dev/null
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUON1DMap.h"
+
+#include "AliLog.h"
+#include "AliMpExMap.h"
+
+ClassImp(AliMUON1DMap)
+
+//_____________________________________________________________________________
+AliMUON1DMap::AliMUON1DMap() : AliMUONV1DStore(), fMap(new AliMpExMap(true))
+{
+}
+
+//_____________________________________________________________________________
+AliMUON1DMap::~AliMUON1DMap()
+{
+ delete fMap;
+}
+
+//_____________________________________________________________________________
+TObject*
+AliMUON1DMap::Get(Int_t detElemId) const
+{
+ return fMap->GetValue(detElemId);
+}
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON1DMap::IsOwner() const
+{
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON1DMap::Set(Int_t detElemId, TObject* object, Bool_t replace)
+{
+ TObject* o = Get(detElemId);
+ if ( o && !replace )
+ {
+ AliError(Form("Object %p is already there for detElemId %d",o,detElemId));
+ return kFALSE;
+ }
+ if ( o && IsOwner() )
+ {
+ delete o;
+ }
+ fMap->Add(detElemId,object);
+ return kTRUE;
+}
+
+
+
+
+
--- /dev/null
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup
+/// \class AliMUONDeMap
+/// \brief Basic implementation of AliMUONV1DStore container using
+/// AliMpExMap internally
+///
+/// Should be revised for better preformance ...
+///
+/// \author Laurent Aphecetche
+
+#ifndef AliMUON1DMAP_H
+#define AliMUON1DMAP_H
+
+class AliMpExMap;
+
+#include "AliMUONV1DStore.h"
+
+class AliMUON1DMap : public AliMUONV1DStore
+{
+public:
+ AliMUON1DMap();
+ virtual ~AliMUON1DMap();
+
+ virtual TObject* Get(Int_t detElemId) const;
+ virtual Bool_t Set(Int_t detElemId, TObject* object, Bool_t replace=kTRUE);
+ virtual Bool_t IsOwner() const;
+
+private:
+ AliMpExMap* fMap;
+
+ ClassDef(AliMUON1DMap,1) //
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUON2DMap.h"
+
+#include "AliLog.h"
+#include "AliMpExMap.h"
+
+#include <cassert>
+
+ClassImp(AliMUON2DMap)
+
+//_____________________________________________________________________________
+AliMUON2DMap::AliMUON2DMap() : AliMUONV2DStore(), fMap(new AliMpExMap(true))
+{
+}
+
+//_____________________________________________________________________________
+AliMUON2DMap::~AliMUON2DMap()
+{
+ delete fMap;
+}
+
+//_____________________________________________________________________________
+TObject*
+AliMUON2DMap::Get(Int_t i, Int_t j) const
+{
+ TObject* o = fMap->GetValue(i);
+ if ( o )
+ {
+ AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
+ if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
+ return m->GetValue(j);
+ }
+ return 0x0;
+}
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON2DMap::IsOwner() const
+{
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+void
+AliMUON2DMap::Print(Option_t*) const
+{
+
+}
+
+//_____________________________________________________________________________
+Bool_t
+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);
+ fMap->Add(i,m);
+ o = fMap->GetValue(i);
+ assert(m==o);
+ }
+ AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
+ if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
+ o = m->GetValue(j);
+ if ( !o || ( o && replace ) )
+ {
+ if ( IsOwner() )
+ {
+ delete o;
+ }
+ m->Add(j,object);
+ }
+ else if ( o && !replace )
+ {
+ AliError(Form("Object %p is already there for (i,j)=(%d,%d)",o,i,j));
+ return kFALSE;
+ }
+ return kTRUE;
+}
+
+
+
+
+
--- /dev/null
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup base
+/// \class AliMUON2DMap
+/// \brief Basic implementation of AliMUONV2DStore container using
+/// AliMpExMap internally
+///
+/// Should be revised for better preformance ...
+///
+/// \author Laurent Aphecetche
+
+#ifndef AliMUON2DMAP_H
+#define AliMUON2DMAP_H
+
+#include "AliMUONV2DStore.h"
+
+class AliMpExMap;
+
+class AliMUON2DMap : public AliMUONV2DStore
+{
+public:
+ AliMUON2DMap();
+ virtual ~AliMUON2DMap();
+
+ virtual TObject* Get(Int_t i, Int_t j) const;
+ virtual Bool_t Set(Int_t i, Int_t j, TObject*, Bool_t replace);
+ virtual Bool_t IsOwner() const;
+
+ virtual void Print(Option_t* opt="") const;
+
+private:
+ AliMpExMap* fMap;
+
+ ClassDef(AliMUON2DMap,1) //
+};
+
+#endif
--- /dev/null
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* *
+* Author: The ALICE Off-line Project. *
+* Contributors are mentioned in the code where appropriate. *
+* *
+* Permission to use, copy, modify and distribute this software and its *
+* documentation strictly for non-commercial purposes is hereby granted *
+* without fee, provided that the above copyright notice appears in all *
+* copies and that both the copyright notice and this permission notice *
+* appear in the supporting documentation. The authors make no claims *
+* about the suitability of this software for any purpose. It is *
+* provided "as is" without express or implied warranty. *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUON3DMap.h"
+
+ClassImp(AliMUON3DMap)
+
+#include "AliMUON1DMap.h"
+#include "AliMUON2DMap.h"
+
+#include "Riostream.h"
+
+//_____________________________________________________________________________
+AliMUON3DMap::AliMUON3DMap() : AliMUONV3DStore(), fStore(new AliMUON1DMap)
+{
+}
+
+//_____________________________________________________________________________
+AliMUON3DMap::~AliMUON3DMap()
+{
+ delete fStore;
+}
+
+//_____________________________________________________________________________
+TObject*
+AliMUON3DMap::Get(Int_t i, Int_t j, Int_t k) const
+{
+ AliMUONV2DStore* m = static_cast<AliMUONV2DStore*>(fStore->Get(i));
+ if (!m) return 0x0;
+ return m->Get(j,k);
+}
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON3DMap::IsOwner() const
+{
+ return kTRUE;
+}
+
+//_____________________________________________________________________________
+void
+AliMUON3DMap::Print(Option_t*) const
+{
+ cout << "Would need an iterator here to be able to print !" << endl;
+}
+
+//_____________________________________________________________________________
+Bool_t
+AliMUON3DMap::Set(Int_t i, Int_t j, Int_t k, TObject* object, Bool_t replace)
+{
+ AliMUONV2DStore* m = static_cast<AliMUONV2DStore*>(fStore->Get(i));
+ if (!m)
+ {
+ fStore->Set(i,new AliMUON2DMap,replace);
+ m = static_cast<AliMUONV2DStore*>(fStore->Get(i));
+ }
+ return m->Set(j,k,object,replace);
+}
+
+
+
--- /dev/null
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice */
+
+// $Id$
+
+/// \ingroup base
+/// \class AliMUON3DMap
+/// \brief Basic implementation of AliMUONV3DStore container using
+/// AliMpExMap internally
+///
+/// Should be revised for better preformance ...
+///
+/// \author Laurent Aphecetche
+
+#ifndef ALIMUON3DMAP_H
+#define ALIMUON3DMAP_H
+
+#ifndef ALIMUONV3DSTORE_H
+# include "AliMUONV3DStore.h"
+#endif
+
+class AliMUONV1DStore;
+
+class AliMUON3DMap : public AliMUONV3DStore
+{
+public:
+ AliMUON3DMap();
+ virtual ~AliMUON3DMap();
+
+ virtual TObject* Get(Int_t i, Int_t j, Int_t k) const;
+ virtual Bool_t Set(Int_t i, Int_t j, Int_t k, TObject*, Bool_t replace);
+ virtual Bool_t IsOwner() const;
+ virtual void Print(Option_t* opt="") const;
+
+private:
+ AliMUONV1DStore* fStore;
+ ClassDef(AliMUON3DMap,1) //
+};
+
+#endif