Work directly with Digit::ADC() instead of Digit::Signal()
[u/mrichter/AliRoot.git] / MUON / AliMUON2DMap.cxx
CommitLineData
f6e5d0e9 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
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**************************************************************************/
15
16// $Id$
17
18#include "AliMUON2DMap.h"
19
20#include "AliLog.h"
21#include "AliMpExMap.h"
22
23#include <cassert>
24
25ClassImp(AliMUON2DMap)
26
27//_____________________________________________________________________________
28AliMUON2DMap::AliMUON2DMap() : AliMUONV2DStore(), fMap(new AliMpExMap(true))
29{
e5cc543e 30 //
31 // ctor.
32 //
f6e5d0e9 33}
34
884a73f1 35//______________________________________________________________________________
36AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& right)
37 : AliMUONV2DStore(right)
38{
39/// Protected copy constructor (not implemented)
40
41 AliFatal("Copy constructor not provided.");
42}
43
f6e5d0e9 44//_____________________________________________________________________________
45AliMUON2DMap::~AliMUON2DMap()
46{
e5cc543e 47 //
48 // dtor. we delete the map, which will delete the objects, as we're owner.
49 //
f6e5d0e9 50 delete fMap;
51}
52
884a73f1 53//______________________________________________________________________________
54AliMUON2DMap&
55AliMUON2DMap::operator=(const AliMUON2DMap& right)
56{
57/// Protected assignement operator (not implemented)
58
59 // check assignement to self
60 if (this == &right) return *this;
61
62 AliFatal("Assignement operator not provided.");
63
64 return *this;
65}
66
f6e5d0e9 67//_____________________________________________________________________________
68TObject*
69AliMUON2DMap::Get(Int_t i, Int_t j) const
70{
e5cc543e 71 //
72 // Return the value at position (i,j).
73 //
f6e5d0e9 74 TObject* o = fMap->GetValue(i);
75 if ( o )
76 {
77 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
78 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
79 return m->GetValue(j);
80 }
81 return 0x0;
82}
83
f6e5d0e9 84//_____________________________________________________________________________
85void
86AliMUON2DMap::Print(Option_t*) const
87{
e5cc543e 88 //
89 // Not implemented (yet?)
90 //
f6e5d0e9 91}
92
93//_____________________________________________________________________________
94Bool_t
95AliMUON2DMap::Set(Int_t i, Int_t j, TObject* object, Bool_t replace)
96{
e5cc543e 97 //
98 // Set the object at position (i,j).
99 // If replace==kTRUE, we don't care if there's an object there already,
100 // otherwise we might refuse to set if the (i,j) location is already
101 // filled (in which case we return kFALSE).
102
f6e5d0e9 103 TObject* o = fMap->GetValue(i);
104 if ( !o )
105 {
106 AliMpExMap* m = new AliMpExMap(true);
107 fMap->Add(i,m);
108 o = fMap->GetValue(i);
109 assert(m==o);
110 }
111 AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
112 if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
113 o = m->GetValue(j);
114 if ( !o || ( o && replace ) )
115 {
116 if ( IsOwner() )
117 {
118 delete o;
119 }
120 m->Add(j,object);
121 }
122 else if ( o && !replace )
123 {
124 AliError(Form("Object %p is already there for (i,j)=(%d,%d)",o,i,j));
125 return kFALSE;
126 }
127 return kTRUE;
128}
129
130
131
132
133