20 template<
class PhysicsObjectPtr ,
class SelectorType=VersionedSelector<PhysicsObjectPtr> >
38 std::vector<std::unique_ptr<SelectorType> >
ids_;
52 template<
class PhysicsObjectPtr ,
class SelectorType >
60 const std::vector<edm::ParameterSet>& ids =
62 for(
const auto&
id : ids ) {
70 ids_.emplace_back(
new SelectorType(the_id) );
71 calculated_md5 = ids_.back()->md5String();
72 ids_.back()->setConsumes(consumesCollector());
73 if( ids_.back()->cutFlowSize() == 0 ) {
75 <<
"Post-processing cutflow size is zero! You may have configured"
76 <<
" the python incorrectly!";
79 if( idMD5 != calculated_md5 ) {
81 <<
"The expected md5: " << idMD5 <<
" does not match the md5\n"
82 <<
"calculated by the ID: " << calculated_md5 <<
" please\n"
83 <<
"update your python configuration or determine the source\n"
84 <<
"of transcription error!";
87 std::stringstream idmsg;
90 idmsg <<
"Instantiated ID: " << idname << std::endl
91 <<
"with MD5 hash: " << idMD5 << std::endl;
92 const bool isPOGApproved =
93 id.getUntrackedParameter<
bool>(
"isPOGApproved",
false);
95 idmsg <<
"This ID is POG approved!" << std::endl;
97 idmsg <<
"This ID is not POG approved and likely under development!!!\n"
98 <<
"Please make sure to report your progress with this ID "
99 <<
"at the next relevant POG meeting." << std::endl;
105 produces<std::string>(idname);
106 produces<edm::ValueMap<bool> >(idname);
107 produces<edm::ValueMap<float> >(idname);
108 produces<edm::ValueMap<unsigned> >(idname);
112 template<
class PhysicsObjectPtr ,
class SelectorType >
116 iEvent.
getByToken(physicsObjectSrc_,physicsObjectsHandle);
118 const Collection& physicsobjects = *physicsObjectsHandle;
120 for(
const auto&
id : ids_ ) {
124 std::vector<bool> passfail;
125 std::vector<float> passfailf;
126 std::vector<unsigned> howfar;
127 for(
const auto& po : physicsobjects.
ptrVector()) {
128 passfail.push_back((*
id)(po,iEvent));
129 passfailf.push_back(passfail.back());
130 howfar.push_back(id->howFarInCutFlow());
134 fillerpassfail.
insert(physicsObjectsHandle, passfail.begin(), passfail.end());
135 fillerpassfail.
fill();
138 fillerpassfailf.
insert(physicsObjectsHandle, passfailf.begin(), passfailf.end());
139 fillerpassfailf.
fill();
142 fillerhowfar.
insert(physicsObjectsHandle, howfar.begin(), howfar.end() );
145 iEvent.
put(outPass,id->name());
146 iEvent.
put(outPassf,id->name());
147 iEvent.
put(outHowFar,id->name());
148 iEvent.
put(std::auto_ptr<std::string>(
new std::string(id->md5String())),
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
VParameterSet const & getParameterSetVector(std::string const &name) const
std::vector< std::unique_ptr< SelectorType > > ids_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void insert(const H &h, I begin, I end)
PtrVector< T > const & ptrVector() const
typename PhysicsObjectPtr::value_type PhysicsObjectType
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void produce(edm::Event &, const edm::EventSetup &) override
Container::value_type value_type
VersionedIdProducer(const edm::ParameterSet &)
TokenType physicsObjectSrc_
ParameterSet const & getParameterSet(std::string const &) const