115 vector<StoredPileupJetIdentifier> ids;
116 map<string, vector<float> >
mvas;
117 map<string, vector<int> > idflags;
119 VertexCollection::const_iterator
vtx;
121 vtx = vertexes.begin();
122 while( vtx != vertexes.end() && ( vtx->isFake() || vtx->ndof() < 4 ) ) {
125 if( vtx == vertexes.end() ) { vtx = vertexes.begin(); }
128 for (
unsigned int i=0;
i<jets.
size(); ++
i ) {
129 vector<pair<string,MVAJetPuId *> >::iterator algoi =
algos_.begin();
154 const reco::Jet * theJet = ( applyJec ? corrJet : &
jet );
158 ids.push_back( puIdentifier );
160 puIdentifier = (*vmap)[jets.
refAt(
i)];
161 puIdentifier.
jetPt(theJet->
pt());
164 ialgo->
set(puIdentifier);
169 for( ; algoi!=
algos_.end(); ++algoi) {
170 ialgo = algoi->second;
171 ialgo->
set(puIdentifier);
173 mvas[algoi->first].push_back(
id.
mva() );
174 idflags[algoi->first].push_back(
id.idFlag() );
178 if( corrJet ) {
delete corrJet; }
182 for(vector<pair<string,MVAJetPuId *> >::iterator ialgo =
algos_.begin(); ialgo!=
algos_.end(); ++ialgo) {
183 vector<float> &
mva = mvas[ialgo->first];
184 auto mvaout = std::make_unique<ValueMap<float>>();
186 mvafiller.insert(jetHandle,mva.begin(),mva.end());
188 iEvent.
put(
std::move(mvaout),ialgo->first+
"Discriminant");
190 vector<int> & idflag = idflags[ialgo->first];
191 auto idflagout = std::make_unique<ValueMap<int>>();
193 idflagfiller.insert(jetHandle,idflag.begin(),idflag.end());
199 assert( jetHandle->size() == ids.size() );
200 auto idsout = std::make_unique<ValueMap<StoredPileupJetIdentifier>>();
202 idsfiller.insert(jetHandle,ids.begin(),ids.end());
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double eta() const final
momentum pseudorapidity
virtual void scaleEnergy(double fScale)
scale energy of the jet
FactorizedJetCorrector * jecCor_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Base class for all types of Jets.
double pt() const final
transverse momentum
std::vector< Vertex > VertexCollection
collection of Vertex objects
const float & jetPt() const
void setJetEta(float fEta)
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 calculateMva=false)
edm::EDGetTokenT< edm::View< reco::Jet > > input_jet_token_
const float & jetPhi() const
T const * product() const
std::vector< std::pair< std::string, MVAJetPuId * > > algos_
CompositePtrCandidate * clone() const override
returns a clone of the candidate
void set(const PileupJetIdentifier &)
virtual float jetArea() const
get jet area
PileupJetIdentifier computeMva()
edm::EDGetTokenT< double > input_rho_token_
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > input_vm_pujetid_token_
double phi() const final
momentum azimuthal angle
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
const float & jetEta() const