]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONClusterStoreV2Iterator.cxx
Update to fix the fact that AliRawReader::Create does not work correctly in online...
[u/mrichter/AliRoot.git] / MUON / AliMUONClusterStoreV2Iterator.cxx
CommitLineData
2060b217 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//-----------------------------------------------------------------------------
19/// \class AliMUONClusterStoreV2Iterator
20///
21/// Implementation of TIterator for AliMUONClusterStoreV2
22///
23/// \author Philippe Pillot, Subatech
24///
25//-----------------------------------------------------------------------------
26
27#include "AliMUONClusterStoreV2Iterator.h"
2060b217 28#include "AliMUONClusterStoreV2.h"
29
630711ed 30#include "AliMpExMapIterator.h"
2060b217 31#include "AliMpExMap.h"
32
630711ed 33#include "AliLog.h"
2060b217 34
35/// \cond CLASSIMP
36ClassImp(AliMUONClusterStoreV2Iterator)
37/// \endcond
38
39//_____________________________________________________________________________
40AliMUONClusterStoreV2Iterator::AliMUONClusterStoreV2Iterator(const AliMUONClusterStoreV2* store,
41 Int_t firstChamberId, Int_t lastChamberId)
42: TIterator(),
5a240757 43 fkStore(store),
2060b217 44 fFirstChamberId(firstChamberId),
45 fLastChamberId(lastChamberId),
46 fCurrentChamberId(-1),
47 fChamberIterator(0x0)
48{
49 /// Constructor for partial iteration
50 if (fFirstChamberId > fLastChamberId) {
51 fLastChamberId = fFirstChamberId;
52 fFirstChamberId = lastChamberId;
53 }
54 Reset();
55}
56
57//_____________________________________________________________________________
6805f5be 58AliMUONClusterStoreV2Iterator&
59AliMUONClusterStoreV2Iterator::operator=(const TIterator& /*iter*/)
2060b217 60{
6805f5be 61 // Overriden operator= (imposed by Root's definition of TIterator::operator= ?)
62
630711ed 63 AliFatalGeneral("AliMUONClusterStoreV2Iterator::operator=","reimplement me");
2060b217 64 return *this;
65}
66
67//_____________________________________________________________________________
68AliMUONClusterStoreV2Iterator::~AliMUONClusterStoreV2Iterator()
69{
70 /// Destructor
71 delete fChamberIterator;
72}
73
74//_____________________________________________________________________________
75TObject* AliMUONClusterStoreV2Iterator::NextInCurrentChamber() const
76{
77 /// Return the value corresponding to theKey in iterator iter
630711ed 78
79 return fChamberIterator->Next();
2060b217 80}
81
82//_____________________________________________________________________________
83TObject* AliMUONClusterStoreV2Iterator::Next()
84{
85 /// Return next cluster in store
86 TObject* o = NextInCurrentChamber();
87
88 while (!o) {
89 // fChamberIterator exhausted, try to get the next ones
90 if (fCurrentChamberId == fLastChamberId) return 0x0; // we reached the end
91
92 fCurrentChamberId++;
93 delete fChamberIterator;
5a240757 94 fChamberIterator = static_cast<AliMpExMap*>(fkStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();
2060b217 95
96 o = NextInCurrentChamber();
97 }
98
99 return o;
100}
101
102//_____________________________________________________________________________
103void AliMUONClusterStoreV2Iterator::Reset()
104{
105 /// Reset the iterator
106 fCurrentChamberId = fFirstChamberId;
107 delete fChamberIterator;
5a240757 108 fChamberIterator = static_cast<AliMpExMap*>(fkStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();
2060b217 109}