AliRoot Core  v5-06-15 (45dab64)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONTOTCAStoreIterator.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15 
16 // $Id$
17 
18 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
25 
27 
28 #include "AliLog.h"
29 #include <TClonesArray.h>
30 #include <TObjArray.h>
31 
35 
36 //_____________________________________________________________________________
38  Int_t firstChamberId,
39  Int_t lastChamberId)
40 :
41 TIterator(),
42 fkData(data),
43 fFirstChamberId(firstChamberId),
44 fLastChamberId(lastChamberId),
45 fCurrentTCA(0x0),
46 fCurrentTCAIndex(-1),
47 fCurrentChamberId(-1)
48 {
50  Reset();
51 }
52 
53 //_____________________________________________________________________________
56 {
58  if ( this != &rhs )
59  {
60  if ( rhs.IsA() != AliMUONTOTCAStoreIterator::Class() )
61  {
62  AliErrorGeneral("AliMUONTOTCAStoreIterator::operator=","Wrong type");
63  }
64  else
65  {
66  const AliMUONTOTCAStoreIterator& rhs1 =
67  static_cast<const AliMUONTOTCAStoreIterator&>(rhs);
68  rhs1.CopyTo(*this);
69  }
70  }
71  return *this;
72 }
73 
74 //_____________________________________________________________________________
76 :
77 TIterator(rhs),
78 fkData(0x0),
79 fFirstChamberId(-1),
80 fLastChamberId(-1),
81 fCurrentTCA(0x0),
82 fCurrentTCAIndex(-1),
83 fCurrentChamberId(-1)
84 {
86 
87  rhs.CopyTo(*this);
88 }
89 
90 //_____________________________________________________________________________
92 {
94 }
95 
96 //_____________________________________________________________________________
99 {
101 
102  rhs.CopyTo(*this);
103  return *this;
104 }
105 
106 //_____________________________________________________________________________
107 void
109 {
111  destination.fkData=fkData;
112  destination.fFirstChamberId=fFirstChamberId;
113  destination.fLastChamberId=fLastChamberId;
116  destination.fCurrentTCA=fCurrentTCA;
117 }
118 
119 //_____________________________________________________________________________
120 const TCollection*
122 {
124  return fkData;
125 }
126 
127 //_____________________________________________________________________________
128 TObject*
130 {
132 
133  if ( fCurrentTCA && fCurrentTCAIndex < fCurrentTCA->GetLast() )
134  {
136  }
137  else
138  {
139  fCurrentTCAIndex = 0;
140  fCurrentTCA = 0;
141 
142  while ( ( !fCurrentTCA || fCurrentTCA->GetLast()==-1 ) &&
144  {
146  fCurrentTCA = static_cast<TClonesArray*>(fkData->At(fCurrentChamberId));
147  }
148  }
149 
150  if ( fCurrentTCA )
151  {
152  // get the pointer to be returned
153  return fCurrentTCA->At(fCurrentTCAIndex);
154  }
155 
156  return 0x0;
157 }
158 
159 //_____________________________________________________________________________
160 void
162 {
164  fCurrentTCAIndex = -1;
166  fCurrentTCA = 0x0;
167 }
Iterator on a store composed of a TObjArray of TClonesArrays.
#define TObjArray
Int_t fFirstChamberId
! First chamber to iterate on
AliMUONTOTCAStoreIterator & operator=(const TIterator &rhs)
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
void CopyTo(AliMUONTOTCAStoreIterator &destination) const
AliMUONTOTCAStoreIterator(const TObjArray *a, Int_t firstChamberId, Int_t lastChamberId)
Int_t fLastChamberId
! Last chamber to iterate on
Int_t fCurrentTCAIndex
! Current position within fCurrentTCA array
Int_t fCurrentChamberId
! current chamber id
virtual const TCollection * GetCollection() const
TClonesArray * fCurrentTCA
! TClonesArray of the current chamber
const TObjArray * fkData
! Pointer to data accessor