1 #ifndef ALIEMCALITERABLECONTAINER_H
2 #define ALIEMCALITERABLECONTAINER_H
3 #if !(defined(__CINT__) || defined(__MAKECINT__))
10 #include <type_traits>
15 #if (__GNUC__ >= 3) && !defined(__INTEL_COMPILER)
19 #pragma GCC system_header
22 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Weffc++"
27 class AliEmcalContainer;
29 namespace EMCALIterableContainer {
94 template <
typename T,
typename STAR=operator_star_
object<T> >
118 class iterator final :
public std::iterator<std::bidirectional_iterator_tag, typename STAR::iterator_type, std::ptrdiff_t> {
225 #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40600
226 #pragma GCC diagnostic pop
231 namespace EMCALIterableContainer {
235 template <
typename T,
typename STAR>
250 template <
typename T,
typename STAR>
254 fUseAccepted(useAccept)
264 template <
typename T,
typename STAR>
266 fkContainer(ref.fkContainer),
267 fAcceptIndices(ref.fAcceptIndices),
268 fUseAccepted(ref.fUseAccepted)
279 template <
typename T,
typename STAR>
294 template <
typename T,
typename STAR>
296 return fUseAccepted ? fAcceptIndices.GetSize() : fkContainer->GetNEntries();
314 template <
typename T,
typename STAR>
316 const AliEmcalContainer &contref = *fkContainer;
317 int _index = GetInternalIndex(index);
318 if(_index < 0 || _index >= contref.GetNEntries())
return NULL;
319 return static_cast<T*
>(contref[_index]);
327 template <
typename T,
typename STAR>
329 fAcceptIndices.Set(fkContainer->GetNAcceptEntries());
330 int acceptCounter = 0;
331 for(
int index = 0; index < fkContainer->GetNEntries(); index++){
332 UInt_t rejectionReason = 0;
333 if(fkContainer->AcceptObject(index, rejectionReason)) fAcceptIndices[acceptCounter++] = index;
353 template <
typename T,
typename STAR>
356 fCurrent(currentpos),
360 update_current_element();
368 template <
typename T,
typename STAR>
371 fCurrent(ref.fCurrent),
372 fForward(ref.fForward),
375 update_current_element();
384 template <
typename T,
typename STAR>
400 template <
typename T,
typename STAR>
410 template <
typename T,
typename STAR>
412 if(fForward) fCurrent++;
415 update_current_element();
425 template <
typename T,
typename STAR>
427 if(fForward) fCurrent--;
430 update_current_element();
442 template <
typename T,
typename STAR>
456 template <
typename T,
typename STAR>
STAR::arrow_return_type operator->()
AliEmcalIterableContainerT & operator=(const AliEmcalIterableContainerT< T, STAR > &ref)
momentum_object_pair iterator_type
bidirectional stl iterator over the EMCAL iterable container
Declaration of class AliTLorentzVector.
static star_return_type star(momentum_object_pair *ptr)
const AliTLorentzVector & get_momentum() const
const AliEmcalContainer * GetContainer() const
STAR::star_return_type operator*()
static arrow_return_type arrow(momentum_object_pair *ptr)
std::pair< AliTLorentzVector, T * > momentum_object_pair
bool operator!=(const iterator &ref) const
void update_current_element()
static arrow_return_type arrow(momentum_object_pair *ptr)
Bool_t fUseAccepted
Switch between accepted and all objects.
static star_return_type star(momentum_object_pair *ptr)
void BuildAcceptIndices()
T * operator[](int index) const
momentum_object_pair fCurrentElement
current element pair (momentum, pointer object)
int fCurrent
current index in the container
const AliEmcalContainer * fkContainer
Container to be iterated over.
std::pair< AliTLorentzVector, T * > momentum_object_pair
iterator & operator=(const iterator &ref)
TArrayI fAcceptIndices
Array of accepted indices.
std::pair< AliTLorentzVector, T * > momentum_object_pair
const AliEmcalIterableContainerT< T, STAR > * fkData
container with data
bool fForward
use forward or backward direction
const momentum_object_pair * arrow_return_type
int GetInternalIndex(int index) const
const momentum_object_pair & star_return_type
AliEmcalIterableContainerT()
~AliEmcalIterableContainerT()
int current_index() const