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

Disabling the reclustering in the MET correction and uncertainty tool #11489

Merged
merged 3 commits into from
Oct 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
jetCorrLabel = cms.InputTag("ak4PFCHSL1FastL2L3Corrector"), #for MC
jetCorrLabelRes = cms.InputTag("ak4PFCHSL1FastL2L3ResidualCorrector"), # for data, automatic switch
jetCorrEtaMax = cms.double(9.9),
type1JetPtThreshold = cms.double(10.0),
type1JetPtThreshold = cms.double(15.0),
skipEM = cms.bool(True),
skipEMfractionThreshold = cms.double(0.90),
skipMuons = cms.bool(True),
Expand Down
63 changes: 63 additions & 0 deletions PhysicsTools/PatAlgos/plugins/RecoMETExtractor.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "PhysicsTools/PatAlgos/plugins/RecoMETExtractor.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

#include <memory>

using namespace pat;

RecoMETExtractor::RecoMETExtractor(const edm::ParameterSet& iConfig) {

edm::InputTag metIT = iConfig.getParameter<edm::InputTag>("metSource");
metSrcToken_ = consumes<pat::METCollection>(metIT);

std::string corLevel = iConfig.getParameter<std::string>("correctionLevel");

//all possible met flavors
if(corLevel=="raw") { corLevel_=pat::MET::Raw;}
else if(corLevel=="type1") { corLevel_=pat::MET::Type1;}
else if(corLevel=="type01") { corLevel_=pat::MET::Type01;}
else if(corLevel=="typeXY") { corLevel_=pat::MET::TypeXY;}
else if(corLevel=="type1XY") { corLevel_=pat::MET::Type1XY;}
else if(corLevel=="type01XY") { corLevel_=pat::MET::Type01XY;}
else if(corLevel=="type1Smear") { corLevel_=pat::MET::Type1Smear;}
else if(corLevel=="type01Smear") { corLevel_=pat::MET::Type01Smear;}
else if(corLevel=="type1SmearXY") { corLevel_=pat::MET::Type1SmearXY;}
else if(corLevel=="type01SmearXY") { corLevel_=pat::MET::Type01SmearXY;}
else if(corLevel=="rawCalo") { corLevel_=pat::MET::RawCalo;}
else {
//throw exception

}

// produces vector of recoMet
produces<std::vector<reco::MET> >();
}


RecoMETExtractor::~RecoMETExtractor() {

}


void RecoMETExtractor::produce(edm::StreamID streamID, edm::Event & iEvent,
const edm::EventSetup & iSetup) const {

edm::Handle<std::vector<pat::MET> > src;
iEvent.getByToken(metSrcToken_, src);
if(src->size()==0) edm::LogError("RecoMETExtractor::produce") << "input reco MET collection is empty" ;

std::vector<reco::MET> *metCol = new std::vector<reco::MET>();

reco::MET met(src->front().corP4(corLevel_), src->front().vertex() );
metCol->push_back( met );

std::auto_ptr<std::vector<reco::MET> > recoMETs(metCol);
iEvent.put(recoMETs);
}


#include "FWCore/Framework/interface/MakerMacros.h"

DEFINE_FWK_MODULE(RecoMETExtractor);
47 changes: 47 additions & 0 deletions PhysicsTools/PatAlgos/plugins/RecoMETExtractor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef PhysicsTools_PatAlgos_RecoMETExtractor_h
#define PhysicsTools_PatAlgos_RecoMETExtractor_h

/**
\class pat::RecoMETExtractor RecoMETExtractor.h "PhysicsTools/PatAlgos/interface/RecoMETExtractor.h"
\brief Retrieves the recoMET from a pat::MET

The RecoMETExtractor produces the analysis-level pat::MET starting from
a collection of objects of METType.

\author Matthieu Marionneau
\version $Id: RecoMETExtractor.h,v 1.0 2015/07/22 mmarionn Exp $
*/


