AliPhysics  b43479f (b43479f)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliEmcalIterableContainer.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 #include "AliEmcalContainer.h"
17 
21 
26 TObject(),
27 fkContainer(NULL),
28 fAcceptIndices(),
29 fUseAccepted(kFALSE)
30 {
31 
32 }
33 
41 TObject(),
42 fkContainer(cont),
43 fAcceptIndices(),
44 fUseAccepted(useAccept)
45 {
47 }
48 
55 TObject(ref),
56 fkContainer(ref.fkContainer),
57 fAcceptIndices(ref.fAcceptIndices),
58 fUseAccepted(ref.fUseAccepted)
59 {
60 
61 }
62 
70  TObject::operator=(ref);
71  if(this != &ref){
75  }
76  return *this;
77 }
78 
85  return fUseAccepted ? fAcceptIndices.GetSize() : fkContainer->GetNEntries();
86 }
87 
103 TObject *AliEmcalIterableContainer::operator[](int index) const {
104  if(index < 0 || index >= GetEntries()) return NULL;
105  const AliEmcalContainer &contref = *fkContainer;
106  return fUseAccepted ? contref[fAcceptIndices[index]] : contref[index];
107 }
108 
116  int acceptCounter = 0;
117  for(int index = 0; index < fkContainer->GetNEntries(); index++){
118  UInt_t rejectionReason = 0;
119  if(fkContainer->AcceptObject(index, rejectionReason)) fAcceptIndices[acceptCounter++] = index;
120  }
121 }
122 
126 
140 fkData(cont),
141 fCurrent(currentpos),
142 fForward(forward)
143 {
144 
145 }
146 
153  fkData(ref.fkData),
154  fCurrent(ref.fCurrent),
155  fForward(ref.fForward)
156 {
157 
158 }
159 
167  if(this != &ref){
168  fkData = ref.fkData;
169  fCurrent = ref.fCurrent;
170  fForward = ref.fForward;
171  }
172  return *this;
173 }
174 
181  return fCurrent != ref.fCurrent;
182 }
183 
190  if(fForward) fCurrent++;
191  else fCurrent--;
192  return *this;
193 }
194 
201  if(fForward) fCurrent--;
202  else fCurrent++;
203  return *this;
204 }
205 
215  operator++();
216  return tmp;
217 }
218 
228  operator--();
229  return tmp;
230 }
231 
238  return (*fkData)[fCurrent];
239 }
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
Int_t GetNAcceptEntries() const
const AliEmcalContainer * fkContainer
Container to be iterated over.
TObject * operator[](int index) const
bool fForward
use forward or backward direction
virtual Bool_t AcceptObject(Int_t i, UInt_t &rejectionReason) const =0
Base class for container structures within the EMCAL framework.
bool operator!=(const iterator &ref) const
Container implementing iterable functionality of the EMCAL containers.
TArrayI fAcceptIndices
Array of accepted indices.
Bool_t fUseAccepted
Switch between accepted and all objects.
bidirectional stl iterator over the EMCAL iterable container
int fCurrent
current index in the container
AliEmcalIterableContainer & operator=(const AliEmcalIterableContainer &cont)
const AliEmcalIterableContainer * fkData
container with data
Int_t GetNEntries() const
iterator & operator=(const iterator &ref)