Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of MvaMET code and tools for miniAOD, cleaning of RecoMET/METPUSubtraction package #7085

Merged
merged 10 commits into from Jan 17, 2015
62 changes: 0 additions & 62 deletions DataFormats/METReco/interface/MVAMEtData.h

This file was deleted.

15 changes: 0 additions & 15 deletions DataFormats/METReco/interface/MVAMEtDataFwd.h

This file was deleted.

92 changes: 92 additions & 0 deletions DataFormats/METReco/interface/PUSubMETData.h
@@ -0,0 +1,92 @@
#ifndef DataFormats_METReco_PUSubMETData_h
#define DataFormats_METReco_PUSubMETData_h

/** \class MVAMEtData.h
*
* Storage of PFCandidate and PFJet id. information used in MVA MET calculation.
*
* \authors Phil Harris, CERN
* Christian Veelken, LLR
*
*
*
*/

#include "DataFormats/Candidate/interface/Candidate.h"

#include "DataFormats/METReco/interface/SigInputObj.h"

namespace reco
{

class PUSubMETCandInfo {

//functions
public:

PUSubMETCandInfo();
~PUSubMETCandInfo();

bool operator<(const reco::PUSubMETCandInfo&) const;


//Access functions ================
const reco::Candidate::LorentzVector& p4() const {return p4_;};
const float dZ() const {return dZ_;};

int type() const {return type_;};
int charge() const {return charge_;};

//Jet specific
bool isWithinJet() const {return isWithinJet_;};
float passesLooseJetId() const {return passesLooseJetId_;};
float offsetEnCorr() const {return offsetEnCorr_;};
float mva() const {return mva_;};
float chargedEnFrac() const {return chargedEnFrac_;};

const metsig::SigInputObj& metSignObj() const {return pfMEtSignObj_;};

//setting functions ================
void setP4( const reco::Candidate::LorentzVector p4 ) {p4_ = p4;};
void setDZ(float dZ) {dZ_ = dZ;};

void setType(int type) {type_ = type;};
void setCharge(int charge) {charge_ = charge;};

//Jet specific
void setIsWithinJet(bool isWJ) {isWithinJet_ = isWJ;};
void setPassesLooseJetId(float jetId) {passesLooseJetId_ = jetId;};
void setOffsetEnCorr(float offset) {offsetEnCorr_ = offset;};
void setMvaVal(float mva) {mva_ = mva;};
void setChargedEnFrac(float chEnF) {chargedEnFrac_ = chEnF;};

void setMEtSignObj(metsig::SigInputObj msig) {pfMEtSignObj_ = msig;};

//variables =================
public:

enum { kUndefined=0, kHS, kChHS, kPU, kChPU, kNeutral };

private:

reco::Candidate::LorentzVector p4_;
float dZ_;

int type_;
int charge_;

//Jet specific
bool isWithinJet_;
float passesLooseJetId_;
float offsetEnCorr_;
float mva_;
float chargedEnFrac_;

metsig::SigInputObj pfMEtSignObj_; // contribution of this PFJet to PFMET significance matrix


};

}

#endif
13 changes: 13 additions & 0 deletions DataFormats/METReco/interface/PUSubMETDataFwd.h
@@ -0,0 +1,13 @@
#ifndef DataFormats_METReco_PUSubMETDataFwd_h
#define DataFormats_METReco_PUSubMETDataFwd_h

#include "DataFormats/METReco/interface/PUSubMETData.h"

#include <vector>

namespace reco
{
typedef std::vector<reco::PUSubMETCandInfo> PUSubMETCandInfoCollection;
}

#endif
9 changes: 0 additions & 9 deletions DataFormats/METReco/src/MVAMEtData.cc

This file was deleted.

31 changes: 31 additions & 0 deletions DataFormats/METReco/src/PUSubMETData.cc
@@ -0,0 +1,31 @@
#include "DataFormats/METReco/interface/PUSubMETData.h"

namespace reco {

PUSubMETCandInfo::PUSubMETCandInfo() {

p4_.SetXYZT(0.,0.,0.,0.);
dZ_ = 0.;
type_ = PUSubMETCandInfo::kUndefined;
charge_ = 0;
isWithinJet_ = false;
passesLooseJetId_ = 0.;
offsetEnCorr_ = 0.;
mva_ = 0.;
chargedEnFrac_ = 0.;

}


PUSubMETCandInfo::~PUSubMETCandInfo() {

}


bool PUSubMETCandInfo::operator<(const reco::PUSubMETCandInfo& jet2) const {
return p4_.pt() < jet2.p4().pt();
}


}