#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/PatCandidates/interface/MET.h"
#include "DataFormats/METReco/interface/MET.h"

namespace pat {

class RecoMETExtractor : public edm::global::EDProducer<> {

public:

explicit RecoMETExtractor(const edm::ParameterSet& iConfig);
~RecoMETExtractor();

virtual void produce(edm::StreamID streamID, edm::Event & iEvent,
const edm::EventSetup & iSetup) const;

private:

edm::EDGetTokenT<std::vector<pat::MET> > metSrcToken_;

pat::MET::METCorrectionLevel corLevel_;

};

}

#endif
2 changes: 1 addition & 1 deletion PhysicsTools/PatAlgos/python/slimming/miniAOD_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def miniAOD_customizeCommon(process):
)
runMetCorAndUncForMiniAODProduction(process,
pfCandColl=cms.InputTag("noHFCands"),
recomputeMET=True, #needed for HF removal
recoMetFromPFCs=True, #needed for HF removal
postfix="NoHF"
)
process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
Expand Down
12 changes: 8 additions & 4 deletions PhysicsTools/PatAlgos/test/corMETFromMiniAOD.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@

# How many events to process
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(100)
input = cms.untracked.int32(1000)
)

#configurable options =======================================================================
runOnOld74XMAOD=True #to be set to True for 74X X<12 miniAODs, False otherwise
runOnData=False #data/MC switch
usePrivateSQlite=True #use external JECs (sqlite file)
usePrivateSQlite=False #use external JECs (sqlite file)
useHFCandidates=False #create an additionnal NoHF slimmed MET collection if the option is set to false
applyResiduals=True #application of residual corrections. Have to be set to True once the 13 TeV residual corrections are available. False to be kept meanwhile. Can be kept to False later for private tests or for analysis checks and developments (not the official recommendation!).
applyResiduals=False #application of residual corrections. Have to be set to True once the 13 TeV residual corrections are available. False to be kept meanwhile. Can be kept to False later for private tests or for analysis checks and developments (not the official recommendation!).
#===================================================================


Expand All @@ -45,7 +46,7 @@
process.GlobalTag.globaltag = autoCond['run2_data']
#process.GlobalTag.globaltag = '75X_dataRun1_v2' #'74X_dataRun2_Prompt_v1'
else:
#process.GlobalTag.globaltag = 'MCRUN2_74_v9'
# process.GlobalTag.globaltag = 'MCRUN2_74_v9'
process.GlobalTag.globaltag = autoCond['run2_mc']
# process.GlobalTag = GlobaTag(GlobalTag, 'auto:run2_mc', '')

Expand Down Expand Up @@ -111,12 +112,15 @@
#for a full met computation, remove the pfCandColl input
runMetCorAndUncFromMiniAOD(process,
isData=runOnData,
repro74X=runOnOld74XMAOD #only for 74X X<12 miniAODs
)

if not useHFCandidates:
runMetCorAndUncFromMiniAOD(process,
isData=runOnData,
pfCandColl=cms.InputTag("noHFCands"),
repro74X=runOnOld74XMAOD, #only for 74X X<12 miniAODs
recoMetFromPFCs=True, #needed for NoHF
postfix="NoHF"
)

Expand Down
2 changes: 1 addition & 1 deletion PhysicsTools/PatUtils/python/patPFMETCorrections_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
offsetCorrLabel = cms.InputTag("L1FastJet"),
jetCorrLabel = cms.InputTag("L3Absolute"), # for MC
jetCorrLabelRes = cms.InputTag("L2L3Residual"), # for Data automatic switch
type1JetPtThreshold = cms.double(10.0),
type1JetPtThreshold = cms.double(15.0),
type2ResidualCorrLabel = cms.InputTag(""),
type2ResidualCorrEtaMax = cms.double(9.9),
type2ExtraCorrFactor = cms.double(1.),
Expand Down
Loading