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