]>
Commit | Line | Data |
---|---|---|
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 | |
35 | ClassImp(AliMUONDigitStoreVImplIterator) | |
36 | /// \endcond | |
37 | ||
38 | //_____________________________________________________________________________ | |
39 | AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl* store) | |
40 | : TIterator(), | |
41 | fStore(store), | |
42 | fFirstDetElemId(100), | |
43 | fLastDetElemId(1417), | |
44 | fCathode(2), | |
45 | fStoreIterator(store->fMap->CreateIterator()), | |
46 | fCurrentCalibParam(0x0), | |
47 | fCurrentCalibParamIndex(-1) | |
48 | { | |
49 | /// ctor for full iteration | |
50 | } | |
51 | ||
52 | //_____________________________________________________________________________ | |
53 | AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl* store, | |
caa04e49 | 54 | Int_t firstDE, |
55 | Int_t lastDE, | |
56 | Int_t cathode) | |
97d7844b | 57 | : TIterator(), |
58 | fStore(store), | |
59 | fFirstDetElemId(firstDE), | |
60 | fLastDetElemId(lastDE), | |
61 | fCathode(cathode), | |
62 | fStoreIterator(store->fMap->CreateIterator(firstDE,lastDE)), | |
63 | fCurrentCalibParam(0x0), | |
64 | fCurrentCalibParamIndex(-1) | |
65 | { | |
66 | /// ctor for partial iteration | |
67 | } | |
68 | ||
69 | //_____________________________________________________________________________ | |
70 | AliMUONDigitStoreVImplIterator::AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImplIterator& rhs) | |
71 | : TIterator(rhs), | |
72 | fStore(rhs.fStore), | |
73 | fFirstDetElemId(rhs.fFirstDetElemId), | |
74 | fLastDetElemId(rhs.fLastDetElemId), | |
75 | fCathode(rhs.fCathode), | |
76 | fStoreIterator(0x0), | |
77 | fCurrentCalibParam(0x0), | |
78 | fCurrentCalibParamIndex(-1) | |
79 | { | |
80 | /// copy ctor | |
81 | Fatal("AliMUONDigitStoreVImplIterator::copy tor","Not implementeable"); // because there's no clone in TIterator :-( | |
82 | } | |
83 | ||
84 | //_____________________________________________________________________________ | |
85 | AliMUONDigitStoreVImplIterator& | |
86 | AliMUONDigitStoreVImplIterator::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 | //_____________________________________________________________________________ | |
94 | TIterator& | |
95 | AliMUONDigitStoreVImplIterator::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 | //_____________________________________________________________________________ | |
103 | AliMUONDigitStoreVImplIterator::~AliMUONDigitStoreVImplIterator() | |
104 | { | |
105 | /// dtor | |
106 | delete fStoreIterator; | |
107 | } | |
108 | ||
109 | //_____________________________________________________________________________ | |
110 | TObject* | |
111 | AliMUONDigitStoreVImplIterator::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 | } | |
caa04e49 | 120 | |
97d7844b | 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 | { | |
caa04e49 | 138 | while ( d == 0x0 ) |
97d7844b | 139 | { |
caa04e49 | 140 | while ( fCurrentCalibParamIndex < 64 && ix < 0 ) |
141 | { | |
142 | ix = fCurrentCalibParam->ValueAsInt(fCurrentCalibParamIndex++); | |
143 | }; | |
97d7844b | 144 | |
caa04e49 | 145 | if (ix>=0) |
146 | { | |
147 | d = static_cast<AliMUONVDigit*>(fStore->fDigits->UncheckedAt(ix)); | |
148 | ||
149 | if ( fCathode == 2 || d->Cathode() == fCathode ) | |
150 | { | |
151 | break; | |
152 | } | |
153 | d = 0x0; | |
154 | ix = -1; | |
155 | } | |
156 | else | |
97d7844b | 157 | { |
158 | break; | |
159 | } | |
97d7844b | 160 | } |
161 | } | |
97d7844b | 162 | |
163 | if (ix<0) | |
164 | { | |
165 | fCurrentCalibParam = 0x0; | |
166 | return Next(); | |
167 | } | |
168 | ||
169 | return d; | |
170 | } | |
171 | ||
172 | //_____________________________________________________________________________ | |
173 | void | |
174 | AliMUONDigitStoreVImplIterator::Reset() | |
175 | { | |
176 | /// Reset the iterator | |
177 | fCurrentCalibParam = 0x0; | |
178 | fCurrentCalibParamIndex = 0; | |
179 | fStoreIterator->Reset(); | |
180 | } |