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 TIterator& AliMUONClusterStoreV2Iterator::operator=(const TIterator& /*iter*/)
60 /// Overriden operator= (imposed by Root's definition of TIterator::operator= ?)
62 if ( this != &iter && iter.IsA() == AliMUONClusterStoreV2Iterator::Class() ) {
63 (*this) = static_cast<const AliMUONClusterStoreV2Iterator&>(iter);
66 AliFatalGeneral("AliMUONClusterStoreV2Iterator::operator=","reimplement me");
70 //_____________________________________________________________________________
71 AliMUONClusterStoreV2Iterator::~AliMUONClusterStoreV2Iterator()
74 delete fChamberIterator;
77 //_____________________________________________________________________________
78 TObject* AliMUONClusterStoreV2Iterator::NextInCurrentChamber() const
80 /// Return the value corresponding to theKey in iterator iter
82 return fChamberIterator->Next();
85 //_____________________________________________________________________________
86 TObject* AliMUONClusterStoreV2Iterator::Next()
88 /// Return next cluster in store
89 TObject* o = NextInCurrentChamber();
92 // fChamberIterator exhausted, try to get the next ones
93 if (fCurrentChamberId == fLastChamberId) return 0x0; // we reached the end
96 delete fChamberIterator;
97 fChamberIterator = static_cast<AliMpExMap*>(fStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();
99 o = NextInCurrentChamber();
105 //_____________________________________________________________________________
106 void AliMUONClusterStoreV2Iterator::Reset()
108 /// Reset the iterator
109 fCurrentChamberId = fFirstChamberId;
110 delete fChamberIterator;
111 fChamberIterator = static_cast<AliMpExMap*>(fStore->fMap->UncheckedAt(fCurrentChamberId))->CreateIterator();