AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONDigitStoreVImplIterator.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
25 //-----------------------------------------------------------------------------
26 
28 
29 #include "AliMUONVDigit.h"
30 #include "AliMUONDigitStoreVImpl.h"
31 #include "AliMUON2DMap.h"
32 #include "AliMUONVCalibParam.h"
33 #include <TClonesArray.h>
34 #include <TError.h>
35 
39 
40 //_____________________________________________________________________________
42 : TIterator(),
43 fkStore(store),
44 fFirstDetElemId(100),
45 fLastDetElemId(1417),
46 fCathode(2),
47 fStoreIterator(store->fMap->CreateIterator()),
50 {
52 }
53 
54 //_____________________________________________________________________________
56  Int_t firstDE,
57  Int_t lastDE,
58  Int_t cathode)
59 : TIterator(),
60 fkStore(store),
61 fFirstDetElemId(firstDE),
62 fLastDetElemId(lastDE),
63 fCathode(cathode),
64 fStoreIterator(store->fMap->CreateIterator(firstDE,lastDE)),
67 {
69 }
70 
71 //_____________________________________________________________________________
74 {
75  // overriden assignment operator (imposed by Root's declaration of Titerator ?)
76  Fatal("TIterator::operator=","Not implementeable"); // because there's no clone in TIterator :-(
77  return *this;
78 }
79 
80 //_____________________________________________________________________________
82 {
84  delete fStoreIterator;
85 }
86 
87 //_____________________________________________________________________________
88 TObject*
90 {
92  if ( !fCurrentCalibParam )
93  {
94  fCurrentCalibParam = static_cast<AliMUONVCalibParam*>(fStoreIterator->Next());
96  if ( !fCurrentCalibParam ) return 0x0;
97  }
98 
99  Int_t ix(-1);
100  AliMUONVDigit* d(0x0);
101 
102  if ( fCathode == 2 )
103  {
104  while ( fCurrentCalibParamIndex < 64 && ix < 0 )
105  {
107  };
108 
109  if (ix>=0)
110  {
111  d = static_cast<AliMUONVDigit*>(fkStore->fDigits->UncheckedAt(ix));
112  }
113  }
114  else
115  {
116  while ( d == 0x0 )
117  {
118  while ( fCurrentCalibParamIndex < 64 && ix < 0 )
119  {
121  };
122 
123  if (ix>=0)
124  {
125  d = static_cast<AliMUONVDigit*>(fkStore->fDigits->UncheckedAt(ix));
126 
127  if ( fCathode == 2 || d->Cathode() == fCathode )
128  {
129  break;
130  }
131  d = 0x0;
132  ix = -1;
133  }
134  else
135  {
136  break;
137  }
138  }
139  }
140 
141  if (ix<0)
142  {
143  fCurrentCalibParam = 0x0;
144  return Next();
145  }
146 
147  return d;
148 }
149 
150 //_____________________________________________________________________________
151 void
153 {
155  fCurrentCalibParam = 0x0;
157  fStoreIterator->Reset();
158 }
Base implementation of TIterator for AliMUONDigitStoreVImpl.
TIterator * fStoreIterator
! helper iterator
AliMUONDigitStoreVImplIterator(const AliMUONDigitStoreVImpl *store)
Base implementation of VDigitStore.
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
Container of calibration values for a given number of channels.
TClonesArray * fDigits
collection of digits
virtual Int_t Cathode() const =0
Cathode number this digit is on (0 or 1)
const AliMUONDigitStoreVImpl * fkStore
! store to iterate upon
Int_t fCurrentCalibParamIndex
! current index in fCurrentCalibParam
virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const =0
ABC of a MUON digit.
Definition: AliMUONVDigit.h:18
AliMUONDigitStoreVImplIterator & operator=(const AliMUONDigitStoreVImplIterator &rhs)
Not implemented.
AliMUONVCalibParam * fCurrentCalibParam
! current CalibParam
Int_t fCathode
! cathode (-1 for both)