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
24 /// \author Laurent Aphecetche, Subatech
25 //-----------------------------------------------------------------------------
27 #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 //_____________________________________________________________________________
55 AliMUONTOTCAStoreIterator::operator=(const TIterator& rhs)
57 /// Overriden operator= (imposed by Root's declaration of TIterator ?)
58 if ( this != &rhs && rhs.IsA() == AliMUONTOTCAStoreIterator::Class() )
60 const AliMUONTOTCAStoreIterator& rhs1 =
61 static_cast<const AliMUONTOTCAStoreIterator&>(rhs);
68 //_____________________________________________________________________________
69 AliMUONTOTCAStoreIterator::AliMUONTOTCAStoreIterator(const AliMUONTOTCAStoreIterator& rhs)
84 //_____________________________________________________________________________
85 AliMUONTOTCAStoreIterator::~AliMUONTOTCAStoreIterator()
90 //_____________________________________________________________________________
91 AliMUONTOTCAStoreIterator&
92 AliMUONTOTCAStoreIterator::operator=(const AliMUONTOTCAStoreIterator& rhs)
94 /// Assignment operator
100 //_____________________________________________________________________________
102 AliMUONTOTCAStoreIterator::CopyTo(AliMUONTOTCAStoreIterator& destination) const
104 /// Copy *this to destination
105 destination.fData=fData;
106 destination.fFirstChamberId=fFirstChamberId;
107 destination.fLastChamberId=fLastChamberId;
108 destination.fCurrentTCAIndex=fCurrentTCAIndex;
109 destination.fCurrentChamberId=fCurrentChamberId;
110 destination.fCurrentTCA=fCurrentTCA;
113 //_____________________________________________________________________________
115 AliMUONTOTCAStoreIterator::GetCollection() const
117 /// The top level collection we're iterating upon, i.e. a TObjArray
121 //_____________________________________________________________________________
123 AliMUONTOTCAStoreIterator::Next()
125 /// Find and return next element in the store
127 if ( fCurrentTCA && fCurrentTCAIndex < fCurrentTCA->GetLast() )
133 fCurrentTCAIndex = 0;
136 while ( ( !fCurrentTCA || fCurrentTCA->GetLast()==-1 ) &&
137 fCurrentChamberId < fLastChamberId )
140 fCurrentTCA = static_cast<TClonesArray*>(fData->At(fCurrentChamberId));
146 // get the pointer to be returned
147 return fCurrentTCA->At(fCurrentTCAIndex);
153 //_____________________________________________________________________________
155 AliMUONTOTCAStoreIterator::Reset()
157 /// Reset the iterator
158 fCurrentTCAIndex = -1;
159 fCurrentChamberId = fFirstChamberId-1;