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

MET uncertainty tool backporting in 74X (ONLY if miniAOD reprocessing is done with 74X) #10443

Merged
merged 36 commits into from Sep 8, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
98ce00a
Fixing the few conflicts appeared during the development
Apr 9, 2015
ff288b7
First commit of multiplicity based corrections
schoef May 24, 2014
c791563
modification of MET std correction modules and XY correction module
schoef Feb 27, 2015
a4ee308
modification of MET std correction modules and XY correction module, …
May 13, 2015
dee9a41
modification of MET std correction modules and XY correction module, …
May 13, 2015
a113162
finish first migration
May 13, 2015
52e5abc
new MET uncertainty tool, part 2
May 13, 2015
966ff1c
change of pat::MET format
May 13, 2015
baa83b6
first working version, cleaning not yet done
May 13, 2015
55c6e86
last modifications, check for 74X compatibility, cleaning
May 16, 2015
d99b026
cleaning
May 16, 2015
78fb71b
fixed JetMETCorrections/Type1MET/test/testMultShiftMETcorrInputProduc…
schoef May 17, 2015
e329f57
fix pfmet correction test, removed unphysical T0T2 MET flavors
May 18, 2015
72ed072
fix corrMET_pfMet_cfg test
May 19, 2015
03d6097
added warning for negative JEC correction potentially noticed in the …
May 20, 2015
745d210
update MET correction tool: PhotonES, automatic function, preparatino…
Jul 15, 2015
368eadd
cleaning + jet cleansing set to electrons/muons only
Jul 15, 2015
2f6bbd4
move to CHS T1 at the RECO level
Jul 15, 2015
b10f787
update the MET XY correction and met reprocessing example
Jul 16, 2015
a7710b5
set the automatic switch of JECs for MC and data, tags can still be s…
Jul 16, 2015
76170c1
add GenMETExtractor for MET reprocessing in miniAOD
Jul 22, 2015
5f831ae
fix data switch and CHS handling
Jul 24, 2015
61d4745
fix reco MET type1 JES correctors
Aug 3, 2015
d3537c4
update postfix and residuals uncertainties
Aug 12, 2015
fee1929
Added Alexx Summer15_50nsV2_DATA .db file from Aug. 9th
schoef Aug 10, 2015
5428d62
adding L2L3Residual level in PhysicsTools/PatAlgos/plugins/JetCorrFac…
schoef Aug 10, 2015
ab3ead6
update JEC and uncertainties
Aug 14, 2015
18cc144
move to 25ns XY MET corrections
Aug 14, 2015
f430ddf
fix typo
Aug 14, 2015
3f3ea1b
fix miniAOD validation for MET
Jul 2, 2015
39b73b7
fix MET DQM
Aug 19, 2015
bc088da
fix MET DQM...
Aug 19, 2015
dc647ec
fix small late user-case typos
Aug 19, 2015
ea12470
fix nultithread producers and class version
Aug 27, 2015
045042a
fix thread safety, and condition reading from DB
Aug 28, 2015
f9a4e24
last fix on the XY shift correcton producer
Aug 28, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion Configuration/StandardSequences/python/Validation_cff.py
Expand Up @@ -18,6 +18,7 @@

from Validation.RecoMET.METRelValForDQM_cff import *
from Validation.RecoJets.JetValidation_cff import *
from JetMETCorrections.Type1MET.pfMETCorrectionType0_cfi import *
from Validation.TrackingMCTruth.trackingTruthValidation_cfi import *
from Validation.RecoTrack.TrackValidation_cff import *
from Validation.RecoMuon.muonValidation_cff import *
Expand All @@ -31,7 +32,7 @@
prevalidation = cms.Sequence( globalPrevalidation * hltassociation * metPreValidSeq * jetPreValidSeq )
prevalidationLiteTracking = cms.Sequence( prevalidation )
prevalidationLiteTracking.replace(globalPrevalidation,globalPrevalidationLiteTracking)
prevalidationMiniAOD = cms.Sequence( genParticles1 * miniAODValidationSequence * JetValidationMiniAOD )
prevalidationMiniAOD = cms.Sequence( genParticles1 * miniAODValidationSequence * JetValidationMiniAOD * type0PFMEtCorrectionPFCandToVertexAssociationForValidationMiniAOD )


