90 vector<StoredPileupJetIdentifier>
ids;
91 map<string, vector<float>> mvas;
92 map<string, vector<int>> idflags;
95 VertexCollection::const_iterator
vtx;
101 vertexes = vertexHandle.
product();
104 vtx = vertexes->begin();
105 while (vtx != vertexes->end() && (vtx->isFake() || vtx->ndof() < 4)) {
108 if (vtx == vertexes->end()) {
109 vtx = vertexes->begin();
115 for (
unsigned int i = 0;
i < jets.
size(); ++
i) {
117 auto algoi =
algos_.begin();
124 ispat = patjet !=
nullptr;
142 jecCor_->setJetPt(jet.
pt());
144 jecCor_->setJetEta(jet.
eta());
145 jecCor_->setJetA(jet.
jetArea());
146 jecCor_->setRho(rho);
147 jec = jecCor_->getCorrection();
151 std::unique_ptr<reco::Jet> corrJet;
158 corrJet.reset(dynamic_cast<reco::Jet*>(jet.
clone()));
160 corrJet->scaleEnergy(scale);
162 const reco::Jet* theJet = (applyJec ? corrJet.get() : &
jet);
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());
202 iEvent.
put(
std::move(mvaout), ialgo.first +
"Discriminant");
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());
void set(const PileupJetIdentifier &)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double eta() const final
momentum pseudorapidity
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const int & idFlag() const
const float & mva() const
Base class for all types of Jets.
edm::EDGetTokenT< edm::View< reco::Jet > > input_jet_token_
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
const float & jetPt() const
RefToBase< value_type > refAt(size_type i) const
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool usePuppi)
bool inputIsCorrected() const
edm::EDGetTokenT< double > input_rho_token_
void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData)
const float & jetPhi() const
bool produceJetIds() const
T const * product() const
std::vector< std::pair< std::string, std::unique_ptr< PileupJetIdAlgo > > > algos_
PileupJetIdentifier computeMva()
Analysis-level calorimeter jet class.
CompositePtrCandidate * clone() const override
returns a clone of the candidate
virtual float jetArea() const
get jet area
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > input_vm_pujetid_token_
const_reference at(size_type pos) const
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
double phi() const final
momentum azimuthal angle
std::unique_ptr< FactorizedJetCorrector > jecCor_
const float & jetEta() const