16 changes: 6 additions & 10 deletions DataFormats/METReco/src/classes.h
Expand Up @@ -13,7 +13,9 @@
#include "DataFormats/METReco/interface/PFMET.h"
#include "DataFormats/METReco/interface/PFMETFwd.h"
#include "DataFormats/METReco/interface/PFClusterMET.h"
#include "DataFormats/METReco/interface/PFClusterMETFwd.h"
#include "DataFormats/METReco/interface/PFClusterMETFwd.h"
#include "DataFormats/METReco/interface/PUSubMETData.h"
#include "DataFormats/METReco/interface/PUSubMETDataFwd.h"
#include "DataFormats/METReco/interface/GenMET.h"
#include "DataFormats/METReco/interface/GenMETFwd.h"
#include "DataFormats/METReco/interface/CommonMETData.h"
Expand All @@ -32,8 +34,6 @@
#include "DataFormats/METReco/interface/BeamHaloSummary.h"
#include "DataFormats/METReco/interface/CorrMETData.h"
#include "DataFormats/METReco/interface/SigInputObj.h"
#include "DataFormats/METReco/interface/MVAMEtData.h"
#include "DataFormats/METReco/interface/MVAMEtDataFwd.h"
#include "DataFormats/METReco/interface/AnomalousECALVariables.h"
#include "DataFormats/METReco/interface/BoundaryInformation.h"

