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 applyConstituentWeight_(
false) {
35 std::vector<edm::ParameterSet>
algos = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"algos");
36 for (
auto const& algoPset :
algos) {
53 produces<edm::ValueMap<StoredPileupJetIdentifier>>(
"");
57 algos_.emplace_back(
label, std::make_unique<PileupJetIdAlgo>(&algoGBRForestsAndConstants));
59 produces<edm::ValueMap<float>>(
label +
"Discriminant");
60 produces<edm::ValueMap<int>>(
label +
"Id");
109 vector<StoredPileupJetIdentifier> ids;
110 map<string, vector<float>> mvas;
111 map<string, vector<int>> idflags;
114 VertexCollection::const_iterator
vtx;
134 for (
unsigned int i = 0;
i <
jets.size(); ++
i) {
136 auto algoi =
algos_.begin();
143 ispat = patjet !=
nullptr;
170 std::unique_ptr<reco::Jet> corrJet;
175 corrJet = std::make_unique<pat::Jet>(patjet->
correctedJet(0));
177 corrJet.reset(dynamic_cast<reco::Jet*>(
jet.clone()));
179 corrJet->scaleEnergy(
scale);
189 ids.push_back(puIdentifier);
192 puIdentifier = (*vmap)[
jets.refAt(
i)];
193 puIdentifier.
jetPt(theJet->
pt());
196 ialgo->
set(puIdentifier);
202 mvas[algoi->first].push_back(puIdentifier.
mva());
203 idflags[algoi->first].push_back(puIdentifier.
idFlag());
204 for (++algoi; algoi !=
algos_.end(); ++algoi) {
205 ialgo = algoi->second.get();
206 ialgo->
set(puIdentifier);
208 mvas[algoi->first].push_back(
id.
mva());
209 idflags[algoi->first].push_back(
id.idFlag());
216 for (
const auto& ialgo :
algos_) {
218 vector<float>&
mva = mvas[ialgo.first];
219 auto mvaout = std::make_unique<ValueMap<float>>();
221 mvafiller.insert(jetHandle,
mva.begin(),
mva.end());
226 vector<int>& idflag = idflags[ialgo.first];
227 auto idflagout = std::make_unique<ValueMap<int>>();
229 idflagfiller.insert(jetHandle, idflag.begin(), idflag.end());
236 assert(jetHandle->size() == ids.size());
237 auto idsout = std::make_unique<ValueMap<StoredPileupJetIdentifier>>();
239 idsfiller.insert(jetHandle, ids.begin(), ids.end());
259 std::vector<std::string> jecLevels;
260 jecLevels.push_back(
"L1FastJet");
261 jecLevels.push_back(
"L2Relative");
262 jecLevels.push_back(
"L3Absolute");
264 jecLevels.push_back(
"L2L3Residual");
268 for (std::vector<std::string>::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll) {
const float & jetPhi() const
void set(const PileupJetIdentifier &)
std::vector< JetCorrectorParameters > jetCorPars_
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
double pt() const final
transverse momentum
std::string fullPath() const
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
Base class for all types of Jets.
bool inputIsCorrected() const
T const * product() const
edm::EDGetTokenT< edm::View< reco::Jet > > input_jet_token_
constexpr bool isUninitialized() const noexcept
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool applyConstituentWeight() const
edm::EDGetTokenT< edm::ValueMap< float > > input_constituent_weights_token_
PileupJetIdProducer(const edm::ParameterSet &, GBRForestsAndConstants const *)
const float & jetPt() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool residualsFromTxt() const
void addDefault(ParameterSetDescription const &psetDescription)
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, edm::ValueMap< float > &constituentWeights, bool applyConstituentWeight)
edm::FileInPath const & residualsTxt() const
bool applyConstituentWeight_
edm::EDGetTokenT< double > input_rho_token_
#define DEFINE_FWK_MODULE(type)
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData)
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< PileupJetIdAlgo::AlgoGBRForestsAndConstants > vAlgoGBRForestsAndConstants_
edm::FileInPath residualsTxt_
std::vector< std::pair< std::string, std::unique_ptr< PileupJetIdAlgo > > > algos_
const float & jetEta() const
PileupJetIdentifier computeMva()
Analysis-level calorimeter jet class.
std::vector< PileupJetIdAlgo::AlgoGBRForestsAndConstants > const & vAlgoGBRForestsAndConstants() const
GBRForestsAndConstants(edm::ParameterSet const &)
edm::ESGetToken< JetCorrectorParametersCollection, JetCorrectionsRecord > parameters_token_
std::string const & jec() const
const int & idFlag() const
const float & mva() const
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > input_vm_pujetid_token_
bool produceJetIds() const
double phi() const final
momentum azimuthal angle
std::unique_ptr< FactorizedJetCorrector > jecCor_
~PileupJetIdProducer() override
double eta() const final
momentum pseudorapidity