24 template<
class PhysicsObjectPtr ,
class SelectorType=VersionedSelector<PhysicsObjectPtr> >
42 std::vector<std::unique_ptr<SelectorType> >
ids_;
57 template<
class PhysicsObjectPtr ,
class SelectorType >
67 const std::vector<edm::ParameterSet>& ids =
69 for(
const auto&
id : ids ) {
77 ids_.emplace_back(
new SelectorType(the_id) );
78 calculated_md5 = ids_.back()->md5String();
79 ids_.back()->setConsumes(consumesCollector());
80 if( ids_.back()->cutFlowSize() == 0 ) {
82 <<
"Post-processing cutflow size is zero! You may have configured"
83 <<
" the python incorrectly!";
86 if( idMD5 != calculated_md5 ) {
88 <<
"ID: " << ids_.back()->name() <<
"\n"
89 <<
"The expected md5: " << idMD5 <<
" does not match the md5\n"
90 <<
"calculated by the ID: " << calculated_md5 <<
" please\n"
91 <<
"update your python configuration or determine the source\n"
92 <<
"of transcription error!";
95 std::stringstream idmsg;
98 idmsg <<
"Instantiated ID: " << idname << std::endl
99 <<
"with MD5 hash: " << idMD5 << std::endl;
100 const bool isPOGApproved =
101 id.getUntrackedParameter<
bool>(
"isPOGApproved",
false);
102 if( isPOGApproved ) {
103 idmsg <<
"This ID is POG approved!" << std::endl;
105 idmsg <<
"This ID is not POG approved and likely under development!!!\n"
106 <<
"Please make sure to report your progress with this ID "
107 <<
"at the next relevant POG meeting." << std::endl;
110 if( !isPOGApproved ) {
118 produces<std::string>(idname);
119 produces<edm::ValueMap<bool> >(idname);
120 produces<edm::ValueMap<float> >(idname);
121 produces<edm::ValueMap<unsigned> >(idname);
122 produces<edm::ValueMap<unsigned> >(idname+
std::string(bitmap_label));
123 produces<edm::ValueMap<vid::CutFlowResult> >(idname);
124 produces<pat::UserDataCollection>(idname);
125 produces<edm::ValueMap<edm::Ptr<pat::UserData> > >(idname);
129 template<
class PhysicsObjectPtr ,
class SelectorType >
132 constexpr char bitmap_label[] =
"Bitmap";
135 iEvent.
getByToken(physicsObjectSrc_,physicsObjectsHandle);
137 const Collection& physicsobjects = *physicsObjectsHandle;
139 for(
const auto&
id : ids_ ) {
147 std::vector<bool> passfail;
148 std::vector<float> passfailf;
149 std::vector<unsigned> howfar;
150 std::vector<unsigned> bitmap;
151 std::vector<vid::CutFlowResult> cfrs;
153 for(
size_t i = 0;
i < physicsobjects.
size(); ++
i) {
154 auto po = physicsobjects.
ptrAt(
i);
155 passfail.push_back((*
id)(po,iEvent));
156 passfailf.push_back(passfail.back());
157 howfar.push_back(id->howFarInCutFlow());
158 bitmap.push_back(id->bitMap());
159 cfrs.push_back(id->cutFlowResult());
164 fillerpassfail.
insert(physicsObjectsHandle, passfail.begin(), passfail.end());
165 fillerpassfail.
fill();
168 fillerpassfailf.
insert(physicsObjectsHandle, passfailf.begin(), passfailf.end());
169 fillerpassfailf.
fill();
172 fillerhowfar.
insert(physicsObjectsHandle, howfar.begin(), howfar.end() );
176 fillerbitmap.
insert(physicsObjectsHandle, bitmap.begin(), bitmap.end() );
180 fillercfr.
insert(physicsObjectsHandle, cfrs.begin(), cfrs.end() );
183 iEvent.
put(outPass,id->name());
184 iEvent.
put(outPassf,id->name());
185 iEvent.
put(outHowFar,id->name());
187 iEvent.
put(out_cfrs,id->name());
188 iEvent.
put(std::auto_ptr<std::string>(
new std::string(id->md5String())),
190 auto usrd_handle = iEvent.
put(out_usrd,id->name());
193 std::vector<edm::Ptr<pat::UserData> > usrdptrs;
194 for(
unsigned i = 0;
i < usrd_handle->size(); ++
i ){
199 fillerusrdptrs.insert(physicsObjectsHandle, usrdptrs.begin(), usrdptrs.end());
200 fillerusrdptrs.fill();
202 iEvent.
put(out_usrdptrs,id->name());
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
static std::auto_ptr< UserData > make(const T &value, bool transientOnly=false)
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