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>
10 #include <type_traits>
15 namespace eventhypothesis {
template<
typename T>
class Looper; }
17 namespace eventhypothesis {
103 template<
typename Iterator,
typename Predicate>
112 namespace eventhypothesis {
124 return boost::regex_match(role,
re_);
131 template<
typename Iterator,
typename Predicate>
135 while (it != realEnd) {
137 if (idx == 0)
return it;
151 if (currentType !=
nullptr && targetType !=
nullptr) {
152 message <<
"You can't convert a '" << currentType <<
"' to a '" << targetType <<
"'" << std::endl;
156 message <<
"You can't convert a '" <<
typeid(ref).
name() <<
"' to a '" <<
typeid(
T).
name() <<
"'" << std::endl;
157 message <<
"Note: you can use 'c++filt -t' command to convert the above in human readable types." << std::endl;
159 return message.str();
167 const T*
ret =
dynamic_cast<const T*
>(ref.
get());
168 if ((ret == 0) && (ref.
get() != 0))
throw cms::Exception(
"Type Checking") << createExceptionMessage<T>(ref);
176 const T*
ret =
dynamic_cast<const T*
>(ref.
get());
177 if ((ret == 0) && (ref.
get() != 0))
throw cms::Exception(
"Type Checking") << createExceptionMessage<T>(ref);
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.
static const AcceptAllFilter s_dummyFilter
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)
T const * get() const
Returns C++ pointer to the item.
std::string createExceptionMessage(const CandRefType &ref) const
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
char * getDemangledSymbol(const char *mangledSymbol) const
const_iterator end() const
const CandRefType & operator[](const ParticleFilter &filter) const
eventhypothesis::CandRefType CandRefType
bool operator()(const value_type &p) const
eventhypothesis::Looper< reco::Candidate > CandLooper
virtual ~ParticleFilter()
Container::value_type value_type
std::vector< value_type > vector_type
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
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