CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PFJetAnalyzerDQM Class Reference
Inheritance diagram for PFJetAnalyzerDQM:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

class  Plot1DInBin
 
class  Plot1DInBinVariable
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 PFJetAnalyzerDQM (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

void fillJetResponse (edm::View< pat::Jet > &recoJetCollection, edm::View< reco::Jet > &genJetCollection)
 
void prepareGenJetPlots (const std::vector< edm::ParameterSet > &genjet_plots_pset)
 
void prepareJetResponsePlots (const std::vector< edm::ParameterSet > &genjet_plots_pset)
 

Private Attributes

std::vector< Plot1DInBinVariablegenJetPlots
 
edm::InputTag genJetsLabel
 
bool genJetsOn
 
edm::EDGetTokenT< edm::View< reco::Jet > > genJetsToken
 
bool isMC
 
std::string jetCollectionName
 
float jetDeltaR
 
std::vector< Plot1DInBinjetResponsePlots
 
std::vector< Plot1DInBinjetResponsePlots_noJEC
 
edm::InputTag recoJetsLabel
 
edm::EDGetTokenT< edm::View< pat::Jet > > recoJetsToken
 
edm::EDGetTokenT< reco::CandViewMatchMapsrcRefToJetMap
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 21 of file PFJetAnalyzerDQM.cc.

Constructor & Destructor Documentation

◆ PFJetAnalyzerDQM()

PFJetAnalyzerDQM::PFJetAnalyzerDQM ( const edm::ParameterSet iConfig)

Definition at line 191 of file PFJetAnalyzerDQM.cc.

191  {
192  recoJetsLabel = iConfig.getParameter<edm::InputTag>("recoJetCollection");
193  genJetsLabel = iConfig.getParameter<edm::InputTag>("genJetCollection");
194 
195  //label for making new folder
197 
198  //DeltaR for reco to gen jet matching
199  jetDeltaR = iConfig.getParameter<double>("jetDeltaR");
200 
201  //for turn genJet on/off
202  genJetsOn = iConfig.getParameter<bool>("genJetsOn");
203 
204  //Create all jet response plots in bins of genjet pt and eta
205  const auto& response_plots = iConfig.getParameter<std::vector<edm::ParameterSet>>("responsePlots");
206  prepareJetResponsePlots(response_plots);
207 
208  const auto& genjet_plots = iConfig.getParameter<std::vector<edm::ParameterSet>>("genJetPlots");
209  prepareGenJetPlots(genjet_plots);
210 
211  recoJetsToken = consumes<edm::View<pat::Jet>>(recoJetsLabel);
212  genJetsToken = consumes<edm::View<reco::Jet>>(genJetsLabel);
213 }

References genJetsLabel, genJetsOn, genJetsToken, edm::ParameterSet::getParameter(), jetCollectionName, jetDeltaR, edm::InputTag::label(), prepareGenJetPlots(), prepareJetResponsePlots(), recoJetsLabel, and recoJetsToken.

Member Function Documentation

◆ analyze()

void PFJetAnalyzerDQM::analyze ( const edm::Event iEvent,
const edm::EventSetup  
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 281 of file PFJetAnalyzerDQM.cc.

281  {
282  edm::Handle<edm::View<pat::Jet>> recoJetCollectionHandle;
283  iEvent.getByToken(recoJetsToken, recoJetCollectionHandle);
284  auto recoJetCollection = *recoJetCollectionHandle;
285 
286  isMC = !iEvent.isRealData();
287 
288  if (isMC) {
289  edm::Handle<edm::View<reco::Jet>> genJetCollectionHandle;
290  iEvent.getByToken(genJetsToken, genJetCollectionHandle);
291  auto genJetCollection = *genJetCollectionHandle;
292 
294  }
295 }

References fillJetResponse(), particleFlowDQM_cff::genJetCollection, genJetsToken, iEvent, isMC, particleFlowDQM_cff::recoJetCollection, and recoJetsToken.

◆ bookHistograms()

void PFJetAnalyzerDQM::bookHistograms ( DQMStore::IBooker booker,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 261 of file PFJetAnalyzerDQM.cc.

261  {
262  booker.setCurrentFolder("ParticleFlow/JetResponse/" + jetCollectionName + "/JEC/");
263  for (auto& plot : jetResponsePlots) {
264  plot.book(booker);
265  }
266  //Book plots for noJEC
267  booker.setCurrentFolder("ParticleFlow/JetResponse/" + jetCollectionName + "/noJEC/");
268  for (auto& plot : jetResponsePlots_noJEC) {
269  plot.book(booker);
270  }
271 
272  //Book plots for gen-jet pt spectra
273  if (genJetsOn) {
274  booker.setCurrentFolder("ParticleFlow/GenJets/");
275  for (auto& plot : genJetPlots) {
276  plot.book(booker);
277  }
278  }
279 }

References genJetPlots, genJetsOn, jetCollectionName, jetResponsePlots, jetResponsePlots_noJEC, plotFactory::plot, and dqm::implementation::NavigatorBase::setCurrentFolder().

◆ fillJetResponse()

void PFJetAnalyzerDQM::fillJetResponse ( edm::View< pat::Jet > &  recoJetCollection,
edm::View< reco::Jet > &  genJetCollection 
)
private

Definition at line 215 of file PFJetAnalyzerDQM.cc.

215  {
216  //match gen jets to reco jets, require minimum jetDeltaR, choose closest, do not try to match charge
217  std::vector<int> matchIndices;
218  PFB::match(genJetCollection, recoJetCollection, matchIndices, false, jetDeltaR);
219 
220  for (unsigned int i = 0; i < genJetCollection.size(); i++) {
221  const auto& genJet = genJetCollection.at(i);
222  const auto pt_gen = genJet.pt();
223  const auto eta_gen = abs(genJet.eta());
224  const int iMatch = matchIndices[i];
225 
226  //Fill genjet pt if genJetOn
227  if (genJetsOn) {
228  for (auto& plot : genJetPlots) {
229  if (plot.isInEtaBin(eta_gen)) {
230  plot.fill(pt_gen);
231  }
232  }
233  }
234 
235  //If gen jet had a matched reco jet
236  if (iMatch != -1) {
237  const auto& recoJet = recoJetCollection[iMatch];
238  auto pt_reco = recoJet.pt();
239 
240  const auto response = pt_reco / pt_gen;
241  const auto response_raw = pt_reco * recoJet.jecFactor("Uncorrected") / pt_gen;
242 
243  //Loop linearly through all plots and check if they match the pt and eta bin
244  //this is not algorithmically optimal but we don't expect to more than a few hundred plots
245  //If this turns out to be a problem, can easily make a 2D-map for indices
246  for (auto& plot : jetResponsePlots) {
247  if (plot.isInPtEtaBin(pt_gen, eta_gen)) {
248  plot.fill(response);
249  }
250  }
251  // this loop should be for NoJEC plots
252  for (auto& plot : jetResponsePlots_noJEC) {
253  if (plot.isInPtEtaBin(pt_gen, eta_gen)) {
254  plot.fill(response_raw);
255  }
256  }
257  }
258  }
259 }

References funct::abs(), particleFlowDQM_cff::genJetCollection, genJetPlots, genJetsOn, mps_fire::i, jetDeltaR, jetResponsePlots, jetResponsePlots_noJEC, PFB::match(), plotFactory::plot, and particleFlowDQM_cff::recoJetCollection.

Referenced by analyze().

◆ prepareGenJetPlots()

void PFJetAnalyzerDQM::prepareGenJetPlots ( const std::vector< edm::ParameterSet > &  genjet_plots_pset)
private

Definition at line 168 of file PFJetAnalyzerDQM.cc.

168  {
169  for (auto& pset : genjet_plots_pset) {
170  const auto name = pset.getParameter<std::string>("name");
171  const auto title = pset.getParameter<std::string>("title");
172 
173  //Low and high edges of the eta bins for jets to pass to be filled into this histogram
174  const auto ptbins_d = pset.getParameter<std::vector<double>>("ptBins");
175  std::vector<float> ptbins(ptbins_d.begin(), ptbins_d.end());
176 
177  const auto etabin_low = pset.getParameter<double>("etaBinLow");
178  const auto etabin_high = pset.getParameter<double>("etaBinHigh");
179 
180  genJetPlots.push_back(Plot1DInBinVariable(
181  name,
182  title,
183  std::make_unique<TH1F>(name.c_str(), title.c_str(), static_cast<int>(ptbins.size()) - 1, ptbins.data()),
184  0.0,
185  0.0,
186  etabin_low,
187  etabin_high));
188  }
189 }

References genJetPlots, Skims_PA_cff::name, muonDTDigis_cfi::pset, LepHTMonitor_cff::ptbins, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by PFJetAnalyzerDQM().

◆ prepareJetResponsePlots()

void PFJetAnalyzerDQM::prepareJetResponsePlots ( const std::vector< edm::ParameterSet > &  genjet_plots_pset)
private

Definition at line 138 of file PFJetAnalyzerDQM.cc.

138  {
139  for (auto& pset : response_plots) {
140  //Low and high edges of the pt and eta bins for jets to pass to be filled into this histogram
141  const auto ptbin_low = pset.getParameter<double>("ptBinLow");
142  const auto ptbin_high = pset.getParameter<double>("ptBinHigh");
143  const auto etabin_low = pset.getParameter<double>("etaBinLow");
144  const auto etabin_high = pset.getParameter<double>("etaBinHigh");
145 
146  const auto response_nbins = pset.getParameter<uint32_t>("responseNbins");
147  const auto response_low = pset.getParameter<double>("responseLow");
148  const auto response_high = pset.getParameter<double>("responseHigh");
149 
150  const auto name = pset.getParameter<std::string>("name");
151  const auto title = pset.getParameter<std::string>("title");
152 
153  // for title of raw jet response histograms
154  auto rawTitle = title;
155  rawTitle = rawTitle.replace(rawTitle.begin(), rawTitle.begin(), "Raw ");
156 
157  jetResponsePlots.push_back(Plot1DInBin(
158  name, title, response_nbins, response_low, response_high, ptbin_low, ptbin_high, etabin_low, etabin_high));
159 
160  jetResponsePlots_noJEC.push_back(Plot1DInBin(
161  name, rawTitle, response_nbins, response_low, response_high, ptbin_low, ptbin_high, etabin_low, etabin_high));
162  }
163  if (jetResponsePlots.size() > 200) {
164  throw std::runtime_error("Requested too many jet response plots, aborting as this seems unusual.");
165  }
166 }

References jetResponsePlots, jetResponsePlots_noJEC, Skims_PA_cff::name, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by PFJetAnalyzerDQM().

Member Data Documentation

◆ genJetPlots

std::vector<Plot1DInBinVariable> PFJetAnalyzerDQM::genJetPlots
private

Definition at line 116 of file PFJetAnalyzerDQM.cc.

Referenced by bookHistograms(), fillJetResponse(), and prepareGenJetPlots().

◆ genJetsLabel

edm::InputTag PFJetAnalyzerDQM::genJetsLabel
private

Definition at line 128 of file PFJetAnalyzerDQM.cc.

Referenced by PFJetAnalyzerDQM().

◆ genJetsOn

bool PFJetAnalyzerDQM::genJetsOn
private

Definition at line 123 of file PFJetAnalyzerDQM.cc.

Referenced by bookHistograms(), fillJetResponse(), and PFJetAnalyzerDQM().

◆ genJetsToken

edm::EDGetTokenT<edm::View<reco::Jet> > PFJetAnalyzerDQM::genJetsToken
private

Definition at line 130 of file PFJetAnalyzerDQM.cc.

Referenced by analyze(), and PFJetAnalyzerDQM().

◆ isMC

bool PFJetAnalyzerDQM::isMC
private

Definition at line 119 of file PFJetAnalyzerDQM.cc.

Referenced by analyze().

◆ jetCollectionName

std::string PFJetAnalyzerDQM::jetCollectionName
private

Definition at line 125 of file PFJetAnalyzerDQM.cc.

Referenced by bookHistograms(), and PFJetAnalyzerDQM().

◆ jetDeltaR

float PFJetAnalyzerDQM::jetDeltaR
private

Definition at line 121 of file PFJetAnalyzerDQM.cc.

Referenced by fillJetResponse(), and PFJetAnalyzerDQM().

◆ jetResponsePlots

std::vector<Plot1DInBin> PFJetAnalyzerDQM::jetResponsePlots
private

Definition at line 114 of file PFJetAnalyzerDQM.cc.

Referenced by bookHistograms(), fillJetResponse(), and prepareJetResponsePlots().

◆ jetResponsePlots_noJEC

std::vector<Plot1DInBin> PFJetAnalyzerDQM::jetResponsePlots_noJEC
private

Definition at line 115 of file PFJetAnalyzerDQM.cc.

Referenced by bookHistograms(), fillJetResponse(), and prepareJetResponsePlots().

◆ recoJetsLabel

edm::InputTag PFJetAnalyzerDQM::recoJetsLabel
private

Definition at line 127 of file PFJetAnalyzerDQM.cc.

Referenced by PFJetAnalyzerDQM().

◆ recoJetsToken

edm::EDGetTokenT<edm::View<pat::Jet> > PFJetAnalyzerDQM::recoJetsToken
private

Definition at line 129 of file PFJetAnalyzerDQM.cc.

Referenced by analyze(), and PFJetAnalyzerDQM().

◆ srcRefToJetMap

edm::EDGetTokenT<reco::CandViewMatchMap> PFJetAnalyzerDQM::srcRefToJetMap
private

Definition at line 131 of file PFJetAnalyzerDQM.cc.

runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
PFJetAnalyzerDQM::jetResponsePlots
std::vector< Plot1DInBin > jetResponsePlots
Definition: PFJetAnalyzerDQM.cc:114
PFJetAnalyzerDQM::fillJetResponse
void fillJetResponse(edm::View< pat::Jet > &recoJetCollection, edm::View< reco::Jet > &genJetCollection)
Definition: PFJetAnalyzerDQM.cc:215
PFB::match
void match(const C &candCollection, const M &matchedCandCollection, std::vector< int > &matchIndices, bool matchCharge=false, float dRMax=-1)
Definition: Matchers.h:17
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
PFJetAnalyzerDQM::jetCollectionName
std::string jetCollectionName
Definition: PFJetAnalyzerDQM.cc:125
PFJetAnalyzerDQM::jetDeltaR
float jetDeltaR
Definition: PFJetAnalyzerDQM.cc:121
particleFlowDQM_cff.genJetCollection
genJetCollection
Definition: particleFlowDQM_cff.py:68
PFJetAnalyzerDQM::prepareJetResponsePlots
void prepareJetResponsePlots(const std::vector< edm::ParameterSet > &genjet_plots_pset)
Definition: PFJetAnalyzerDQM.cc:138
edm::Handle
Definition: AssociativeIterator.h:50
plotFactory.plot
plot
Definition: plotFactory.py:109
PFJetAnalyzerDQM::recoJetsToken
edm::EDGetTokenT< edm::View< pat::Jet > > recoJetsToken
Definition: PFJetAnalyzerDQM.cc:129
particleFlowDQM_cff.recoJetCollection
recoJetCollection
Definition: particleFlowDQM_cff.py:67
PFJetAnalyzerDQM::genJetPlots
std::vector< Plot1DInBinVariable > genJetPlots
Definition: PFJetAnalyzerDQM.cc:116
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
PFJetAnalyzerDQM::genJetsOn
bool genJetsOn
Definition: PFJetAnalyzerDQM.cc:123
PFJetAnalyzerDQM::genJetsToken
edm::EDGetTokenT< edm::View< reco::Jet > > genJetsToken
Definition: PFJetAnalyzerDQM.cc:130
PFJetAnalyzerDQM::prepareGenJetPlots
void prepareGenJetPlots(const std::vector< edm::ParameterSet > &genjet_plots_pset)
Definition: PFJetAnalyzerDQM.cc:168
iEvent
int iEvent
Definition: GenABIO.cc:224
PFJetAnalyzerDQM::genJetsLabel
edm::InputTag genJetsLabel
Definition: PFJetAnalyzerDQM.cc:128
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LepHTMonitor_cff.ptbins
ptbins
Definition: LepHTMonitor_cff.py:39
PFJetAnalyzerDQM::jetResponsePlots_noJEC
std::vector< Plot1DInBin > jetResponsePlots_noJEC
Definition: PFJetAnalyzerDQM.cc:115
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::InputTag
Definition: InputTag.h:15
PFJetAnalyzerDQM::recoJetsLabel
edm::InputTag recoJetsLabel
Definition: PFJetAnalyzerDQM.cc:127
PFJetAnalyzerDQM::isMC
bool isMC
Definition: PFJetAnalyzerDQM.cc:119
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27