1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 #include "AliMUON2DMap.h"
21 #include "AliMpExMap.h"
23 /// \class AliMUON2DMap
24 /// \brief Basic implementation of AliMUONV2DStore container using
25 /// AliMpExMap internally.
26 /// What we store is a "double" map : an AliMpExMap of AliMpExMaps
28 /// \author Laurent Aphecetche
31 ClassImp(AliMUON2DMap)
34 //_____________________________________________________________________________
35 AliMUON2DMap::AliMUON2DMap() : AliMUONV2DStore(), fMap(new AliMpExMap(true))
37 /// Default constructor.
40 //_____________________________________________________________________________
41 AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& other)
50 //_____________________________________________________________________________
52 AliMUON2DMap::operator=(const AliMUON2DMap& other)
54 /// Assignment operator
60 //_____________________________________________________________________________
61 AliMUON2DMap::~AliMUON2DMap()
64 /// We delete the map, which will delete the objects, as we're owner.
69 //_____________________________________________________________________________
71 AliMUON2DMap::CopyTo(AliMUON2DMap&) const
73 /// Copy this into dest.
75 AliFatal("Implement me if needed");
78 //_____________________________________________________________________________
80 AliMUON2DMap::Get(Int_t i, Int_t j) const
82 /// Return the value at position (i,j).
84 TObject* o = fMap->GetValue(i);
87 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
88 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
89 return m->GetValue(j);
94 //_____________________________________________________________________________
96 AliMUON2DMap::Print(Option_t*) const
98 /// Not implemented (yet?)
101 //_____________________________________________________________________________
103 AliMUON2DMap::Set(Int_t i, Int_t j, TObject* object, Bool_t replace)
105 /// Set the object at position (i,j).
106 /// If replace==kTRUE, we don't care if there's an object there already,
107 /// otherwise we might refuse to set if the (i,j) location is already
108 /// filled (in which case we return kFALSE).
110 TObject* o = fMap->GetValue(i);
113 AliMpExMap* m = new AliMpExMap(true);
115 o = fMap->GetValue(i);
117 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
118 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
120 if ( !o || ( o && replace ) )
128 else if ( o && !replace )
130 AliError(Form("Object %p is already there for (i,j)=(%d,%d)",o,i,j));