20 template<
class PhysicsObjectPtr ,
class SelectorType=VersionedSelector<PhysicsObjectPtr> >
38 std::vector<std::unique_ptr<SelectorType> >
ids_;
53 template<
class PhysicsObjectPtr ,
class SelectorType >
63 const std::vector<edm::ParameterSet>& ids =
65 for(
const auto&
id : ids ) {
73 ids_.emplace_back(
new SelectorType(the_id) );
74 calculated_md5 = ids_.back()->md5String();
75 ids_.back()->setConsumes(consumesCollector());
76 if( ids_.back()->cutFlowSize() == 0 ) {
78 <<
"Post-processing cutflow size is zero! You may have configured"
79 <<
" the python incorrectly!";
82 if( idMD5 != calculated_md5 ) {
84 <<
"ID: " << ids_.back()->name() <<
"\n"
85 <<
"The expected md5: " << idMD5 <<
" does not match the md5\n"
86 <<
"calculated by the ID: " << calculated_md5 <<
" please\n"
87 <<
"update your python configuration or determine the source\n"
88 <<
"of transcription error!";
91 std::stringstream idmsg;
94 idmsg <<
"Instantiated ID: " << idname << std::endl
95 <<
"with MD5 hash: " << idMD5 << std::endl;
96 const bool isPOGApproved =
97 id.getUntrackedParameter<
bool>(
"isPOGApproved",
false);
99 idmsg <<
"This ID is POG approved!" << std::endl;
101 idmsg <<
"This ID is not POG approved and likely under development!!!\n"
102 <<
"Please make sure to report your progress with this ID "
103 <<
"at the next relevant POG meeting." << std::endl;
106 if( !isPOGApproved ) {
114 produces<std::string>(idname);
115 produces<edm::ValueMap<bool> >(idname);
116 produces<edm::ValueMap<float> >(idname);
117 produces<edm::ValueMap<unsigned> >(idname);
118 produces<edm::ValueMap<unsigned> >(idname+
std::string(bitmap_label));
122 template<
class PhysicsObjectPtr ,
class SelectorType >
125 constexpr char bitmap_label[] =
"Bitmap";
128 iEvent.
getByToken(physicsObjectSrc_,physicsObjectsHandle);
130 const Collection& physicsobjects = *physicsObjectsHandle;
132 for(
const auto&
id : ids_ ) {
137 std::vector<bool> passfail;
138 std::vector<float> passfailf;
139 std::vector<unsigned> howfar;
140 std::vector<unsigned> bitmap;
141 for(
size_t i = 0;
i < physicsobjects.
size(); ++
i) {
142 auto po = physicsobjects.
ptrAt(
i);
143 passfail.push_back((*
id)(po,iEvent));
144 passfailf.push_back(passfail.back());
145 howfar.push_back(id->howFarInCutFlow());
146 bitmap.push_back(id->bitMap());
150 fillerpassfail.
insert(physicsObjectsHandle, passfail.begin(), passfail.end());
151 fillerpassfail.
fill();
154 fillerpassfailf.
insert(physicsObjectsHandle, passfailf.begin(), passfailf.end());
155 fillerpassfailf.
fill();
158 fillerhowfar.
insert(physicsObjectsHandle, howfar.begin(), howfar.end() );
162 fillerbitmap.
insert(physicsObjectsHandle, bitmap.begin(), bitmap.end() );
165 iEvent.
put(outPass,id->name());
166 iEvent.
put(outPassf,id->name());
167 iEvent.
put(outHowFar,id->name());
169 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