22 : runMvas_(iConfig.getParameter<
bool>(
"runMvas")),
23 produceJetIds_(iConfig.getParameter<
bool>(
"produceJetIds")),
24 inputIsCorrected_(iConfig.getParameter<
bool>(
"inputIsCorrected")),
25 applyJec_(iConfig.getParameter<
bool>(
"applyJec")),
26 jec_(iConfig.getParameter<
std::
string>(
"jec")),
27 residualsFromTxt_(iConfig.getParameter<
bool>(
"residualsFromTxt")),
28 usePuppi_(iConfig.getParameter<
bool>(
"usePuppi")) {
33 std::vector<edm::ParameterSet>
algos = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"algos");
34 for (
auto const& algoPset :
algos) {
46 produces<edm::ValueMap<StoredPileupJetIdentifier>>(
"");
50 algos_.emplace_back(
label, std::make_unique<PileupJetIdAlgo>(&algoGBRForestsAndConstants));
52 produces<edm::ValueMap<float>>(
label +
"Discriminant");
53 produces<edm::ValueMap<int>>(
label +
"Id");
90 vector<StoredPileupJetIdentifier> ids;
91 map<string, vector<float>> mvas;
92 map<string, vector<int>> idflags;
95 VertexCollection::const_iterator
vtx;
115 for (
unsigned int i = 0;
i <
jets.size(); ++
i) {
117 auto algoi =
algos_.begin();
123 patjet = dynamic_cast<const pat::Jet*>(&
jet);
124 ispat = patjet !=
nullptr;
151 std::unique_ptr<reco::Jet> corrJet;
158 corrJet.reset(dynamic_cast<reco::Jet*>(
jet.clone()));
160 corrJet->scaleEnergy(
scale);
168 ids.push_back(puIdentifier);
171 puIdentifier = (*vmap)[
jets.refAt(
i)];
172 puIdentifier.
jetPt(theJet->
pt());
175 ialgo->
set(puIdentifier);
181 mvas[algoi->first].push_back(puIdentifier.
mva());
182 idflags[algoi->first].push_back(puIdentifier.
idFlag());
183 for (++algoi; algoi !=
algos_.end(); ++algoi) {
184 ialgo = algoi->second.get();
185 ialgo->
set(puIdentifier);
187 mvas[algoi->first].push_back(
id.
mva());
188 idflags[algoi->first].push_back(
id.idFlag());
195 for (
const auto& ialgo :
algos_) {
197 vector<float>&
mva = mvas[ialgo.first];
198 auto mvaout = std::make_unique<ValueMap<float>>();
200 mvafiller.insert(jetHandle,
mva.begin(),
mva.end());
205 vector<int>& idflag = idflags[ialgo.first];
206 auto idflagout = std::make_unique<ValueMap<int>>();
208 idflagfiller.insert(jetHandle, idflag.begin(), idflag.end());
215 assert(jetHandle->size() == ids.size());
216 auto idsout = std::make_unique<ValueMap<StoredPileupJetIdentifier>>();
218 idsfiller.insert(jetHandle, ids.begin(), ids.end());
238 std::vector<std::string> jecLevels;
239 jecLevels.push_back(
"L1FastJet");
240 jecLevels.push_back(
"L2Relative");
241 jecLevels.push_back(
"L3Absolute");
243 jecLevels.push_back(
"L2L3Residual");
248 for (std::vector<std::string>::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll) {