|
|
Go to the documentation of this file. 1 #ifndef DataFormats_EventHypothesis_interface_EventHypothesisLooper_h
2 #define DataFormats_EventHypothesis_interface_EventHypothesisLooper_h
9 namespace eventhypothesis {
28 cachePtr_ = dynamic_cast<const T *>(ptr);
35 if ((ptr !=
nullptr) && (cachePtr_ ==
nullptr))
37 <<
"You can't convert a " <<
typeid(*ptr).name() <<
" to a " <<
typeid(
T).
name() <<
"\n"
38 <<
"note: you can use c++filt command to convert the above in human readable types.\n";
104 operator bool()
const;
107 template <
typename T2>
111 template <
typename T2>
115 template <
typename T2>
119 template <
typename T2>
123 template <
typename T2>
127 template <
typename T2>
151 template <
typename T>
157 template <
typename T>
162 template <
typename T>
164 : eh_(eh), filter_(
filter), total_(-1) {
168 template <
typename T>
170 assert(iter_ <= eh_.end());
171 assert((iter_ + 1) >= eh_.begin());
172 assert((iter_ < eh_.begin()) || (iter_ == eh_.end()) || ((*filter_)(*iter_)));
176 template <
typename T>
180 if (iter_ == eh_.end())
184 if (iter_ == eh_.end())
186 if ((*filter_)(*iter_)) {
195 template <
typename T>
203 if (iter_ < eh_.begin()) {
207 if ((*filter_)(*iter_)) {
217 template <
typename T>
220 std::advance(
this,
delta);
225 template <
typename T>
230 std::advance(
this,
item);
234 std::advance(
this,
item);
240 template <
typename T>
245 for (; iter_ != eh_.end(); ++iter_) {
246 if ((*filter_)(*iter_))
252 template <
typename T>
254 return (iter_ < eh_.end()) && (iter_ >= eh_.begin());
257 template <
typename T>
260 if (it < eh_.begin()) {
266 for (; it != eh_.end(); ++it) {
const T * get(const reco::Candidate *ptr)
vector_type::const_iterator const_iterator
const T * operator->() const
Accessor as if it was a const_iterator on a list of T.
const_iterator begin() const
bool operator!=(const Looper< T2 > &other) const
Looper(const EventHypothesis &eh, const ParticleFilter &filter)
bool isTypeOk() const
test if the type is correct
size_t globalIndex()
Index of this item in the full EventHypothesis.
bool typeOk(const reco::Candidate *ptr)
const reco::Candidate & cand() const
C++ reference to pointed particle.
const T * get() const
Accessor as if it was a smart pointer to const T *.
const CandRefType & ref() const
EDM Ref to pointed particle.
std::shared_ptr< const ParticleFilter > ParticleFilterPtr
bool operator>=(const Looper< T2 > &other) const
void doPtr(const reco::Candidate *ptr)
bool operator>(const Looper< T2 > &other) const
bool operator<(const Looper< T2 > &other) const
const ParticleFilterPtr filter_
size_t index() const
Index of this item among those in the loop.
size_t size() const
Number of particles in the loop.
const std::string & role() const
Role of pointed item.
EventHypothesis::const_iterator const_iterator
bool operator==(const Looper< T2 > &other) const
returns true if loopers point to the same record
Looper< reco::Candidate > CandLooper
const EventHypothesis & eh_
const T & operator*() const
Accessor as if it was a const_iterator on a list of T.
Looper & operator++()
iteration
Looper & skip(int delta)
skip (might be slow)
bool typeOk(const reco::Candidate *ptr)
Looper & operator--()
iteration
bool operator<=(const Looper< T2 > &other) const
const reco::Candidate * get(const reco::Candidate *ptr)
Looper & reset(int item=0)
void operator()(void const *) const