1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONClusterStoreV2Iterator
21 /// Implementation of TIterator for AliMUONClusterStoreV2
23 /// \author Philippe Pillot, Subatech
25 //-----------------------------------------------------------------------------
27 #include "AliMUONClusterStoreV2Iterator.h"
28 #include "AliMUONClusterStoreV2.h"
30 #include "AliMpExMapIterator.h"
31 #include "AliMpExMap.h"
36 ClassImp(AliMUONClusterStoreV2Iterator)
39 //_____________________________________________________________________________
40 AliMUONClusterStoreV2Iterator::AliMUONClusterStoreV2Iterator(const AliMUONClusterStoreV2* store,
41 Int_t firstChamberId, Int_t lastChamberId)
44 fFirstChamberId(firstChamberId),
45 fLastChamberId(lastChamberId),
46 fCurrentChamberId(-1),
49 /// Constructor for partial iteration
50 if (fFirstChamberId > fLastChamberId) {
51 fLastChamberId = fFirstChamberId;
52 fFirstChamberId = lastChamberId;
57 //_____________________________________________________________________________
58 AliMUONClusterStoreV2Iterator&
59 AliMUONClusterStoreV2Iterator::operator=(const TIterator& /*iter*/)
61 // Overriden operator= (imposed by Root's definition of TIterator::operator= ?)
63 AliFatalGeneral("AliMUONClusterStoreV2Iterator::operator=","reimplement me");
67 //_____________________________________________________________________________
68 AliMUONClusterStoreV2Iterator::~AliMUONClusterStoreV2Iterator()
71 delete fChamberIterator;
74 //_____________________________________________________________________________
75 TObject* AliMUONClusterStoreV2Iterator::NextInCurrentChamber() const
77 /// Return the value corresponding to theKey in iterator iter
79 return fChamberIterator->Next();
82 //_____________________________________________________________________________
83 TObject* AliMUONClusterStoreV2Iterator::Next()
85 /// Return next cluster in store
86 TObject* o = NextInCurrentChamber();
89 // fChamberIterator exhausted, try to get the next ones
90 if (fCurrentChamberId == fLastChamberId) return 0x0; // we reached the end
93 delete fChamberIterator;
94 fChamberIterator = static_cast<AliMpExMap*>(fkStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();
96 o = NextInCurrentChamber();
102 //_____________________________________________________________________________
103 void AliMUONClusterStoreV2Iterator::Reset()
105 /// Reset the iterator
106 fCurrentChamberId = fFirstChamberId;
107 delete fChamberIterator;
108 fChamberIterator = static_cast<AliMpExMap*>(fkStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();