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(
size_t i = 0;
i < physicsobjects.
size(); ++
i) {
128 auto po = physicsobjects.
ptrAt(
i);
129 passfail.push_back((*
id)(po,iEvent));
130 passfailf.push_back(passfail.back());
131 howfar.push_back(id->howFarInCutFlow());
135 fillerpassfail.
insert(physicsObjectsHandle, passfail.begin(), passfail.end());
136 fillerpassfail.
fill();
139 fillerpassfailf.
insert(physicsObjectsHandle, passfailf.begin(), passfailf.end());
140 fillerpassfailf.
fill();
143 fillerhowfar.
insert(physicsObjectsHandle, howfar.begin(), howfar.end() );
146 iEvent.
put(outPass,id->name());
147 iEvent.
put(outPassf,id->name());
148 iEvent.
put(outHowFar,id->name());
149 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
Ptr< value_type > ptrAt(size_type i) const
void insert(const H &h, I begin, I end)
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