validation = cms.Sequence(cms.SequencePlaceholder("mix")
Expand Down
3 changes: 2 additions & 1 deletion DQMOffline/JetMET/python/jetMETDQMOfflineSourceMC_cff.py
Expand Up @@ -70,7 +70,8 @@
from JetMETCorrections.Type1MET.correctionTermsPfMetType0PFCandidate_cff import *
from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import corrPfMetType1

dqmCorrPfMetType1=corrPfMetType1.clone(jetCorrLabel = cms.InputTag('dqmAk4PFL1FastL2L3Corrector'))
dqmCorrPfMetType1=corrPfMetType1.clone(jetCorrLabel = cms.InputTag('dqmAk4PFCHSL1FastL2L3Corrector'),
jetCorrLabelRes = cms.InputTag('dqmAk4PFCHSL1FastL2L3Corrector')) #residuals not used for simulation anyway
pfMETT1=pfMetT1.clone(srcCorrections = cms.VInputTag(
cms.InputTag('dqmCorrPfMetType1', 'type1')
))
Expand Down
13 changes: 10 additions & 3 deletions DQMOffline/JetMET/python/jetMETDQMOfflineSource_cff.py
Expand Up @@ -45,7 +45,13 @@
dqmAk4CaloL2L3ResidualCorrector
)

from JetMETCorrections.Configuration.JetCorrectors_cff import ak4PFL1FastL2L3ResidualCorrectorChain,ak4PFL1FastL2L3ResidualCorrector,ak4PFResidualCorrector,ak4PFL3AbsoluteCorrector,ak4PFL2RelativeCorrector,ak4PFL1FastjetCorrector
from JetMETCorrections.Configuration.JetCorrectors_cff import ak4PFL1FastL2L3ResidualCorrectorChain,ak4PFL1FastL2L3ResidualCorrector,ak4PFCHSL1FastL2L3Corrector,ak4PFResidualCorrector,ak4PFL3AbsoluteCorrector,ak4PFL2RelativeCorrector,ak4PFL1FastjetCorrector

dqmAk4PFCHSL1FastL2L3Corrector = ak4PFCHSL1FastL2L3Corrector.clone()
dqmAk4PFCHSL1FastL2L3CorrectorChain = cms.Sequence(
#ak4CaloL2RelativeCorrector*ak4CaloL3AbsoluteCorrector*ak4CaloResidualCorrector*
dqmAk4PFCHSL1FastL2L3Corrector
)

dqmAk4PFL1FastL2L3ResidualCorrector = ak4PFL1FastL2L3ResidualCorrector.clone()
dqmAk4PFL1FastL2L3ResidualCorrectorChain = cms.Sequence(
Expand All @@ -69,7 +75,8 @@
from JetMETCorrections.Type1MET.correctionTermsPfMetType0PFCandidate_cff import *
from JetMETCorrections.Type1MET.correctionTermsPfMetType1Type2_cff import corrPfMetType1

dqmCorrPfMetType1=corrPfMetType1.clone(jetCorrLabel = cms.InputTag('dqmAk4PFL1FastL2L3ResidualCorrector'))
dqmCorrPfMetType1=corrPfMetType1.clone(jetCorrLabel = cms.InputTag('dqmAk4PFCHSL1FastL2L3Corrector'),
jetCorrLabelRes = cms.InputTag('dqmAk4PFCHSL1FastL2L3ResidualCorrector'))
pfMETT1=pfMetT1.clone(srcCorrections = cms.VInputTag(
cms.InputTag('dqmCorrPfMetType1', 'type1')
))
Expand All @@ -79,7 +86,7 @@
pileupJetIdCalculatorDQM*pileupJetIdEvaluatorDQM*
jetPreDQMSeq*
dqmAk4CaloL2L3ResidualCorrectorChain*dqmAk4PFL1FastL2L3ResidualCorrectorChain*dqmAk4PFCHSL1FastL2L3ResidualCorrectorChain*
dqmCorrPfMetType1*pfMETT1*
dqmAk4PFCHSL1FastL2L3CorrectorChain*dqmCorrPfMetType1*pfMETT1*
jetDQMAnalyzerSequence*METDQMAnalyzerSequence)
jetMETDQMOfflineSourceMiniAOD = cms.Sequence(goodOfflinePrimaryVerticesDQMforMiniAOD*jetDQMAnalyzerSequenceMiniAOD*METDQMAnalyzerSequenceMiniAOD)

