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"
25 ClassImp(AliMUON2DMap)
27 //_____________________________________________________________________________
28 AliMUON2DMap::AliMUON2DMap() : AliMUONV2DStore(), fMap(new AliMpExMap(true))
35 //_____________________________________________________________________________
36 AliMUON2DMap::~AliMUON2DMap()
39 // dtor. we delete the map, which will delete the objects, as we're owner.
44 //_____________________________________________________________________________
46 AliMUON2DMap::Get(Int_t i, Int_t j) const
49 // Return the value at position (i,j).
51 TObject* o = fMap->GetValue(i);
54 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
55 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
56 return m->GetValue(j);
61 //_____________________________________________________________________________
63 AliMUON2DMap::Print(Option_t*) const
66 // Not implemented (yet?)
70 //_____________________________________________________________________________
72 AliMUON2DMap::Set(Int_t i, Int_t j, TObject* object, Bool_t replace)
75 // Set the object at position (i,j).
76 // If replace==kTRUE, we don't care if there's an object there already,
77 // otherwise we might refuse to set if the (i,j) location is already
78 // filled (in which case we return kFALSE).
80 TObject* o = fMap->GetValue(i);
83 AliMpExMap* m = new AliMpExMap(true);
85 o = fMap->GetValue(i);
88 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
89 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
91 if ( !o || ( o && replace ) )
99 else if ( o && !replace )
101 AliError(Form("Object %p is already there for (i,j)=(%d,%d)",o,i,j));