KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVTemplateEvent< Particle >::Iterator Class Reference

Detailed Description

template<typename Particle>
class KVTemplateEvent< Particle >::Iterator

Class used for iterating over particles in events.

Template Parameters
ParticleClass used to describe particles belonging to the event: must derive from KVParticle

The Iterator class is an STL-compliant iterator which can be used to perform loops over particles in an event. Iterators of different types can be used for different kinds of iteration:

KVEvent* event; // base pointer to an object of some concrete implementation of an event class
Iterator it(event); // default: Type::All, iterate over all particles
Iterator it(event,{"some_selection", [](const Particle* n){ return // some condition applied to n}});
Iterator it2(event, Type::OK); // iterate over nuclei whose method KVNucleus::IsOK() returns kTRUE
Iterator it3(event, Type::Group, "GroupName"); // iterate over nuclei belonging to previously-defined group "GroupName"
Abstract base class container for multi-particle events.
Definition KVEvent.h:67
Class used for iterating over particles in events.
const Int_t n
See also
KVTemplateEvent, Nuclei & Events
Examples
KVEvent_iterator_example.C.

Definition at line 119 of file KVTemplateEvent.h.

#include <KVTemplateEvent.h>

Public Types

typedef std::ptrdiff_t difference_type
 
typedef std::forward_iterator_tag iterator_category
 
typedef Particle * pointer
 
typedef Particle & reference
 
enum  Type {
  Null , All , OK , Group ,
  Bad
}
 
typedef Particle value_type
 

Public Member Functions

 Iterator ()
 
 Iterator (const Iterator &i)
 
 Iterator (const KVEvent &e, const KVTemplateParticleCondition< Particle > &selection)
 
 Iterator (const KVEvent &e, Type t=Type::All, TString grp="")
 
 Iterator (const KVEvent *e, const KVTemplateParticleCondition< Particle > &selection)
 
 Iterator (const KVEvent *e, Type t=Type::All, TString grp="")
 
template<typename PointerType = Particle>
const PointerType * get_const_pointer () const
 
template<typename ReferenceType = Particle>
const ReferenceType & get_const_reference () const
 
template<typename PointerType = Particle>
PointerType * get_pointer () const
 
template<typename ReferenceType = Particle>
ReferenceType & get_reference () const
 
Bool_t IsIterating () const
 
Bool_t operator!= (const Iterator &it) const
 
Particle & operator* () const
 
const Iteratoroperator++ ()
 
Iterator operator++ (int)
 
Iteratoroperator= (const Iterator &rhs)
 
Bool_t operator== (const Iterator &it) const
 
void Reset (Type t=Type::Null, TString grp="")
 
void SetIsIterating (Bool_t on=kTRUE)
 

Static Public Member Functions

static Iterator End ()
 

Private Member Functions

Bool_t AcceptableIteration ()
 
Particle * current () const
 

Private Attributes

TIter fIter
 
Bool_t fIterating
 
KVTemplateParticleCondition< Particle > fSelection
 
Type fType
 

Member Typedef Documentation

◆ difference_type

template<typename Particle >
typedef std::ptrdiff_t KVTemplateEvent< Particle >::Iterator::difference_type

Definition at line 123 of file KVTemplateEvent.h.

◆ iterator_category

template<typename Particle >
typedef std::forward_iterator_tag KVTemplateEvent< Particle >::Iterator::iterator_category

Definition at line 121 of file KVTemplateEvent.h.

◆ pointer

template<typename Particle >
typedef Particle* KVTemplateEvent< Particle >::Iterator::pointer

Definition at line 124 of file KVTemplateEvent.h.

◆ reference

template<typename Particle >
typedef Particle& KVTemplateEvent< Particle >::Iterator::reference

Definition at line 125 of file KVTemplateEvent.h.

◆ value_type

template<typename Particle >
typedef Particle KVTemplateEvent< Particle >::Iterator::value_type

Definition at line 122 of file KVTemplateEvent.h.

Member Enumeration Documentation

◆ Type

template<typename Particle >
enum KVTemplateEvent::Iterator::Type
Enumerator
Null 
All 
OK 
Group 
Bad 

Definition at line 127 of file KVTemplateEvent.h.

Constructor & Destructor Documentation

◆ Iterator() [1/6]

template<typename Particle >
KVTemplateEvent< Particle >::Iterator::Iterator ( )
inline

Definition at line 157 of file KVTemplateEvent.h.

◆ Iterator() [2/6]

template<typename Particle >
KVTemplateEvent< Particle >::Iterator::Iterator ( const Iterator i)
inline

Definition at line 163 of file KVTemplateEvent.h.

◆ Iterator() [3/6]

template<typename Particle >
KVTemplateEvent< Particle >::Iterator::Iterator ( const KVEvent e,
const KVTemplateParticleCondition< Particle > &  selection 
)
inline

Construct an iterator object to read in sequence the particles in event *e using the given KVParticleCondition to select acceptable particles.

Definition at line 170 of file KVTemplateEvent.h.

◆ Iterator() [4/6]

template<typename Particle >
KVTemplateEvent< Particle >::Iterator::Iterator ( const KVEvent e,
const KVTemplateParticleCondition< Particle > &  selection 
)
inline

Construct an iterator object to read in sequence the particles in event *e using the given KVParticleCondition to select acceptable particles.

Definition at line 187 of file KVTemplateEvent.h.

◆ Iterator() [5/6]

template<typename Particle >
KVTemplateEvent< Particle >::Iterator::Iterator ( const KVEvent e,
Type  t = Type::All,
TString  grp = "" 
)
inline

Construct an iterator object to read in sequence the particles in event *e

Definition at line 204 of file KVTemplateEvent.h.

◆ Iterator() [6/6]

template<typename Particle >
KVTemplateEvent< Particle >::Iterator::Iterator ( const KVEvent e,
Type  t = Type::All,
TString  grp = "" 
)
inline

Construct an iterator object to read in sequence the particles in event *e

Definition at line 230 of file KVTemplateEvent.h.

Member Function Documentation

◆ AcceptableIteration()

template<typename Particle >
Bool_t KVTemplateEvent< Particle >::Iterator::AcceptableIteration ( )
inlineprivate

Returns kTRUE if the current particle in the iteration corresponds to the selection criteria (if none set, true for all)

Returns kFALSE for all particles if iterator is bad (particle class mismatch)

Definition at line 140 of file KVTemplateEvent.h.

◆ current()

template<typename Particle >
Particle * KVTemplateEvent< Particle >::Iterator::current ( ) const
inlineprivate

Returns pointer to current particle in iteration

Definition at line 151 of file KVTemplateEvent.h.

◆ End()

template<typename Particle >
static Iterator KVTemplateEvent< Particle >::Iterator::End ( )
inlinestatic

Definition at line 321 of file KVTemplateEvent.h.

◆ get_const_pointer()

template<typename Particle >
template<typename PointerType = Particle>
const PointerType * KVTemplateEvent< Particle >::Iterator::get_const_pointer ( ) const
inline

Definition at line 273 of file KVTemplateEvent.h.

◆ get_const_reference()

template<typename Particle >
template<typename ReferenceType = Particle>
const ReferenceType & KVTemplateEvent< Particle >::Iterator::get_const_reference ( ) const
inline

Definition at line 278 of file KVTemplateEvent.h.

◆ get_pointer()

template<typename Particle >
template<typename PointerType = Particle>
PointerType * KVTemplateEvent< Particle >::Iterator::get_pointer ( ) const
inline

Definition at line 263 of file KVTemplateEvent.h.

◆ get_reference()

template<typename Particle >
template<typename ReferenceType = Particle>
ReferenceType & KVTemplateEvent< Particle >::Iterator::get_reference ( ) const
inline

Definition at line 268 of file KVTemplateEvent.h.

◆ IsIterating()

template<typename Particle >
Bool_t KVTemplateEvent< Particle >::Iterator::IsIterating ( ) const
inline

returns kTRUE if iteration is in progress

Definition at line 350 of file KVTemplateEvent.h.

◆ operator!=()

template<typename Particle >
Bool_t KVTemplateEvent< Particle >::Iterator::operator!= ( const Iterator it) const
inline

returns kTRUE if the 2 iterators are not pointing to the same particle

Definition at line 282 of file KVTemplateEvent.h.

◆ operator*()

template<typename Particle >
Particle & KVTemplateEvent< Particle >::Iterator::operator* ( ) const
inline

Returns reference to current particle in iteration

Definition at line 256 of file KVTemplateEvent.h.

◆ operator++() [1/2]

template<typename Particle >
const Iterator & KVTemplateEvent< Particle >::Iterator::operator++ ( )
inline

Prefix ++ operator Advance iterator to next particle in event compatible with selection

Definition at line 292 of file KVTemplateEvent.h.

◆ operator++() [2/2]

template<typename Particle >
Iterator KVTemplateEvent< Particle >::Iterator::operator++ ( int  )
inline

Postfix ++ operator Advance iterator to next particle in event compatible with selection

Definition at line 301 of file KVTemplateEvent.h.

◆ operator=()

template<typename Particle >
Iterator & KVTemplateEvent< Particle >::Iterator::operator= ( const Iterator rhs)
inline

copy-assignment operator

Definition at line 309 of file KVTemplateEvent.h.

◆ operator==()

template<typename Particle >
Bool_t KVTemplateEvent< Particle >::Iterator::operator== ( const Iterator it) const
inline

returns kTRUE if the 2 iterators are pointing to the same particle

Definition at line 287 of file KVTemplateEvent.h.

◆ Reset()

template<typename Particle >
void KVTemplateEvent< Particle >::Iterator::Reset ( Type  t = Type::Null,
TString  grp = "" 
)
inline

Reuse iterator, start iteration again

Reset() - use same selection criteria

Reset(Type t[, TString gr]) - change selection criteria

Definition at line 326 of file KVTemplateEvent.h.

◆ SetIsIterating()

template<typename Particle >
void KVTemplateEvent< Particle >::Iterator::SetIsIterating ( Bool_t  on = kTRUE)
inline

set fIterating flag

Definition at line 355 of file KVTemplateEvent.h.

Member Data Documentation

◆ fIter

template<typename Particle >
TIter KVTemplateEvent< Particle >::Iterator::fIter
private

Definition at line 137 of file KVTemplateEvent.h.

◆ fIterating

template<typename Particle >
Bool_t KVTemplateEvent< Particle >::Iterator::fIterating
mutableprivate

Definition at line 139 of file KVTemplateEvent.h.

◆ fSelection

template<typename Particle >
KVTemplateParticleCondition<Particle> KVTemplateEvent< Particle >::Iterator::fSelection
private

Definition at line 136 of file KVTemplateEvent.h.

◆ fType

template<typename Particle >
Type KVTemplateEvent< Particle >::Iterator::fType
private

Definition at line 138 of file KVTemplateEvent.h.