Expand Down Expand Up @@ -156,13 +156,9 @@ namespace DataFormats_METReco {
std::vector<metsig::SigInputObj> dummy63;
edm::Wrapper<std::vector<metsig::SigInputObj> > dummy64;

reco::MVAMEtJetInfo dummyMVAMEtJetInfo;
reco::MVAMEtJetInfoCollection dummyMVAMEtJetInfoCollection;
edm::Wrapper<reco::MVAMEtJetInfoCollection> dummyMVAMEtJetInfoCollectionWrapped;

reco::MVAMEtPFCandInfo dummyMVAMEtPFCandInfo;
reco::MVAMEtPFCandInfoCollection dummyMVAMEtPFCandInfoCollection;
edm::Wrapper<reco::MVAMEtPFCandInfoCollection> dummyMVAMEtPFCandInfoCollectionWrapped;
reco::PUSubMETCandInfo dummyPUSubMETCandInfo;
reco::PUSubMETCandInfoCollection dummyPUSubMETCandInfoCollection;
edm::Wrapper<reco::PUSubMETCandInfoCollection> dummyPUSubMETCandInfoCollectionWrapped;

AnomalousECALVariables dummyBE20;
edm::Wrapper<AnomalousECALVariables> dummyBE21;
Expand Down
21 changes: 5 additions & 16 deletions DataFormats/METReco/src/classes_def.xml
Expand Up @@ -24,23 +24,12 @@
<class name="std::vector<metsig::SigInputObj>"/>
<class name="edm::Wrapper<std::vector<metsig::SigInputObj> >"/>

<class name="reco::MVAMEtJetInfo" ClassVersion="13">
<version ClassVersion="10" checksum="695030979"/>
<version ClassVersion="11" checksum="2096949665"/>
<version ClassVersion="12" checksum="774362219"/>
<version ClassVersion="13" checksum="619222758"/>
<class name="reco::PUSubMETCandInfo" ClassVersion="3">
<version ClassVersion="3" checksum="4117401603"/>
</class>
<class name="reco::MVAMEtJetInfoCollection" />
<class name="edm::Wrapper<reco::MVAMEtJetInfoCollection>" />

<class name="reco::MVAMEtPFCandInfo" ClassVersion="12">
<version ClassVersion="10" checksum="2500257969"/>
<version ClassVersion="11" checksum="1494751375"/>
<version ClassVersion="12" checksum="1973163836"/>
</class>
<class name="reco::MVAMEtPFCandInfoCollection" />
<class name="edm::Wrapper<reco::MVAMEtPFCandInfoCollection>" />

<class name="reco::PUSubMETCandInfoCollection" />
<class name="edm::Wrapper<reco::PUSubMETCandInfoCollection>" />

<class name="SpecificCaloMETData" ClassVersion="11">
<version ClassVersion="10" checksum="3022746385"/>
<version ClassVersion="11" checksum="747083523"/>
Expand Down
1 change: 1 addition & 0 deletions RecoJets/JetProducers/BuildFile.xml
@@ -1,6 +1,7 @@
<use name="boost"/>
<use name="FWCore/Framework"/>
<use name="DataFormats/JetReco"/>
<use name="DataFormats/PatCandidates"/>
<use name="Geometry/CaloGeometry"/>
<use name="Geometry/CaloTopology"/>
<use name="Geometry/Records"/>
Expand Down
7 changes: 7 additions & 0 deletions RecoJets/JetProducers/interface/PileupJetIdAlgo.h
Expand Up @@ -11,6 +11,8 @@
#include "DataFormats/JetReco/interface/Jet.h"
#include "DataFormats/JetReco/interface/PFJetCollection.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "DataFormats/PatCandidates/interface/Jet.h"
#include "DataFormats/PatCandidates/interface/PackedCandidate.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "TMVA/Tools.h"
Expand All @@ -34,6 +36,11 @@ class PileupJetIdAlgo {
PileupJetIdentifier computeIdVariables(const reco::Jet * jet,
float jec, const reco::Vertex *, const reco::VertexCollection &,
bool calculateMva=false);

PileupJetIdentifier computeIdVariables(const pat::Jet * jet,
const edm::Ptr<reco::Vertex>,
const std::map<edm::Ptr<reco::Vertex>,edm::PtrVector<pat::PackedCandidate> >&,
bool calculateMva);

void set(const PileupJetIdentifier &);
PileupJetIdentifier computeMva();
Expand Down
14 changes: 7 additions & 7 deletions RecoJets/JetProducers/plugins/PileupJetIdProducer.cc
Expand Up @@ -141,10 +141,10 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
jecCor_->setRho(rho);
jec = jecCor_->getCorrection();
}

// If it was requested or the input is an uncorrected jet apply the JEC
bool applyJec = applyJec_ || !inputIsCorrected_; //( ! ispat && ! inputIsCorrected_ );
// If it was requested AND the input is an uncorrected jet apply the JEC
bool applyJec = applyJec_ && !inputIsCorrected_; //( ! ispat && ! inputIsCorrected_ );
reco::Jet * corrJet = 0;

if( applyJec ) {
float scale = jec;
//if( ispat ) {
Expand All @@ -155,14 +155,14 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
corrJet->scaleEnergy(scale);
}
const reco::Jet * theJet = ( applyJec ? corrJet : &jet );

PileupJetIdentifier puIdentifier;
if( produceJetIds_ ) {
// Compute the input variables
// Compute the input variables
puIdentifier = ialgo->computeIdVariables(theJet, jec, &(*vtx), vertexes, runMvas_);
ids.push_back( puIdentifier );
} else {
// Or read it from the value map
// Or read it from the value map
puIdentifier = (*vmap)[jets.refAt(i)];
puIdentifier.jetPt(theJet->pt()); // make sure JEC is applied when computing the MVA
puIdentifier.jetEta(theJet->eta());
Expand All @@ -172,7 +172,7 @@ PileupJetIdProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
}

if( runMvas_ ) {
// Compute the MVA and WP
// Compute the MVA and WP
mvas[algoi->first].push_back( puIdentifier.mva() );
idflags[algoi->first].push_back( puIdentifier.idFlag() );
for( ++algoi; algoi!=algos_.end(); ++algoi) {
Expand Down
4 changes: 2 additions & 2 deletions RecoJets/JetProducers/python/pileupjetidproducer_cfi.py
Expand Up @@ -8,7 +8,7 @@
vertexes = cms.InputTag("offlinePrimaryVertices"),
algos = cms.VPSet(cms.VPSet(cutbased)),

rho = cms.InputTag("kt6PFJets","rho"),
rho = cms.InputTag("fixedGridRhoFastjetAll"),
jec = cms.string("AK4PFchs"),
applyJec = cms.bool(False),
inputIsCorrected = cms.bool(True),
Expand All @@ -24,7 +24,7 @@
vertexes = cms.InputTag("offlinePrimaryVertices"),
algos = cms.VPSet(cms.VPSet(cutbased,full_53x_chs)),

rho = cms.InputTag("kt6PFJets","rho"),
rho = cms.InputTag("fixedGridRhoFastjetAll"),
jec = cms.string("AK4PFchs"),
applyJec = cms.bool(False),
inputIsCorrected = cms.bool(True),
Expand Down