41 const uint32_t _nbins,
84 std::unique_ptr<TH1F> _base_hist,
148 for (
auto&
pset : response_plots) {
150 const auto ptbin_low =
pset.getParameter<
double>(
"ptBinLow");
151 const auto ptbin_high =
pset.getParameter<
double>(
"ptBinHigh");
152 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
153 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
155 const auto response_nbins =
pset.getParameter<uint32_t>(
"responseNbins");
156 const auto response_low =
pset.getParameter<
double>(
"responseLow");
157 const auto response_high =
pset.getParameter<
double>(
"responseHigh");
163 auto rawTitle =
title;
164 rawTitle = rawTitle.replace(rawTitle.begin(), rawTitle.begin(),
"Raw ");
167 name,
title, response_nbins, response_low, response_high, ptbin_low, ptbin_high, etabin_low, etabin_high));
170 name, rawTitle, response_nbins, response_low, response_high, ptbin_low, ptbin_high, etabin_low, etabin_high));
173 throw std::runtime_error(
"Requested too many jet response plots, aborting as this seems unusual.");
178 for (
auto&
pset : genjet_plots_pset) {
183 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
184 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
186 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
187 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
192 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
201 for (
auto&
pset : genjet_plots_pset) {
206 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
207 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
209 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
210 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
215 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
224 for (
auto&
pset : genjet_plots_pset) {
229 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
230 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
232 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
233 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
238 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
247 for (
auto&
pset : recojet_plots_pset) {
252 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
253 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
255 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
256 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
261 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
270 for (
auto&
pset : recojet_plots_pset) {
275 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
276 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
278 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
279 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
284 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
293 for (
auto&
pset : recojet_plots_pset) {
298 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
299 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
301 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
302 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
307 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
330 const auto& response_plots = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"responsePlots");
333 const auto& genjet_plots = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"genJetPlots");
338 const auto& recojet_plots = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"recoJetPlots");
349 std::vector<int> matchIndices;
350 std::vector<int> matchIndicesReco;
357 const auto pt_reco = recoJet.pt();
358 const auto eta_reco =
abs(recoJet.eta());
359 const int iMatch_reco = matchIndicesReco[
i];
362 if (
plot.isInEtaBin(eta_reco)) {
366 if (iMatch_reco != -1) {
368 if (
plot.isInEtaBin(eta_reco)) {
374 if (
plot.isInEtaBin(eta_reco)) {
384 const auto pt_gen = genJet.pt();
385 const auto eta_gen =
abs(genJet.eta());
386 const int iMatch = matchIndices[
i];
391 if (
plot.isInEtaBin(eta_gen)) {
399 if (
plot.isInEtaBin(eta_gen)) {
405 if (
plot.isInEtaBin(eta_gen)) {
415 auto pt_reco = recoJet.pt();
417 const auto response = pt_reco / pt_gen;
418 const auto response_raw = pt_reco * recoJet.jecFactor(
"Uncorrected") / pt_gen;
424 if (
plot.isInPtEtaBin(pt_gen, eta_gen)) {
430 if (
plot.isInPtEtaBin(pt_gen, eta_gen)) {
431 plot.fill(response_raw);
edm::EDGetTokenT< edm::View< pat::Jet > > recoJetsToken
T getParameter(std::string const &) const
Plot1DInBin(const std::string _name, const std::string _title, const uint32_t _nbins, const float _min, const float _max, float _ptbin_low, float _ptbin_high, float _etabin_low, float _etabin_high)
void book(DQMStore::IBooker &booker)
void prepareJetResponsePlots(const std::vector< edm::ParameterSet > &genjet_plots_pset)
void match(const C &candCollection, const M &matchedCandCollection, std::vector< int > &matchIndices, bool matchCharge=false, float dRMax=-1)
virtual void setCurrentFolder(std::string const &fullpath)
std::vector< Plot1DInBin > jetResponsePlots
bool isInBin(float v, float low, float high)
std::vector< Plot1DInBinVariable > recoJetPlots
void fillJetResponse(edm::View< pat::Jet > &recoJetCollection, edm::View< reco::Jet > &genJetCollection)
void prepareGenJetMatchedPlots(const std::vector< edm::ParameterSet > &genjet_plots_pset)
edm::EDGetTokenT< edm::View< reco::Jet > > genJetsToken
PFJetAnalyzerDQM(const edm::ParameterSet &)
bool isInBin(float v, float low, float high)
void prepareRecoJetMatchedPlots(const std::vector< edm::ParameterSet > &recojet_plots_pset)
bool isInPtEtaBin(float pt, float eta)
void prepareRecoJetUnmatchedPlots(const std::vector< edm::ParameterSet > &recojet_plots_pset)
edm::InputTag genJetsLabel
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< Plot1DInBinVariable > recoJetPlots_matched
std::vector< Plot1DInBinVariable > recoJetPlots_unmatched
void book(DQMStore::IBooker &booker)
Abs< T >::type abs(const T &t)
std::string jetCollectionName
std::unique_ptr< TH1F > base_hist
#define DEFINE_FWK_MODULE(type)
edm::InputTag recoJetsLabel
edm::EDGetTokenT< reco::CandViewMatchMap > srcRefToJetMap
std::vector< Plot1DInBinVariable > genJetPlots
std::vector< Plot1DInBinVariable > genJetPlots_matched
std::vector< Plot1DInBinVariable > genJetPlots_unmatched
void prepareGenJetUnmatchedPlots(const std::vector< edm::ParameterSet > &genjet_plots_pset)
bool isInEtaBin(float eta)
void prepareRecoJetPlots(const std::vector< edm::ParameterSet > &recojet_plots_pset)
void analyze(const edm::Event &, const edm::EventSetup &) override
void prepareGenJetPlots(const std::vector< edm::ParameterSet > &genjet_plots_pset)
Plot1DInBinVariable(const std::string _name, const std::string _title, std::unique_ptr< TH1F > _base_hist, float _ptbin_low, float _ptbin_high, float _etabin_low, float _etabin_high)
bool isInPtEtaBin(float pt, float eta)
bool isInEtaBin(float eta)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< Plot1DInBin > jetResponsePlots_noJEC