39 std::vector<std::pair<std::string, MVAJetPuId *> >
algos_;
67 std::vector<edm::ParameterSet> algos = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"algos");
73 if( produceJetIds_ ) {
74 produces<edm::ValueMap<StoredPileupJetIdentifier> > (
"");
76 for(std::vector<edm::ParameterSet>::iterator it=algos.begin(); it!=algos.end(); ++it) {
80 produces<edm::ValueMap<float> > (label+
"Discriminant");
81 produces<edm::ValueMap<int> > (label+
"Id");
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];
186 mvafiller.insert(jetHandle,mva.begin(),mva.end());
188 iEvent.
put(mvaout,ialgo->first+
"Discriminant");
190 vector<int> & idflag = idflags[ialgo->first];
193 idflagfiller.insert(jetHandle,idflag.begin(),idflag.end());
195 iEvent.
put(idflagout,ialgo->first+
"Id");
199 assert( jetHandle->size() == ids.size() );
202 idsfiller.insert(jetHandle,ids.begin(),ids.end());
213 desc.
add<
bool>(
"runMvas",
true);
214 desc.
add<
bool>(
"inputIsCorrected",
true);
216 desc.
add<
bool>(
"produceJetIds",
true);
218 desc.
add<
bool>(
"residualsFromTxt",
false);
219 desc.
add<
bool>(
"applyJec",
false);
224 vpsd1.
add<std::vector<std::string>>(
"tmvaVariables", {
243 vpsd1.add<
bool>(
"cutBased",
false);
244 vpsd1.add<
std::string>(
"tmvaWeights",
"RecoJets/JetProducers/data/MVAJetPuID.weights.xml.gz");
245 vpsd1.add<std::vector<std::string>>(
"tmvaSpectators", {
250 vpsd1.add<
int>(
"version", -1);
253 psd0.
add<std::vector<double>>(
"Pt2030_Tight", {
259 psd0.
add<std::vector<double>>(
"Pt2030_Loose", {
265 psd0.
add<std::vector<double>>(
"Pt3050_Medium", {
271 psd0.
add<std::vector<double>>(
"Pt1020_Tight", {
277 psd0.
add<std::vector<double>>(
"Pt2030_Medium", {
283 psd0.
add<std::vector<double>>(
"Pt010_Tight", {
289 psd0.
add<std::vector<double>>(
"Pt1020_Loose", {
295 psd0.
add<std::vector<double>>(
"Pt010_Medium", {
301 psd0.
add<std::vector<double>>(
"Pt1020_Medium", {
307 psd0.
add<std::vector<double>>(
"Pt010_Loose", {
313 psd0.
add<std::vector<double>>(
"Pt3050_Loose", {
319 psd0.
add<std::vector<double>>(
"Pt3050_Tight", {
327 vpsd1.
add<
double>(
"impactParTkThreshold", 1.0);
328 std::vector<edm::ParameterSet> temp1;
331 desc.
addVPSet(
"algos", vpsd1, temp1);
333 descriptions.
add(
"MVAJetPuIdProducer", desc);
T getParameter(std::string const &) const
void initJetEnergyCorrector(const edm::EventSetup &iSetup, bool isData)
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
virtual void scaleEnergy(double fScale)
scale energy of the jet
FactorizedJetCorrector * jecCor_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Base class for all types of Jets.
std::vector< Vertex > VertexCollection
collection of Vertex objects
const float & jetPt() const
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
edm::FileInPath residualsTxt_
void setJetEta(float fEta)
virtual CompositePtrCandidate * clone() const
returns a clone of the candidate
MVAJetPuIdProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
PileupJetIdentifier computeIdVariables(const reco::Jet *jet, float jec, const reco::Vertex *, const reco::VertexCollection &, double rho, bool calculateMva=false)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< JetCorrectorParameters > jetCorPars_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< edm::View< reco::Jet > > input_jet_token_
const float & jetPhi() const
std::vector< std::pair< std::string, MVAJetPuId * > > algos_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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_
virtual double phi() const
momentum azimuthal angle
edm::EDGetTokenT< reco::VertexCollection > input_vertex_token_
const float & jetEta() const