1 #ifndef DataFormats_EventHypothesis_interface_EventHypothesis_h
2 #define DataFormats_EventHypothesis_interface_EventHypothesis_h
6 #include <boost/regex.hpp>
7 #include <boost/shared_ptr.hpp>
11 namespace eventhypothesis {
template<
typename T>
struct Looper; }
13 namespace eventhypothesis {
55 template<
typename T>
const T *
getAs(
const std::string &role,
int index=0)
const ;
61 std::vector<CandRefType>
all(
const std::string &roleRegexp)
const;
67 size_t count(
const std::string &roleRegexp)
const;
99 template<
typename Iterator,
typename Predicate>
106 namespace eventhypothesis {
115 return boost::regex_match(role,
re_);
122 template<
typename Iterator,
typename Predicate>
126 while (it != realEnd) {
128 if (idx == 0)
return it;
141 const T*
ret =
dynamic_cast<const T*
>(ref.
get());
143 "You can't convert a " <<
typeid(*ref).name() <<
" to a " <<
typeid(
T).
name() <<
"\n" <<
144 "note: you can use c++filt command to convert the above in human readable types.\n";
152 const T*
ret =
dynamic_cast<const T*
>(ref.
get());
154 "You can't convert a " <<
typeid(*ref).name() <<
" to a " <<
typeid(
T).
name() <<
"\n" <<
155 "note: you can use c++filt command to convert the above in human readable types.\n";
const std::string & role_
CandLooper loop() const
Loops over all particles.
eventhypothesis::ParticleFilter ParticleFilter
std::vector< value_type > particles_
eventhypothesis::Looper< T > loopAs(const std::string &roleRegexp) const
Loops over particles which have certaint roles.
std::pair< std::string, CandRefType > value_type
Iterator realGet(const Iterator &realBegin, const Iterator &realEnd, const Predicate &p, size_t idx) const
RoleRegexpFilter(const std::string &roleRegexp)
void add(const CandRefType &ref, const std::string &role)
std::vector< CandRefType > all(const std::string &roleRegexp) const
Return EDM references to all particles which have certaint roles.
const T * getAs(const std::string &role, int index=0) const
boost::shared_ptr< const ParticleFilter > ParticleFilterPtr
const CandRefType & operator[](const std::string &role) const
reco::CandidatePtr CandRefType
const_iterator end() const
T const * get() const
Returns C++ pointer to the item.
const CandRefType & operator[](const ParticleFilter &filter) const
eventhypothesis::CandRefType CandRefType
bool operator()(const value_type &p) const
eventhypothesis::Looper< reco::Candidate > CandLooper
virtual ~ParticleFilter()
std::vector< value_type > vector_type
eventhypothesis::ParticleFilterPtr ParticleFilterPtr
vector_type::const_iterator const_iterator
const_reverse_iterator rend() const
ByRole(const std::string &role)
virtual bool operator()(const CandRefType &cand, const std::string &role) const
virtual bool operator()(const CandRefType &cand, const std::string &role) const
const_iterator begin() const
vector_type::const_reverse_iterator const_reverse_iterator
bool operator()(const std::pair< std::string, CandRefType > &p) const
const_reverse_iterator rbegin() const