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"
24 /// Basic implementation of AliMUONV2DStore container using
25 /// AliMpExMap internally.
26 /// What we store is a "double" map : an AliMpExMap of AliMpExMaps
29 ClassImp(AliMUON2DMap)
31 //_____________________________________________________________________________
32 AliMUON2DMap::AliMUON2DMap() : AliMUONV2DStore(), fMap(new AliMpExMap(true))
39 //_____________________________________________________________________________
40 AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& other)
47 //_____________________________________________________________________________
49 AliMUON2DMap::operator=(const AliMUON2DMap& other)
55 //_____________________________________________________________________________
56 AliMUON2DMap::~AliMUON2DMap()
59 // dtor. we delete the map, which will delete the objects, as we're owner.
64 //_____________________________________________________________________________
66 AliMUON2DMap::CopyTo(AliMUON2DMap&) const
69 // Copy this into dest.
71 AliFatal("Implement me if needed");
74 //_____________________________________________________________________________
76 AliMUON2DMap::Get(Int_t i, Int_t j) const
79 // Return the value at position (i,j).
81 TObject* o = fMap->GetValue(i);
84 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
85 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
86 return m->GetValue(j);
91 //_____________________________________________________________________________
93 AliMUON2DMap::Print(Option_t*) const
96 // Not implemented (yet?)
100 //_____________________________________________________________________________
102 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));