37 std::vector<edm::ParameterSet>
algos = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"algos");
40 if( !
runMvas_ ) assert( algos.size() == 1 );
42 if( produceJetIds_ ) {
43 produces<edm::ValueMap<StoredPileupJetIdentifier> > (
"");
45 for(std::vector<edm::ParameterSet>::iterator it=algos.begin(); it!=algos.end(); ++it) {
47 algos_.emplace_back( label, std::make_unique<PileupJetIdAlgo>(*it,
runMvas_));
49 produces<edm::ValueMap<float> > (label+
"Discriminant");
50 produces<edm::ValueMap<int> > (label+
"Id");
97 vector<StoredPileupJetIdentifier> ids;
98 map<string, vector<float> >
mvas;
99 map<string, vector<int> > idflags;
101 VertexCollection::const_iterator
vtx;
104 vtx = vertexes.begin();
105 while( vtx != vertexes.end() && ( vtx->isFake() || vtx->ndof() < 4 ) ) {
108 if( vtx == vertexes.end() ) { vtx = vertexes.begin(); }
113 for (
unsigned int i=0;
i<jets.
size(); ++
i ) {
115 auto algoi =
algos_.begin();
140 jecCor_->setJetPt(jet.
pt());
142 jecCor_->setJetEta(jet.
eta());
143 jecCor_->setJetA(jet.
jetArea());
144 jecCor_->setRho(rho);
145 jec = jecCor_->getCorrection();
160 const reco::Jet * theJet = ( applyJec ? corrJet : &
jet );
166 ids.push_back( puIdentifier );
169 puIdentifier = (*vmap)[jets.
refAt(
i)];
170 puIdentifier.
jetPt(theJet->
pt());
173 ialgo->
set(puIdentifier);
179 mvas[algoi->first].push_back( puIdentifier.
mva() );
180 idflags[algoi->first].push_back( puIdentifier.
idFlag() );
181 for( ++algoi; algoi!=
algos_.end(); ++algoi) {
182 ialgo = algoi->second.get();
183 ialgo->
set(puIdentifier);
185 mvas[algoi->first].push_back(
id.
mva() );
186 idflags[algoi->first].push_back(
id.idFlag() );
191 if( corrJet ) {
delete corrJet; }
196 for(
const auto& ialgo :
algos_) {
198 vector<float> &
mva = mvas[ialgo.first];
199 auto mvaout = std::make_unique<ValueMap<float>>();
201 mvafiller.insert(jetHandle,mva.begin(),mva.end());
203 iEvent.
put(
std::move(mvaout),ialgo.first+
"Discriminant");
206 vector<int> & idflag = idflags[ialgo.first];
207 auto idflagout = std::make_unique<ValueMap<int>>();
209 idflagfiller.insert(jetHandle,idflag.begin(),idflag.end());
216 assert( jetHandle->size() == ids.size() );
217 auto idsout = std::make_unique<ValueMap<StoredPileupJetIdentifier>>();
219 idsfiller.insert(jetHandle,ids.begin(),ids.end());
243 std::vector<std::string> jecLevels;
244 jecLevels.push_back(
"L1FastJet");
245 jecLevels.push_back(
"L2Relative");
246 jecLevels.push_back(
"L3Absolute");
252 for(std::vector<std::string>::const_iterator ll = jecLevels.begin(); ll != jecLevels.end(); ++ll)
T getParameter(std::string const &) const
virtual double pt() const final
transverse momentum
void set(const PileupJetIdentifier &)
std::vector< JetCorrectorParameters > jetCorPars_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
virtual void scaleEnergy(double fScale)
scale energy of the jet
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
virtual double eta() const final
momentum pseudorapidity
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const int & idFlag() const
const float & mva() const
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
edm::EDGetTokenT< edm::View< reco::Jet > > input_jet_token_
std::vector< Vertex > VertexCollection
collection of Vertex objects
const float & jetPt() const
PileupJetIdProducer(const edm::ParameterSet &)
RefToBase< value_type > refAt(size_type i) const
virtual double phi() const final
momentum azimuthal angle
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual CompositePtrCandidate * clone() const
returns a clone of the candidate
void addDefault(ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< double > input_rho_token_
edm::FileInPath residualsTxt_
void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData)
virtual void produce(edm::Event &, const edm::EventSetup &) override
const float & jetPhi() const
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho)
T const * product() const
std::vector< std::pair< std::string, std::unique_ptr< PileupJetIdAlgo > > > algos_
PileupJetIdentifier computeMva()
Analysis-level calorimeter jet class.
virtual float jetArea() const
get jet area
edm::EDGetTokenT< edm::ValueMap< StoredPileupJetIdentifier > > input_vm_pujetid_token_
const_reference at(size_type pos) const
std::string fullPath() const
Jet correctedJet(const std::string &level, const std::string &flavor="none", const std::string &set="") const
std::unique_ptr< FactorizedJetCorrector > jecCor_
const float & jetEta() const