48 src_(consumes<
edm::
View<
T>>(iConfig.getParameter<
edm::InputTag>(
"src"))),
51 auto const& vwp = iConfig.
getParameter<std::vector<std::string>>(
"WorkingPoints");
52 for (
auto const& wp : vwp) {
57 produces<edm::ValueMap<int>>();
69 std::vector<edm::EDGetTokenT<edm::ValueMap<unsigned int> > >
src_bitmaps_;
70 std::vector<edm::EDGetTokenT<edm::ValueMap<vid::CutFlowResult> > >
src_cutflows_;
75 std::vector<unsigned int>
res_;
90 std::vector<edm::Handle<edm::ValueMap<unsigned int>>> src_bitmaps(
nWP);
92 std::vector<edm::Handle<edm::ValueMap<vid::CutFlowResult>>> src_cutflows(nWP);
95 std::vector<unsigned int>
res;
97 for (
auto const&
obj : src->ptrs()) {
98 for (
unsigned int j=0; j<
nWP; j++){
99 auto cutflow = (*(src_cutflows[j]))[
obj];
101 if (cutflow.cutFlowSize()!=
nCuts)
throw cms::Exception(
"Configuration",
"Trying to compress VID bitmaps for cutflows of different size");
102 auto bitmap = (*(src_bitmaps[j]))[
obj];
103 for (
unsigned int k=0;
k<
nCuts;
k++){
104 if (j==0)
res_[
k] = 0;
106 if (
res_[
k]!=j)
throw cms::Exception(
"Configuration",
"Trying to compress VID bitmaps which are not nested in the correct order for all cuts");
117 auto resV = std::make_unique<edm::ValueMap<int>>();
119 filler.insert(src,res.begin(),res.end());
126 template <
typename T>
131 if (
nBits*
nCuts>
sizeof(
int)*8)
throw cms::Exception(
"Configuration",
"Integer cannot contain the compressed VID bitmap information");
137 template <
typename T>
141 desc.
add<
edm::InputTag>(
"src")->setComment(
"input physics object collection");
142 desc.
add<std::vector<std::string>>(
"WorkingPoints")->setComment(
"working points to be saved in the bitmask");
145 else if (
typeid(
T) ==
typeid(
pat::Photon)) modname+=
"Pho";
146 modname+=
"VIDNestedWPBitmapProducer";
147 descriptions.
add(modname,desc);
T getParameter(std::string const &) const
Analysis-level Photon class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< edm::EDGetTokenT< edm::ValueMap< vid::CutFlowResult > > > src_cutflows_
void initNCuts(unsigned int)
std::vector< unsigned int > res_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
VIDNestedWPBitmapProducer< pat::Electron > EleVIDNestedWPBitmapProducer
VIDNestedWPBitmapProducer(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< edm::View< T > > src_
Analysis-level electron class.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
VIDNestedWPBitmapProducer< pat::Photon > PhoVIDNestedWPBitmapProducer
std::vector< edm::EDGetTokenT< edm::ValueMap< unsigned int > > > src_bitmaps_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)