@@ -27,7 +27,7 @@ GBRForestsAndConstants::GBRForestsAndConstants(edm::ParameterSet const& iConfig)
2727 applyJec_(iConfig.getParameter<bool >(" applyJec" )),
2828 jec_(iConfig.getParameter<std::string>(" jec" )),
2929 residualsFromTxt_(iConfig.getParameter<bool >(" residualsFromTxt" )),
30- usePuppi_(iConfig.getParameter< bool >( " usePuppi " ) ) {
30+ applyConstituentWeight_( false ) {
3131 if (residualsFromTxt_) {
3232 residualsTxt_ = iConfig.getParameter <edm::FileInPath>(" residualsTxt" );
3333 }
@@ -40,6 +40,11 @@ GBRForestsAndConstants::GBRForestsAndConstants(edm::ParameterSet const& iConfig)
4040 if (!runMvas_) {
4141 assert (algos.size () == 1 );
4242 }
43+
44+ edm::InputTag srcConstituentWeights = iConfig.getParameter <edm::InputTag>(" srcConstituentWeights" );
45+ if (!srcConstituentWeights.label ().empty ()) {
46+ applyConstituentWeight_ = true ;
47+ }
4348}
4449
4550// ------------------------------------------------------------------------------------------
@@ -62,6 +67,11 @@ PileupJetIdProducer::PileupJetIdProducer(const edm::ParameterSet& iConfig, GBRFo
6267 consumes<edm::ValueMap<StoredPileupJetIdentifier>>(iConfig.getParameter <edm::InputTag>(" jetids" ));
6368 input_rho_token_ = consumes<double >(iConfig.getParameter <edm::InputTag>(" rho" ));
6469 parameters_token_ = esConsumes (edm::ESInputTag (" " , globalCache->jec ()));
70+
71+ edm::InputTag srcConstituentWeights = iConfig.getParameter <edm::InputTag>(" srcConstituentWeights" );
72+ if (!srcConstituentWeights.label ().empty ()) {
73+ input_constituent_weights_token_ = consumes<edm::ValueMap<float >>(srcConstituentWeights);
74+ }
6575}
6676
6777// ------------------------------------------------------------------------------------------
@@ -80,6 +90,12 @@ void PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
8090 iEvent.getByToken (input_jet_token_, jetHandle);
8191 const View<Jet>& jets = *jetHandle;
8292
93+ // Constituent weight (e.g PUPPI) Value Map
94+ edm::ValueMap<float > constituentWeights;
95+ if (!input_constituent_weights_token_.isUninitialized ()) {
96+ constituentWeights = iEvent.get (input_constituent_weights_token_);
97+ }
98+
8399 // input variables
84100 Handle<ValueMap<StoredPileupJetIdentifier>> vmap;
85101 if (!gc->produceJetIds ()) {
@@ -167,7 +183,9 @@ void PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
167183 PileupJetIdentifier puIdentifier;
168184 if (gc->produceJetIds ()) {
169185 // Compute the input variables
170- puIdentifier = ialgo->computeIdVariables (theJet, jec, &(*vtx), *vertexes, rho, gc->usePuppi ());
186+ // //////////////////////////// added PUPPI weight Value Map
187+ puIdentifier = ialgo->computeIdVariables (
188+ theJet, jec, &(*vtx), *vertexes, rho, constituentWeights, gc->applyConstituentWeight ());
171189 ids.push_back (puIdentifier);
172190 } else {
173191 // Or read it from the value map
0 commit comments