94 changes: 78 additions & 16 deletions DataFormats/PatCandidates/interface/MET.h
Expand Up @@ -54,6 +54,8 @@ namespace pat {
MET(const edm::Ptr<reco::MET> & aMETRef);
/// copy constructor
MET( MET const&);
/// cosntructor for corrected METs (keeping specific informations from src MET)
MET(const reco::MET & corMET, const MET& srcMET );
/// destructor
virtual ~MET();

Expand All @@ -68,6 +70,13 @@ namespace pat {
/// set the associated GenMET
void setGenMET(const reco::GenMET & gm);

// ----- MET significance functions ----
// set the MET Significance
void setMETSignificance(const double& metSig);
// get the MET significance
double metSignificance() const;


// ---- methods for uncorrected MET ----
float uncorrectedPt() const;
float uncorrectedPhi() const;
Expand Down Expand Up @@ -105,7 +114,7 @@ namespace pat {
/// Returns the event electromagnetic energy extracted from HF
double emEtInHF() const {return caloSpecific().EmEtInHF;}
/// Returns the event MET Significance
double metSignificance() const {return caloSpecific().METSignificance;}
double caloMetSignificance() const {return caloSpecific().METSignificance;}
/// Returns the event SET in HF+
double CaloSETInpHF() const {return caloSpecific().CaloSETInpHF;}
/// Returns the event SET in HF-
Expand Down Expand Up @@ -140,28 +149,58 @@ namespace pat {

// ---- members for MET corrections ----
enum METUncertainty {
JetEnUp=0, JetEnDown=1, JetResUp=2, JetResDown=3,
MuonEnUp=4, MuonEnDown=5, ElectronEnUp=6, ElectronEnDown=7, TauEnUp=8,TauEnDown=9,
UnclusteredEnUp=10,UnclusteredEnDown=11, NoShift=12, METUncertaintySize=13
JetResUp=0, JetResDown=1, JetEnUp=2, JetEnDown=3,
MuonEnUp=4, MuonEnDown=5, ElectronEnUp=6, ElectronEnDown=7,
TauEnUp=8, TauEnDown=9, UnclusteredEnUp=10, UnclusteredEnDown=11,
PhotonEnUp=12, PhotonEnDown=13, NoShift=14, METUncertaintySize=15,
JetResUpSmear=16, JetResDownSmear=17, METFullUncertaintySize=18
};
enum METUncertaintyLevel {
Raw=0, Type1=1, Type1p2=2, Calo=3
enum METCorrectionLevel {
Raw=0, Type1=1, Type01=2, TypeXY=3, Type1XY=4, Type01XY=5,
Type1Smear=6, Type01Smear=7, Type1SmearXY=8,
Type01SmearXY=9, RawCalo=10, METCorrectionLevelSize=11
};
enum METCorrectionType {
None=0, T1=1, T0=2, TXY=3, TXYForRaw=4,
TXYForT01=5, TXYForT1Smear=6, TXYForT01Smear=7,
Smear=8, Calo=9, METCorrectionTypeSize=10
};

struct Vector2 {
double px, py;
double pt() const { return hypotf(px,py); }
double phi() const { return std::atan2(py,px); }
};
Vector2 shiftedP2(METUncertainty shift, METUncertaintyLevel level=Type1) const ;
Vector shiftedP3(METUncertainty shift, METUncertaintyLevel level=Type1) const ;
LorentzVector shiftedP4(METUncertainty shift, METUncertaintyLevel level=Type1) const ;
double shiftedPx(METUncertainty shift, METUncertaintyLevel level=Type1) const { return shiftedP2(shift,level).px; }
double shiftedPy(METUncertainty shift, METUncertaintyLevel level=Type1) const { return shiftedP2(shift,level).py; }
double shiftedPt(METUncertainty shift, METUncertaintyLevel level=Type1) const { return shiftedP2(shift,level).pt(); }
double shiftedPhi(METUncertainty shift, METUncertaintyLevel level=Type1) const { return shiftedP2(shift,level).phi(); }
double shiftedSumEt(METUncertainty shift, METUncertaintyLevel level=Type1) const ;

void setShift(double px, double py, double sumEt, METUncertainty shift, METUncertaintyLevel level=Type1) ;
Vector2 shiftedP2(METUncertainty shift, METCorrectionLevel level=Type1) const ;
Vector shiftedP3(METUncertainty shift, METCorrectionLevel level=Type1) const ;
LorentzVector shiftedP4(METUncertainty shift, METCorrectionLevel level=Type1) const ;
double shiftedPx(METUncertainty shift, METCorrectionLevel level=Type1) const { return shiftedP2(shift,level).px; };
double shiftedPy(METUncertainty shift, METCorrectionLevel level=Type1) const { return shiftedP2(shift,level).py; };
double shiftedPt(METUncertainty shift, METCorrectionLevel level=Type1) const { return shiftedP2(shift,level).pt(); };
double shiftedPhi(METUncertainty shift, METCorrectionLevel level=Type1) const { return shiftedP2(shift,level).phi(); };
double shiftedSumEt(METUncertainty shift, METCorrectionLevel level=Type1) const ;

Vector2 corP2(METCorrectionLevel level=Type1) const ;
Vector corP3(METCorrectionLevel level=Type1) const ;
LorentzVector corP4(METCorrectionLevel level=Type1) const ;
double corPx(METCorrectionLevel level=Type1) const { return corP2(level).px; };
double corPy(METCorrectionLevel level=Type1) const { return corP2(level).py; };
double corPt(METCorrectionLevel level=Type1) const { return corP2(level).pt(); };
double corPhi(METCorrectionLevel level=Type1) const { return corP2(level).phi(); };
double corSumEt(METCorrectionLevel level=Type1) const ;

Vector2 uncorP2() const;
Vector uncorP3() const ;
LorentzVector uncorP4() const ;
double uncorPx() const { return uncorP2().px; };
double uncorPy() const { return uncorP2().py; };
double uncorPt() const { return uncorP2().pt(); };
double uncorPhi() const { return uncorP2().phi(); };
double uncorSumEt() const;

void setUncShift(double px, double py, double sumEt, METUncertainty shift, bool isSmeared=false);
void setCorShift(double px, double py, double sumEt, METCorrectionType level);

// specific method to fill and retrieve the caloMET quickly from miniAODs,
//should be used by JetMET experts only for the beginning
Expand All @@ -172,6 +211,14 @@ namespace pat {
double caloMETPhi() const;
double caloMETSumEt() const;

//Functions for backward compatibility with 74X samples.
// allow access to 74X samples, transparent and not used in 75
Vector2 shiftedP2_74x(METUncertainty shift, METCorrectionLevel level) const ;
Vector shiftedP3_74x(METUncertainty shift, METCorrectionLevel level) const ;
LorentzVector shiftedP4_74x(METUncertainty shift, METCorrectionLevel level) const ;
double shiftedSumEt_74x(METUncertainty shift, METCorrectionLevel level) const ;


/// this below should be private but Reflex doesn't like it
class PackedMETUncertainty {
// defined as C++ class so that I can change the packing without having to touch the code elsewhere
Expand All @@ -183,6 +230,7 @@ namespace pat {
double dpy() const { if(!unpacked_) unpack(); return dpy_; }
double dsumEt() const { if(!unpacked_) unpack(); return dsumEt_; }
void set(float dpx, float dpy, float dsumEt) { dpx_ = dpx; dpy_ = dpy; dsumEt_ = dsumEt; pack(); unpack();}
void add(float dpx, float dpy, float dsumEt) { dpx_ += dpx; dpy_ += dpy; dsumEt_ += dsumEt; }
void unpack() const ;
void pack();

Expand All @@ -200,11 +248,25 @@ namespace pat {
// ---- holder for pfMET specific info ---
std::vector<SpecificPFMETData> pfMET_;

// MET significance
double metSig_;

const PackedMETUncertainty findMETTotalShift(MET::METCorrectionLevel cor, MET::METUncertainty shift) const;

std::map<MET::METCorrectionLevel, std::vector<MET::METCorrectionType> > corMap_;
void initCorMap();



protected:

// ---- non-public correction utilities ----
//kept for 74X backward-compatibility, not initialized and used in 75X
std::vector<PackedMETUncertainty> uncertaintiesRaw_, uncertaintiesType1_, uncertaintiesType1p2_;


std::vector<PackedMETUncertainty> uncertainties_;
std::vector<PackedMETUncertainty> corrections_;

PackedMETUncertainty caloPackedMet_;

};
Expand Down