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 ) {
103 #ifndef __ROOTCLING__
109 constexpr unsigned length = MD5_DIGEST_LENGTH;
110 return ( 0 == memcmp(
id_md5_,other.
id_md5_,length*
sizeof(
unsigned char)) );
122 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
128 std::vector<boost::shared_ptr<candf::CandidateCut> >
cuts_;
143 <<
"ID was already initialized!";
146 const std::vector<edm::ParameterSet>& cutflow =
148 if( cutflow.size() == 0 ) {
150 <<
"You have supplied a null/empty cutflow to VersionedIDSelector,"
151 <<
" please add content to the cuflow and try again.";
154 std::vector<edm::ParameterSet>::const_iterator cbegin(cutflow.begin()),
156 std::vector<edm::ParameterSet>::const_iterator icut = cbegin;
157 for( ; icut != cend; ++icut ) {
159 const bool needsContent =
160 icut->getParameter<
bool>(
"needsAdditionalProducts");
161 const bool ignored = icut->getParameter<
bool>(
"isIgnored");
163 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
168 if( plugin !=
nullptr ) {
169 cuts_.push_back(boost::shared_ptr<candf::CandidateCut>(plugin));
172 <<
"The requested cut: " << name <<
" is not available!";
174 needs_event_content_.push_back(needsContent);
175 this->push_back(name);
177 if(ignored) this->ignoreCut(name);
181 for( ; icut != cend; ++icut ) {
188 #if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
192 for(
size_t i = 0, cutssize = cuts_.size();
i < cutssize; ++
i ) {
193 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)