41 const uint32_t _nbins,
66 bool isInBin(
float v,
float low,
float high) {
return v >= low && v < high; }
84 std::unique_ptr<TH1F> _base_hist,
105 bool isInBin(
float v,
float low,
float high) {
return v >= low && v < high; }
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;
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];
229 if (
plot.isInEtaBin(eta_gen)) {
237 const auto& recoJet = recoJetCollection[iMatch];
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);
284 auto recoJetCollection = *recoJetCollectionHandle;
291 auto genJetCollection = *genJetCollectionHandle;
edm::EDGetTokenT< edm::View< pat::Jet > > recoJetsToken
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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#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)
T getParameter(std::string const &) const
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)
const_reference at(size_type pos) const
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