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 AliMUONTOTCAStoreIterator
21 /// An iterator to access TObject stored in a TObjArray of TClonesArray
23 /// \author Laurent Aphecetche, Subatech
24 //-----------------------------------------------------------------------------
26 #include "AliMUONTOTCAStoreIterator.h"
29 #include <TClonesArray.h>
30 #include <TObjArray.h>
33 ClassImp(AliMUONTOTCAStoreIterator)
36 //_____________________________________________________________________________
37 AliMUONTOTCAStoreIterator::AliMUONTOTCAStoreIterator(const TObjArray* data,
43 fFirstChamberId(firstChamberId),
44 fLastChamberId(lastChamberId),
49 /// Standard constructor
53 //_____________________________________________________________________________
54 AliMUONTOTCAStoreIterator&
55 AliMUONTOTCAStoreIterator::operator=(const TIterator& rhs)
57 /// Overriden operator= (imposed by Root's declaration of TIterator ?)
60 if ( rhs.IsA() != AliMUONTOTCAStoreIterator::Class() )
62 AliErrorGeneral("AliMUONTOTCAStoreIterator::operator=","Wrong type");
66 const AliMUONTOTCAStoreIterator& rhs1 =
67 static_cast<const AliMUONTOTCAStoreIterator&>(rhs);
74 //_____________________________________________________________________________
75 AliMUONTOTCAStoreIterator::AliMUONTOTCAStoreIterator(const AliMUONTOTCAStoreIterator& rhs)
90 //_____________________________________________________________________________
91 AliMUONTOTCAStoreIterator::~AliMUONTOTCAStoreIterator()
96 //_____________________________________________________________________________
97 AliMUONTOTCAStoreIterator&
98 AliMUONTOTCAStoreIterator::operator=(const AliMUONTOTCAStoreIterator& rhs)
100 /// Assignment operator
106 //_____________________________________________________________________________
108 AliMUONTOTCAStoreIterator::CopyTo(AliMUONTOTCAStoreIterator& destination) const
110 /// Copy *this to destination
111 destination.fkData=fkData;
112 destination.fFirstChamberId=fFirstChamberId;
113 destination.fLastChamberId=fLastChamberId;
114 destination.fCurrentTCAIndex=fCurrentTCAIndex;
115 destination.fCurrentChamberId=fCurrentChamberId;
116 destination.fCurrentTCA=fCurrentTCA;
119 //_____________________________________________________________________________
121 AliMUONTOTCAStoreIterator::GetCollection() const
123 /// The top level collection we're iterating upon, i.e. a TObjArray
127 //_____________________________________________________________________________
129 AliMUONTOTCAStoreIterator::Next()
131 /// Find and return next element in the store
133 if ( fCurrentTCA && fCurrentTCAIndex < fCurrentTCA->GetLast() )
139 fCurrentTCAIndex = 0;
142 while ( ( !fCurrentTCA || fCurrentTCA->GetLast()==-1 ) &&
143 fCurrentChamberId < fLastChamberId )
146 fCurrentTCA = static_cast<TClonesArray*>(fkData->At(fCurrentChamberId));
152 // get the pointer to be returned
153 return fCurrentTCA->At(fCurrentTCAIndex);
159 //_____________________________________________________________________________
161 AliMUONTOTCAStoreIterator::Reset()
163 /// Reset the iterator
164 fCurrentTCAIndex = -1;
165 fCurrentChamberId = fFirstChamberId-1;