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"
28 #include <TClonesArray.h>
29 #include <TObjArray.h>
32 ClassImp(AliMUONTOTCAStoreIterator)
35 //_____________________________________________________________________________
36 AliMUONTOTCAStoreIterator::AliMUONTOTCAStoreIterator(const TObjArray* data,
42 fFirstChamberId(firstChamberId),
43 fLastChamberId(lastChamberId),
48 /// Standard constructor
52 //_____________________________________________________________________________
54 AliMUONTOTCAStoreIterator::operator=(const TIterator& rhs)
56 /// Overriden operator= (imposed by Root's declaration of TIterator ?)
57 if ( this != &rhs && rhs.IsA() == AliMUONTOTCAStoreIterator::Class() )
59 const AliMUONTOTCAStoreIterator& rhs1 =
60 static_cast<const AliMUONTOTCAStoreIterator&>(rhs);
67 //_____________________________________________________________________________
68 AliMUONTOTCAStoreIterator::AliMUONTOTCAStoreIterator(const AliMUONTOTCAStoreIterator& rhs)
83 //_____________________________________________________________________________
84 AliMUONTOTCAStoreIterator::~AliMUONTOTCAStoreIterator()
89 //_____________________________________________________________________________
90 AliMUONTOTCAStoreIterator&
91 AliMUONTOTCAStoreIterator::operator=(const AliMUONTOTCAStoreIterator& rhs)
93 /// Assignment operator
99 //_____________________________________________________________________________
101 AliMUONTOTCAStoreIterator::CopyTo(AliMUONTOTCAStoreIterator& destination) const
103 /// Copy *this to destination
104 destination.fData=fData;
105 destination.fFirstChamberId=fFirstChamberId;
106 destination.fLastChamberId=fLastChamberId;
107 destination.fCurrentTCAIndex=fCurrentTCAIndex;
108 destination.fCurrentChamberId=fCurrentChamberId;
109 destination.fCurrentTCA=fCurrentTCA;
112 //_____________________________________________________________________________
114 AliMUONTOTCAStoreIterator::GetCollection() const
116 /// The top level collection we're iterating upon, i.e. a TObjArray
120 //_____________________________________________________________________________
122 AliMUONTOTCAStoreIterator::Next()
124 /// Find and return next element in the store
126 if ( fCurrentTCA && fCurrentTCAIndex < fCurrentTCA->GetLast() )
132 fCurrentTCAIndex = 0;
135 while ( ( !fCurrentTCA || fCurrentTCA->GetLast()==-1 ) &&
136 fCurrentChamberId < fLastChamberId )
139 fCurrentTCA = static_cast<TClonesArray*>(fData->At(fCurrentChamberId));
145 // get the pointer to be returned
146 return fCurrentTCA->At(fCurrentTCAIndex);
152 //_____________________________________________________________________________
154 AliMUONTOTCAStoreIterator::Reset()
156 /// Reset the iterator
157 fCurrentTCAIndex = -1;
158 fCurrentChamberId = fFirstChamberId-1;