46 src_(consumes<
edm::
View<
T>>(iConfig.getParameter<
edm::InputTag>(
"src"))),
49 auto vwp = iConfig.
getParameter<std::vector<std::string>>(
"WorkingPoints");
55 produces<edm::ValueMap<int>>();
74 std::vector<edm::EDGetTokenT<edm::ValueMap<unsigned int> > >
src_bitmaps_;
75 std::vector<edm::EDGetTokenT<edm::ValueMap<vid::CutFlowResult> > >
src_cutflows_;
80 std::vector<unsigned int>
res_;
103 std::vector<edm::Handle<edm::ValueMap<unsigned int>>> src_bitmaps(
nWP);
105 std::vector<edm::Handle<edm::ValueMap<vid::CutFlowResult>>> src_cutflows(nWP);
108 std::vector<unsigned int>
res;
110 auto npho = src->size();
111 for (
unsigned int i=0; i<npho; i++){
112 auto obj = src->ptrAt(i);
113 for (
unsigned int j=0; j<
nWP; j++){
114 auto cutflow = (*(src_cutflows[j]))[
obj];
116 if (cutflow.cutFlowSize()!=
nCuts)
throw cms::Exception(
"Configuration",
"Trying to compress VID bitmaps for cutflows of different size");
117 auto bitmap = (*(src_bitmaps[j]))[
obj];
118 for (
unsigned int k=0;
k<
nCuts;
k++){
119 if (j==0)
res_[
k] = 0;
121 if (
res_[
k]!=j)
throw cms::Exception(
"Configuration",
"Trying to compress VID bitmaps which are not nested in the correct order for all cuts");
135 filler.
insert(src,res.begin(),res.end());
142 template <
typename T>
147 if (
nBits*
nCuts>
sizeof(
int)*8)
throw cms::Exception(
"Configuration",
"Integer cannot contain the compressed VID bitmap information");
153 template <
typename T>
157 desc.
add<
edm::InputTag>(
"src")->setComment(
"input physics object collection");
158 desc.
add<std::vector<std::string>>(
"WorkingPoints")->setComment(
"working points to be saved in the bitmask");
161 else if (
typeid(
T) ==
typeid(
pat::Photon)) modname+=
"Pho";
162 modname+=
"VIDNestedWPBitmapProducer";
163 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)
void insert(const H &h, I begin, I end)
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)
void beginStream(edm::StreamID) override
VIDNestedWPBitmapProducer< pat::Photon > PhoVIDNestedWPBitmapProducer
void endStream() override
~VIDNestedWPBitmapProducer() override
std::vector< edm::EDGetTokenT< edm::ValueMap< unsigned int > > > src_bitmaps_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)