1 #ifndef PhysicsTools_SelectorUtils_VersionedSelector_h
2 #define PhysicsTools_SelectorUtils_VersionedSelector_h
22 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
27 #include <openssl/md5.h>
29 #include <boost/shared_ptr.hpp>
31 namespace candf = candidate_functions;
41 constexpr unsigned length = MD5_DIGEST_LENGTH;
44 memset(
id_md5_,0,length*
sizeof(
unsigned char));
48 <<
"VersionedSelector does not allow untracked parameters"
49 <<
" in the configuration ParameterSet!";
52 MD5((
unsigned char*)tracked.c_str(), tracked.size(),
id_md5_);
54 for(
unsigned i=0;
i<MD5_DIGEST_LENGTH; ++
i ){
63 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
71 <<
"VersionedGsfElectronSelector not initialized!" << std::endl;
73 for(
unsigned i = 0;
i <
cuts_.size(); ++
i ) {
88 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
93 for(
size_t i = 0, cutssize =
cuts_.size();
i < cutssize; ++
i ) {
107 constexpr unsigned length = MD5_DIGEST_LENGTH;
108 return ( 0 == memcmp(
id_md5_,other.
id_md5_,length*
sizeof(
unsigned char)) );
120 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
126 std::vector<boost::shared_ptr<candf::CandidateCut> >
cuts_;
141 <<
"ID was already initialized!";
144 const std::vector<edm::ParameterSet>& cutflow =
146 if( cutflow.size() == 0 ) {
148 <<
"You have supplied a null/empty cutflow to VersionedIDSelector,"
149 <<
" please add content to the cuflow and try again.";
152 std::vector<edm::ParameterSet>::const_iterator cbegin(cutflow.begin()),
154 std::vector<edm::ParameterSet>::const_iterator icut = cbegin;
155 for( ; icut != cend; ++icut ) {
157 const bool needsContent =
158 icut->getParameter<
bool>(
"needsAdditionalProducts");
159 const bool ignored = icut->getParameter<
bool>(
"isIgnored");
161 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
166 if( plugin !=
nullptr ) {
167 cuts_.push_back(boost::shared_ptr<candf::CandidateCut>(plugin));
170 <<
"The requested cut: " << name <<
" is not available!";
172 needs_event_content_.push_back(needsContent);
173 this->push_back(name);
175 if(ignored) this->ignoreCut(name);
179 for( ; icut != cend; ++icut ) {
186 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
190 for(
size_t i = 0, cutssize = cuts_.size();
i < cutssize; ++
i ) {
191 if( needs_event_content_[
i] ) {
T getParameter(std::string const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
const unsigned char * md55Raw() const
bool operator()(const T &ref, pat::strbitset &ret) overridefinal
This provides the interface for base classes to select objects.
auto_ptr< JetDefinition::Plugin > plugin
std::string dump(unsigned int indent=0) const
bool operator()(const T &ref, edm::EventBase const &e, pat::strbitset &ret) overridefinal
This provides an alternative signature that includes extra information.
const size_t cutFlowSize() const
void setIgnored(pat::strbitset &ret)
set ignored bits
pat::strbitset retInternal_
internal ret if users don't care about return bits
VersionedSelector(const edm::ParameterSet &conf)
ParameterSet trackedPart() const
std::vector< bool > needs_event_content_
const std::string & name() const
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
void initialize(const edm::ParameterSet &)
virtual void getEventContent(const edm::EventBase &)=0
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Functor that operates on <T>
const unsigned howFarInCutFlow() const
const std::string & md5String() const
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
void setConsumes(edm::ConsumesCollector)
std::vector< boost::shared_ptr< candf::CandidateCut > > cuts_
unsigned char id_md5_[MD5_DIGEST_LENGTH]
volatile std::atomic< bool > shutdown_flag false
std::vector< typename Selector< T >::index_type > cut_indices_
cut-flow versioning info in the event provenance
bool operator==(const VersionedSelector &other) const
virtual void setConsumes(edm::ConsumesCollector &)=0
T get(const Candidate &c)