-
Notifications
You must be signed in to change notification settings - Fork 33
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
Izisopou patch miniaod #29
base: master
Are you sure you want to change the base?
Changes from 17 commits
8498413
2c2decb
5588ac5
2fd6c93
77d7747
345364f
f9c3488
650984b
8edaf1c
19a622a
a60f42d
b9712c6
dbf79af
a80a146
34aebad
e1fb630
28e40e4
95ad4db
c30dca5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,14 +25,14 @@ | |
JetResponseParameters = cms.PSet( | ||
# record flavor information, consider both RefPt and JetPt | ||
doComposition = cms.bool(True), | ||
doFlavor = cms.bool(True), | ||
doFlavor = cms.bool(False), | ||
doRefPt = cms.bool(True), | ||
doJetPt = cms.bool(True), | ||
saveCandidates = cms.bool(False), | ||
# MATCHING MODE: deltaR(ref,jet) | ||
deltaRMax = cms.double(0.25), | ||
deltaRMax = cms.double(0.4), | ||
# deltaR(ref,parton) IF doFlavor is True | ||
deltaRPartonMax = cms.double(0.25), | ||
deltaRPartonMax = cms.double(0.4), | ||
# consider all matched references | ||
nRefMax = cms.uint32(0), | ||
# is the sample an HLT sample | ||
|
@@ -76,7 +76,7 @@ | |
dobalance = cms.bool(False), | ||
doflavor = cms.bool(False), | ||
noabsflavors = cms.bool(False), | ||
drmax = cms.double(0.3), | ||
drmax = cms.double(0.4), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would imagine this should match the value in the |
||
dphimin = cms.double(2.7), | ||
dojetpt = cms.bool(False), | ||
dorefpt = cms.bool(True), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
################################################################################ | ||
|
||
partons = cms.EDProducer('PartonSelector', | ||
src = cms.InputTag('genParticles'), | ||
src = cms.InputTag('packedGenParticles'), | ||
withLeptons = cms.bool(False), | ||
skipFirstN = cms.uint32(0) | ||
) | ||
|
@@ -20,6 +20,9 @@ | |
from JetMETAnalysis.JetAnalyzers.JetCorrection_cff import * | ||
from RecoTauTag.TauTagTools.tauDecayModes_cfi import * | ||
from CommonTools.PileupAlgos.Puppi_cff import * | ||
from JetMETAnalysis.JetAnalyzers.customizePuppiTune_cff import * | ||
|
||
genParticlesForJetsNoNu.src = cms.InputTag("packedGenParticles") | ||
|
||
stdClusteringAlgorithms = ['ak'] #Options: {ak,kt} | ||
stdJetTypes = ['calo','pf','pfchs','puppi'] #Options: {'calo','pf','pfchs','puppi'} | ||
|
@@ -382,7 +385,12 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): | |
sequence = cms.Sequence(recJets * sequence) | ||
if type == 'PUPPI': | ||
process.load('CommonTools.PileupAlgos.Puppi_cff') | ||
process.load('JetMETAnalysis.JetAnalyzers.customizePuppiTune_cff') | ||
#puppi.candName = cms.InputTag("particleFlow") | ||
#80x change | ||
puppiCentral[0].applyLowPUCorr = cms.bool(False) | ||
puppiForward[0].applyLowPUCorr = cms.bool(False) | ||
puppi.vertexName = "offlineSlimmedPrimaryVertices" | ||
sequence = cms.Sequence(puppi * sequence) | ||
if type == 'Track': | ||
process.load('JetMETAnalysis.JetAnalyzers.TrackJetReconstruction_cff') | ||
|
@@ -505,10 +513,10 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): | |
srcRhos = cms.InputTag(''), | ||
srcRho = cms.InputTag(''), | ||
srcRhoHLT = cms.InputTag(''), | ||
srcVtx = cms.InputTag('offlinePrimaryVertices'), | ||
srcVtx = cms.InputTag('offlineSlimmedPrimaryVertices'), | ||
srcJetToUncorJetMap = cms.InputTag(jetToUncorJet.label(), 'rec2gen'), | ||
srcPFCandidates = cms.InputTag(''), | ||
srcGenParticles = cms.InputTag('genParticles') | ||
srcGenParticles = cms.InputTag('packedGenParticles') | ||
) | ||
if doProducer: | ||
jraAnalyzer = 'JetResponseAnalyzerProducer' | ||
|
@@ -519,10 +527,10 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): | |
jecLabel = cms.string(''), | ||
srcRho = cms.InputTag(''), | ||
srcRhoHLT = cms.InputTag(''), | ||
srcVtx = cms.InputTag('offlinePrimaryVertices'), | ||
srcVtx = cms.InputTag('offlineSlimmedPrimaryVertices'), | ||
srcJetToUncorJetMap = cms.InputTag(jetToUncorJet.label(), 'rec2gen'), | ||
srcPFCandidates = cms.InputTag(''), | ||
srcGenParticles = cms.InputTag('genParticles') | ||
srcGenParticles = cms.InputTag('packedGenParticles') | ||
) | ||
|
||
if type == 'CaloHLT': | ||
|
@@ -531,35 +539,38 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): | |
elif type == 'Calo': | ||
jra.srcRho = cms.InputTag("fixedGridRhoFastjetAllCalo") | ||
elif type == 'PFchs': | ||
process.kt6PFchsJetsRhos = kt6PFJets.clone(src = 'pfNoPileUpJME', | ||
process.pfCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV")) | ||
process.kt6PFchsJetsRhos = kt6PFJets.clone(src = 'pfCHS', | ||
doFastJetNonUniform = cms.bool(True), | ||
puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), | ||
puWidth = cms.double(.8), | ||
nExclude = cms.uint32(2)) | ||
sequence = cms.Sequence(process.kt6PFchsJetsRhos * sequence) | ||
sequence = cms.Sequence(process.pfCHS * process.kt6PFchsJetsRhos * sequence) | ||
jra.srcRhos = cms.InputTag("kt6PFchsJetsRhos", "rhos") | ||
jra.srcRho = cms.InputTag("fixedGridRhoFastjetAll") | ||
jra.srcPFCandidates = cms.InputTag('pfNoPileUpJME') | ||
jra.srcPFCandidates = cms.InputTag('pfCHS') | ||
elif type == 'PFHLT': | ||
jra.srcRho = ak4PFL1Fastjet.srcRho #added 02/15/2012 | ||
jra.srcRho = ak4PFL1Fastjet.srcRho | ||
jra.srcRhoHLT = ak5PFHLTL1Fastjet.srcRho | ||
elif type == 'PFchsHLT': | ||
jra.srcRho = ak4PFchsL1Fastjet.srcRho #added 02/15/2012 | ||
jra.srcRho = ak4PFchsL1Fastjet.srcRho | ||
jra.srcRhoHLT = ak5PFchsHLTL1Fastjet.srcRho | ||
elif type == 'PF': | ||
process.particleFlow = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you recreating the particleFlow collection without any cuts? Why not just use the packedPFCandidates directly as inputs on line 583? Same comment for lines 585-589. |
||
process.kt6PFJetsRhos = kt6PFJets.clone(doFastJetNonUniform = cms.bool(True), | ||
puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), | ||
puWidth = cms.double(.8), | ||
nExclude = cms.uint32(2)) | ||
sequence = cms.Sequence(process.kt6PFJetsRhos * sequence) | ||
sequence = cms.Sequence(process.particleFlow * process.kt6PFJetsRhos * sequence) | ||
jra.srcRhos = cms.InputTag("kt6PFJetsRhos", "rhos") | ||
jra.srcRho = cms.InputTag("fixedGridRhoFastjetAll") | ||
jra.srcPFCandidates = cms.InputTag('particleFlow') | ||
jra.srcPFCandidates = cms.InputTag('packedPFCandidates') | ||
elif type == 'PUPPI': | ||
process.particleFlow = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("")) | ||
process.kt6PFJetsRhos = kt6PFJets.clone(doFastJetNonUniform = cms.bool(True), | ||
puCenters = cms.vdouble(-5,-4,-3,-2,-1,0,1,2,3,4,5), | ||
puWidth = cms.double(.8), nExclude = cms.uint32(2)) | ||
sequence = cms.Sequence(process.kt6PFJetsRhos * sequence) | ||
sequence = cms.Sequence(process.particleFlow * process.kt6PFJetsRhos * sequence) | ||
jra.srcRhos = cms.InputTag("kt6PFJetsRhos", "rhos") | ||
jra.srcRho = cms.InputTag("fixedGridRhoFastjetAll") | ||
jra.srcPFCandidates = cms.InputTag('puppi') | ||
|
@@ -574,14 +585,8 @@ def addAlgorithm(process, alg_size_type_corr, Defaults, reco, doProducer): | |
|
||
setattr(process,alg_size_type_corr,jra) | ||
sequence = cms.Sequence(sequence * jra) | ||
|
||
## add chs to path is needed | ||
if type == 'PFchs': | ||
sequence = cms.Sequence(process.pfNoPileUpJMESequence * sequence) | ||
|
||
## create the path and put in the sequence | ||
sequence = cms.Sequence(sequence) | ||
setattr(process, alg_size_type_corr + 'Sequence', sequence) | ||
path = cms.Path( sequence ) | ||
setattr(process, alg_size_type_corr + 'Path', path) | ||
setattr(process, alg_size_type_corr + 'Path', path) | ||
print alg_size_type_corr |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -25,11 +25,11 @@ JetResponseAnalyzer::JetResponseAnalyzer(const edm::ParameterSet& iConfig) | |||
, srcRhoHLT_ (consumes<double>(iConfig.getParameter<edm::InputTag> ("srcRhoHLT"))) | ||||
, srcVtx_ (consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag> ("srcVtx"))) | ||||
, srcGenInfo_ (consumes<GenEventInfoProduct>(edm::InputTag("generator")) ) | ||||
, srcPileupInfo_ (consumes<vector<PileupSummaryInfo> >(edm::InputTag("addPileupInfo")) ) | ||||
, srcPileupInfo_ (consumes<vector<PileupSummaryInfo> >(edm::InputTag("slimmedAddPileupInfo")) ) | ||||
//, srcPFCandidates_ (consumes<vector<reco::PFCandidate> >(iConfig.getParameter<edm::InputTag>("srcPFCandidates"))) | ||||
, srcPFCandidates_ (consumes<PFCandidateView>(iConfig.getParameter<edm::InputTag>("srcPFCandidates"))) | ||||
, srcPFCandidatesAsFwdPtr_(consumes<std::vector<edm::FwdPtr<reco::PFCandidate> > >(iConfig.getParameter<edm::InputTag>("srcPFCandidates"))) | ||||
, srcGenParticles_ (consumes<vector<reco::GenParticle> >(iConfig.getParameter<edm::InputTag>("srcGenParticles"))) | ||||
, srcGenParticles_ (consumes<vector<pat::PackedGenParticle> >(iConfig.getParameter<edm::InputTag>("srcGenParticles"))) | ||||
, jecLabel_ (iConfig.getParameter<std::string> ("jecLabel")) | ||||
, doComposition_ (iConfig.getParameter<bool> ("doComposition")) | ||||
, doFlavor_ (iConfig.getParameter<bool> ("doFlavor")) | ||||
|
@@ -115,6 +115,46 @@ void JetResponseAnalyzer::beginJob() | |||
} | ||||
|
||||
|
||||
void getMult( vector<reco::CandidatePtr> const & particles, int* nMult, int* chMult ) { | ||||
|
||||
vector<reco::CandidatePtr>::const_iterator itParticle; | ||||
for (itParticle=particles.begin();itParticle!=particles.end();++itParticle){ | ||||
const reco::Candidate* pfCand = itParticle->get(); | ||||
|
||||
switch (std::abs(pfCand->pdgId())) { | ||||
|
||||
case 211: //PFCandidate::h: // charged hadron | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't use unnamed constants. Instead, you should define enums as in
You also only really have two cases:
|
||||
(*chMult)++; | ||||
break; | ||||
|
||||
case 130: //PFCandidate::h0 : // neutral hadron | ||||
(*nMult)++; | ||||
break; | ||||
|
||||
case 22: //PFCandidate::gamma: // photon | ||||
(*nMult)++; | ||||
break; | ||||
|
||||
case 11: // PFCandidate::e: // electron | ||||
(*chMult)++; | ||||
break; | ||||
|
||||
case 13: //PFCandidate::mu: // muon | ||||
(*chMult)++; | ||||
break; | ||||
|
||||
case 1: // PFCandidate::h_HF : // hadron in HF | ||||
(*nMult)++; | ||||
break; | ||||
|
||||
case 2: //PFCandidate::egamma_HF : // electromagnetic in HF | ||||
(*nMult)++; | ||||
break; | ||||
} | ||||
} | ||||
} | ||||
|
||||
//_______________ | ||||
//______________________________________________________________________________ | ||||
void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | ||||
const edm::EventSetup& iSetup) | ||||
|
@@ -134,7 +174,7 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | |||
edm::Handle<reco::VertexCollection> vtx; | ||||
edm::Handle<PFCandidateView> pfCandidates; | ||||
edm::Handle<std::vector<edm::FwdPtr<reco::PFCandidate> > > pfCandidatesAsFwdPtr; | ||||
edm::Handle<vector<reco::GenParticle> > genParticles; | ||||
edm::Handle<vector<pat::PackedGenParticle> > genParticles; | ||||
|
||||
// Jet CORRECTOR | ||||
jetCorrector_ = (jecLabel_.empty()) ? 0 : JetCorrector::getJetCorrector(jecLabel_,iSetup); | ||||
|
@@ -189,8 +229,8 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | |||
JRAEvt_->refpvz = -1000.0; | ||||
iEvent.getByToken(srcGenParticles_, genParticles); | ||||
for (size_t i = 0; i < genParticles->size(); ++i) { | ||||
const reco::GenParticle & genIt = (*genParticles)[i]; | ||||
if ( genIt.isHardProcess() ) { | ||||
const pat::PackedGenParticle & genIt = (*genParticles)[i]; | ||||
if ( genIt.fromHardProcessFinalState() ) { | ||||
JRAEvt_->refpvz = genIt.vz(); | ||||
break; | ||||
} | ||||
|
@@ -264,11 +304,10 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | |||
else JRAEvt_->refdrjt->pop_back(); | ||||
continue; | ||||
} | ||||
|
||||
JRAEvt_->refpdgid->push_back(0); | ||||
JRAEvt_->refpdgid_algorithmicDef->push_back(0); | ||||
JRAEvt_->refpdgid_physicsDef->push_back(0); | ||||
if (getFlavorFromMap_) { | ||||
JRAEvt_->refpdgid_algorithmicDef->push_back(0); | ||||
JRAEvt_->refpdgid_physicsDef->push_back(0); | ||||
reco::JetMatchedPartonsCollection::const_iterator itPartonMatch; | ||||
itPartonMatch=refToPartonMap->begin(); | ||||
for (;itPartonMatch!=refToPartonMap->end();++itPartonMatch) { | ||||
|
@@ -315,10 +354,6 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | |||
} | ||||
} | ||||
} | ||||
else { | ||||
JRAEvt_->refpdgid_algorithmicDef->at(JRAEvt_->nref)=0; | ||||
JRAEvt_->refpdgid_physicsDef->at(JRAEvt_->nref)=0; | ||||
} | ||||
JRAEvt_->refpdgid->at(JRAEvt_->nref)=ref->pdgId(); | ||||
|
||||
// Beta/Beta Star Calculation | ||||
|
@@ -439,12 +474,21 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | |||
JRAEvt_->jtmuf ->push_back(pfJetRef->muonEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); | ||||
JRAEvt_->jthfhf->push_back(pfJetRef->HFHadronEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); | ||||
JRAEvt_->jthfef->push_back(pfJetRef->HFEMEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref)); | ||||
int chMult=0, nMult=0; | ||||
getMult( ref.castTo<reco::GenJetRef>()->getJetConstituents(), &nMult, &chMult ); | ||||
JRAEvt_->refnMult ->push_back( nMult ); | ||||
JRAEvt_->refchMult->push_back( chMult ); | ||||
|
||||
//this method exists for pfjets (neutralMultiplicity()), but not for genjets | ||||
//original i thought since genjet didn't have it i should make this method | ||||
chMult=0; nMult=0; | ||||
getMult( jet.castTo<reco::PFJetRef>()->getJetConstituents(), &nMult, &chMult ); | ||||
JRAEvt_->jtnMult ->push_back( nMult ); | ||||
JRAEvt_->jtchMult->push_back( chMult ); | ||||
} | ||||
} | ||||
|
||||
JRAEvt_->nref++; | ||||
} | ||||
|
||||
// PFCANDIDATE INFORMATION | ||||
//Dual handle idea from https://github.com/aperloff/cmssw/blob/CMSSW_7_6_X/RecoJets/JetProducers/plugins/VirtualJetProducer.cc | ||||
//Random-Cone algo from https://github.com/cihar29/OffsetAnalysis/blob/master/run_offset.py | ||||
|
@@ -483,8 +527,6 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent, | |||
} | ||||
} | ||||
} | ||||
|
||||
|
||||
tree_->Fill(); | ||||
|
||||
return; | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been out of the loop for a while, so feel free to tell me I don't know the latest developments. That said,
0.4
seems awfully permissive for the deltaR matching. That's the entire cone radius for anR=0.4
jet. The default here should be the most often used value and should not change much. Is that why you changed this to0.4
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the confusion, this was actually a test version and we will fix it and upload the correct one with the values that were before. (However, this does not affect the results because we require dr max value of 0.2 in the MC Truth JECs derivation.)