24 : runMvas_(iConfig.getParameter<
bool>(
"runMvas")),
25 produceJetIds_(iConfig.getParameter<
bool>(
"produceJetIds")),
26 inputIsCorrected_(iConfig.getParameter<
bool>(
"inputIsCorrected")),
27 applyJec_(iConfig.getParameter<
bool>(
"applyJec")),
28 jec_(iConfig.getParameter<
std::
string>(
"jec")),
29 residualsFromTxt_(iConfig.getParameter<
bool>(
"residualsFromTxt")),
30 usePuppi_(iConfig.getParameter<
bool>(
"usePuppi")) {
35 std::vector<edm::ParameterSet>
algos = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"algos");
36 for (
auto const& algoPset :
algos) {
48 produces<edm::ValueMap<StoredPileupJetIdentifier>>(
"");
52 algos_.emplace_back(
label, std::make_unique<PileupJetIdAlgo>(&algoGBRForestsAndConstants));
54 produces<edm::ValueMap<float>>(
label +
"Discriminant");
55 produces<edm::ValueMap<int>>(
label +
"Id");
92 vector<StoredPileupJetIdentifier> ids;
93 map<string, vector<float>> mvas;
94 map<string, vector<int>> idflags;
97 VertexCollection::const_iterator
vtx;
117 for (
unsigned int i = 0;
i <
jets.size(); ++
i) {
119 auto algoi =
algos_.begin();
125 patjet = dynamic_cast<const pat::Jet*>(&
jet);
126 ispat = patjet !=
nullptr;
153 std::unique_ptr<reco::Jet> corrJet;
158 corrJet = std::make_unique<pat::Jet>(patjet->
correctedJet(0));
160 corrJet.reset(dynamic_cast<reco::Jet*>(
jet.clone()));
162 corrJet->scaleEnergy(
scale);
170 ids.push_back(puIdentifier);
173 puIdentifier = (*vmap)[
jets.refAt(
i)];
174 puIdentifier.
jetPt(theJet->
pt());
177 ialgo->
set(puIdentifier);
183 mvas[algoi->first].push_back(puIdentifier.
mva());
184 idflags[algoi->first].push_back(puIdentifier.
idFlag());
185 for (++algoi; algoi !=
algos_.end(); ++algoi) {
186 ialgo = algoi->second.get();
187 ialgo->
set(puIdentifier);
189 mvas[algoi->first].push_back(
id.
mva());
190 idflags[algoi->first].push_back(
id.idFlag());
197 for (
const auto& ialgo :
algos_) {
199 vector<float>&
mva = mvas[ialgo.first];
200 auto mvaout = std::make_unique<ValueMap<float>>();
202 mvafiller.insert(jetHandle,
mva.begin(),
mva.end());
207 vector<int>& idflag = idflags[ialgo.first];
208 auto idflagout = std::make_unique<ValueMap<int>>();
210 idflagfiller.insert(jetHandle, idflag.begin(), idflag.end());
217 assert(jetHandle->size() == ids.size());
218 auto idsout = std::make_unique<ValueMap<StoredPileupJetIdentifier>>();
220 idsfiller.insert(jetHandle, ids.begin(), ids.end());
240 std::vector<std::string> jecLevels;
241 jecLevels.push_back(
"L1FastJet");
242 jecLevels.push_back(
"L2Relative");
243 jecLevels.push_back(
"L3Absolute");
245 jecLevels.push_back(
"L2L3Residual");
250 for (std::vector<std::string>::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll) {