Skip to content

Commit 8c5ed72

Browse files
committed
Adding in jet calibration configs
1 parent 47562a4 commit 8c5ed72

File tree

5 files changed

+77
-22
lines changed

5 files changed

+77
-22
lines changed

DQMOffline/ParticleFlow/plugins/PFAnalyzer.cc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ PFAnalyzer::PFAnalyzer(const edm::ParameterSet& pSet) {
2828
triggerResultsToken_ = consumes<edm::TriggerResults>(edm::InputTag(theTriggerResultsLabel_));
2929
m_triggerOptions = pSet.getParameter<vstring>("TriggerNames");
3030

31-
//srcWeights = pSet.getParameter<edm::InputTag>("srcWeights");
32-
//weightsToken_ = consumes<edm::ValueMap<float>>(srcWeights);
31+
//puppiWeightToken_ = consumes<edm::ValueMap<float>>(pSet.getParameter<edm::InputTag>("puppiWeight"));
3332

3433
m_pfNames = {"allPFC", "neutralHadPFC", "chargedHadPFC", "electronPFC", "muonPFC", "gammaPFC", "hadHFPFC", "emHFPFC"};
3534
vertexTag_ = pSet.getParameter<edm::InputTag>("PVCollection");
@@ -61,6 +60,7 @@ PFAnalyzer::PFAnalyzer(const edm::ParameterSet& pSet) {
6160
m_funcMap["eta"] = getEta;
6261
m_funcMap["abseta"] = getAbsEta;
6362
m_funcMap["phi"] = getPhi;
63+
m_funcMap["puppi"] = getPuppiWeight;
6464

6565
m_funcMap["HCalE_depth1"] = getHcalEnergy_depth1;
6666
m_funcMap["HCalE_depth2"] = getHcalEnergy_depth2;
@@ -705,7 +705,6 @@ void PFAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup
705705
jets.push_back(patJets->at(i));
706706
}
707707

708-
std::cout << "Using mini and pat" << std::endl;
709708
iEvent.getByToken(patPfCandidateCollection_, patPfCollection);
710709
if (!patPfCollection.isValid()) {
711710
edm::LogError("PFAnalyzer") << "invalid collection: PF candidate \n";
@@ -717,17 +716,18 @@ void PFAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup
717716
numPFCands = patPfCollection->size();
718717
}
719718

720-
std::cout << numPFCands << std::endl;
721-
//if(!passesTriggerSelection(jets, triggerResults, triggerNames, m_triggerOptions)){
722-
// return;
719+
//iEvent.getByToken(puppiWeightToken_, puppiWeight);
720+
//if(!puppiWeight.isValid()){
721+
// edm::LogError("PFAnalyzer") << "invalid collection: Puppi weights \n";
723722
//}
724-
//
725723

726-
std::cout << "Passes trigger" << std::endl;
724+
if(!passesTriggerSelection(jets, triggerResults, triggerNames, m_triggerOptions)){
725+
return;
726+
}
727+
727728
if(!m_eventSelectionMap[m_selection](jets)){
728729
return;
729730
}
730-
std::cout << "Passes event selection" << std::endl;
731731

732732
for (unsigned int i_pfcand=0; i_pfcand < numPFCands; i_pfcand++){
733733
reco::PFCandidate recoPF;
@@ -736,6 +736,7 @@ void PFAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup
736736
int partType = 0;
737737
if(m_isMiniAOD){
738738
packedCand = patPfCollection->at(i_pfcand);
739+
739740
partType = 1;
740741
} else{
741742
recoPF = pfCollection[i_pfcand];

DQMOffline/ParticleFlow/plugins/PFAnalyzer.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "DataFormats/TrackReco/interface/Track.h"
4646

4747
#include "DataFormats/Common/interface/TriggerResults.h"
48+
#include "DataFormats/Common/interface/ValueMap.h"
4849
#include "DataFormats/Math/interface/deltaR.h"
4950

5051
#include "DQMServices/Core/interface/DQMStore.h"
@@ -180,6 +181,7 @@ class PFAnalyzer : public DQMEDAnalyzer {
180181
return -1;
181182
return pfCand.hcalEnergy() / pfCand.rawHcalEnergy();
182183
}
184+
static double getPuppiWeight(const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if(partType){return packedPart.puppiWeight();} return 1; }
183185

184186
static double getTime(const reco::PFCandidate pfCand, const pat::PackedCandidate packedPart, const reco::CandidatePtr cand, int partType) { if(partType){return packedPart.time();} return pfCand.time(); }
185187

@@ -501,8 +503,8 @@ class PFAnalyzer : public DQMEDAnalyzer {
501503
edm::EDGetTokenT<std::vector<reco::Vertex>> vertexToken_;
502504
edm::InputTag srcWeights;
503505

504-
edm::EDGetTokenT<edm::ValueMap<float>> weightsToken_;
505-
edm::ValueMap<float> const* weights_;
506+
edm::EDGetTokenT<edm::ValueMap<float>> puppiWeightToken_;
507+
edm::Handle<edm::ValueMap<float>> puppiWeight;
506508

507509
edm::EDGetTokenT<GenEventInfoProduct> tok_ew_;
508510

DQMOffline/ParticleFlow/python/runBasic_cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
###################################################################
5252
# Data certification GoldenJSON filtering
5353
###################################################################
54-
goldenJSONPath="/eos/user/c/cmsdqm/www/CAF/certification/Collisions25/Cert_Collisions2025_391658_397294_Golden.json"
54+
#goldenJSONPath="/eos/user/c/cmsdqm/www/CAF/certification/Collisions25/Cert_Collisions2025_391658_397294_Golden.json"
55+
goldenJSONPath=""
5556
if goldenJSONPath != "":
5657
import FWCore.PythonUtilities.LumiList as LumiList
5758
process.source.lumisToProcess = LumiList.LumiList(filename = goldenJSONPath).getVLuminosityBlockRange()

DQMOffline/ParticleFlow/python/runBasic_cfi.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
33

44
PFAnalyzer = DQMEDAnalyzer("PFAnalyzer",
5-
#pfJetCollection = cms.InputTag("ak4PFJetsPuppiCorrected"),
6-
# For Mini
7-
pfJetCollection = cms.InputTag("slimmedJets"),
85
#pfCandidates = cms.InputTag("particleFlow"),
6+
#pfJetCollection = cms.InputTag("ak4PFJetsPuppiCorrected"),
7+
98
# For Mini
109
pfCandidates = cms.InputTag("packedPFCandidates"),
10+
pfJetCollection = cms.InputTag("slimmedJets"),
11+
1112
PVCollection = cms.InputTag("offlinePrimaryVertices"),
1213

1314
TriggerResultsLabel = cms.InputTag("TriggerResults::HLT"),
14-
TriggerNames = cms.vstring("HLT_PFJet450"),
15-
#TriggerNames = cms.vstring(""),
16-
#srcWeights = cms.InputTag("puppi"),
15+
#TriggerNames = cms.vstring("HLT_PFJet450"),
16+
TriggerNames = cms.vstring(""),
17+
#puppiWeight = cms.InputTag("packedPuppiweight"),
1718
#eventSelection = cms.string("nocut"),
1819
#eventSelection = cms.string("dijet"),
1920
eventSelection = cms.string("nocut"),
@@ -34,9 +35,10 @@
3435
# in order, are the number of bins, the lowest, and the highest values.
3536
# If any other number is given, this is just a list of bins for the histogram.
3637
observables = cms.vstring('pt;p_{T,PFC};50.;0.;350.',
37-
# 'eta;#eta;50;-5;5',
38-
# 'phi;#phi;50;-3.14;3.14',
39-
# 'energy;E;50;0;300',
38+
'eta;#eta;50;-5;5',
39+
'phi;#phi;50;-3.14;3.14',
40+
'energy;E;50;0;300',
41+
'puppi;E;50;0;1',
4042
# 'RawHCal_E;Raw E_{hcal};50;0;300',
4143
# 'HCal_E;E_{hcal};50;0;300',
4244
# 'PFHad_calibration;E_{Hcal,calib} / E_{Hcal, raw};50;0;4',
@@ -113,7 +115,7 @@
113115
# Just like for cutList, multiple sets of cuts can be applied, using the same formulation.
114116
jetCutList = cms.vstring(
115117
# '[pt;20;30;50;100;200;450;1000]',
116-
# '[pt;20;10000]',
118+
'[pt;20;10000]',
117119
),
118120
)
119121

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import FWCore.ParameterSet.Config as cms
2+
3+
process = cms.Process('ParticleFlowDQMOffline')
4+
5+
# import of standard configurations
6+
process.load('Configuration.StandardSequences.Services_cff')
7+
process.load('FWCore.MessageService.MessageLogger_cfi')
8+
process.load('Configuration.EventContent.EventContent_cff')
9+
process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
10+
process.load('Configuration.StandardSequences.MagneticField_AutoFromDBCurrent_cff')
11+
process.load('Configuration.StandardSequences.EDMtoMEAtRunEnd_cff')
12+
process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
13+
14+
# load DQM
15+
process.load("DQMServices.Core.DQM_cfg")
16+
process.load("DQMServices.Components.DQMEnvironment_cfi")
17+
18+
# my analyzer
19+
process.load('DQMOffline.ParticleFlow.runBasic_cfi')
20+
21+
22+
with open('fileList.log') as f:
23+
lines = f.readlines()
24+
#Input source
25+
process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(lines))
26+
27+
process.DQMoutput = cms.OutputModule("DQMRootOutputModule",
28+
fileName = cms.untracked.string("OUT_step1.root"))
29+
30+
31+
process.p = cms.Path(
32+
process.PFAnalyzer)
33+
process.DQMoutput_step = cms.EndPath(process.DQMoutput)
34+
35+
36+
## Schedule definition
37+
process.schedule = cms.Schedule(
38+
process.p,
39+
process.DQMoutput_step
40+
)
41+
42+
43+
44+
45+
46+
47+
48+
49+

0 commit comments

Comments
 (0)