41 const uint32_t _nbins,
84 std::unique_ptr<TH1F> _base_hist,
139 for (
auto&
pset : response_plots) {
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");
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");
154 auto rawTitle =
title;
155 rawTitle = rawTitle.replace(rawTitle.begin(), rawTitle.begin(),
"Raw ");
158 name,
title, response_nbins, response_low, response_high, ptbin_low, ptbin_high, etabin_low, etabin_high));
161 name, rawTitle, response_nbins, response_low, response_high, ptbin_low, ptbin_high, etabin_low, etabin_high));
164 throw std::runtime_error(
"Requested too many jet response plots, aborting as this seems unusual.");
169 for (
auto&
pset : genjet_plots_pset) {
174 const auto ptbins_d =
pset.getParameter<std::vector<double>>(
"ptBins");
175 std::vector<float>
ptbins(ptbins_d.begin(), ptbins_d.end());
177 const auto etabin_low =
pset.getParameter<
double>(
"etaBinLow");
178 const auto etabin_high =
pset.getParameter<
double>(
"etaBinHigh");
183 std::make_unique<TH1F>(
name.c_str(),
title.c_str(),
static_cast<int>(
ptbins.size()) - 1,
ptbins.data()),
205 const auto& response_plots = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"responsePlots");
208 const auto& genjet_plots = iConfig.
getParameter<std::vector<edm::ParameterSet>>(
"genJetPlots");
217 std::vector<int> matchIndices;
222 const auto pt_gen = genJet.pt();
223 const auto eta_gen =
abs(genJet.eta());
224 const int iMatch = matchIndices[
i];
229 if (
plot.isInEtaBin(eta_gen)) {
238 auto pt_reco = recoJet.pt();
240 const auto response = pt_reco / pt_gen;
241 const auto response_raw = pt_reco * recoJet.jecFactor(
"Uncorrected") / pt_gen;
247 if (
plot.isInPtEtaBin(pt_gen, eta_gen)) {
253 if (
plot.isInPtEtaBin(pt_gen, eta_gen)) {
254 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)
#define DEFINE_FWK_MODULE(type)
std::vector< Plot1DInBin > jetResponsePlots
bool isInBin(float v, float low, float high)
void fillJetResponse(edm::View< pat::Jet > &recoJetCollection, edm::View< reco::Jet > &genJetCollection)
edm::EDGetTokenT< edm::View< reco::Jet > > genJetsToken
PFJetAnalyzerDQM(const edm::ParameterSet &)
bool isInBin(float v, float low, float high)
bool isInPtEtaBin(float pt, float eta)
edm::InputTag genJetsLabel
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void book(DQMStore::IBooker &booker)
Abs< T >::type abs(const T &t)
std::string jetCollectionName
std::unique_ptr< TH1F > base_hist
edm::InputTag recoJetsLabel
edm::EDGetTokenT< reco::CandViewMatchMap > srcRefToJetMap
std::vector< Plot1DInBinVariable > genJetPlots
bool isInEtaBin(float eta)
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