]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONDigitStoreVImplIterator.cxx
No more misaligned_geometry
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitStoreVImplIterator.cxx
CommitLineData
97d7844b 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/// \class AliMUONDigitStoreVImplIterator
19///
20/// Implementation of AliMUONVDataIterator for AliMUONDigitStoreVImpl
21///
22/// \author Laurent Aphecetche, Subatech
23///
24
25#include "AliMUONDigitStoreVImplIterator.h"
26
27#include "AliMUONVDigit.h"
28#include "AliMUONDigitStoreVImpl.h"
29#include "AliMUON2DMap.h"
30#include "AliMUONVCalibParam.h"
31#include <TClonesArray.h>
32#include <TError.h>
33
34/// \cond CLASSIMP
35ClassImp(AliMUONDigitStoreVImplIterator)
36/// \endcond
37
38//_____________________________________________________________________________
39AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl* store)
40: TIterator(),
41fStore(store),
42fFirstDetElemId(100),
43fLastDetElemId(1417),
44fCathode(2),
45fStoreIterator(store->fMap->CreateIterator()),
46fCurrentCalibParam(0x0),
47fCurrentCalibParamIndex(-1)
48{
49 /// ctor for full iteration
50}
51
52//_____________________________________________________________________________
53AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl* store,
54 Int_t firstDE,
55 Int_t lastDE,
56 Int_t cathode)
57: TIterator(),
58fStore(store),
59fFirstDetElemId(firstDE),
60fLastDetElemId(lastDE),
61fCathode(cathode),
62fStoreIterator(store->fMap->CreateIterator(firstDE,lastDE)),
63fCurrentCalibParam(0x0),
64fCurrentCalibParamIndex(-1)
65{
66 /// ctor for partial iteration
67}
68
69//_____________________________________________________________________________
70AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImplIterator& rhs)
71: TIterator(rhs),
72fStore(rhs.fStore),
73fFirstDetElemId(rhs.fFirstDetElemId),
74fLastDetElemId(rhs.fLastDetElemId),
75fCathode(rhs.fCathode),
76fStoreIterator(0x0),
77fCurrentCalibParam(0x0),
78fCurrentCalibParamIndex(-1)
79{
80 /// copy ctor
81 Fatal("AliMUONDigitStoreVImplIterator::copy tor","Not implementeable"); // because there's no clone in TIterator :-(
82}
83
84//_____________________________________________________________________________
85AliMUONDigitStoreVImplIterator&
86AliMUONDigitStoreVImplIterator::operator=(const AliMUONDigitStoreVImplIterator&)
87{
88 /// assignment operator
89 Fatal("AliMUONDigitStoreVImplIterator::operator=","Not implementeable"); // because there's no clone in TIterator :-(
90 return *this;
91}
92
93//_____________________________________________________________________________
94TIterator&
95AliMUONDigitStoreVImplIterator::operator=(const TIterator&)
96{
97 /// overriden assignment operator (imposed by Root's declaration of Titerator ?)
98 Fatal("TIterator::operator=","Not implementeable"); // because there's no clone in TIterator :-(
99 return *this;
100}
101
102//_____________________________________________________________________________
103AliMUONDigitStoreVImplIterator::~AliMUONDigitStoreVImplIterator()
104{
105 /// dtor
106 delete fStoreIterator;
107}
108
109//_____________________________________________________________________________
110TObject*
111AliMUONDigitStoreVImplIterator::Next()
112{
113 /// Return next digit in store
114 if ( !fCurrentCalibParam )
115 {
116 fCurrentCalibParam = static_cast<AliMUONVCalibParam*>(fStoreIterator->Next());
117 fCurrentCalibParamIndex = 0;
118 if ( !fCurrentCalibParam ) return 0x0;
119 }
120
121 Int_t ix(-1);
122 AliMUONVDigit* d(0x0);
123
124 if ( fCathode == 2 )
125 {
126 while ( fCurrentCalibParamIndex < 64 && ix < 0 )
127 {
128 ix = fCurrentCalibParam->ValueAsInt(fCurrentCalibParamIndex++);
129 };
130
131 if (ix>=0)
132 {
133 d = static_cast<AliMUONVDigit*>(fStore->fDigits->UncheckedAt(ix));
134 }
135 }
136 else
137 {
138 while ( fCurrentCalibParamIndex < 64 )
139 {
140 ix = fCurrentCalibParam->ValueAsInt(fCurrentCalibParamIndex++);
141 if (ix>=0)
142 {
143 d = static_cast<AliMUONVDigit*>(fStore->fDigits->UncheckedAt(ix));
144
145 if ( fCathode == 2 || d->Cathode() == fCathode )
146 {
147 break;
148 }
149 d = 0x0;
150 }
151 }
152 }
153
154 if (ix<0)
155 {
156 fCurrentCalibParam = 0x0;
157 return Next();
158 }
159
160 return d;
161}
162
163//_____________________________________________________________________________
164void
165AliMUONDigitStoreVImplIterator::Reset()
166{
167 /// Reset the iterator
168 fCurrentCalibParam = 0x0;
169 fCurrentCalibParamIndex = 0;
170 fStoreIterator->Reset();
171}