CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFJetDQMPostProcessor Class Reference
Inheritance diagram for PFJetDQMPostProcessor:
DQMEDHarvester edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFJetDQMPostProcessor (const edm::ParameterSet &)
 
 ~PFJetDQMPostProcessor () override
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &) override
 
virtual void dqmAnalyze (DQMStore::IBooker &, DQMStore::IGetter &, edm::Event const &, edm::EventSetup const &)
 
 DQMEDHarvester (edm::ParameterSet const &iConfig)
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (DQMStore::IBooker &, DQMStore::IGetter &, edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &es) final
 
void endProcessBlockProduce (edm::ProcessBlock &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &es) final
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::EndProcessBlockProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
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
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void fitResponse (TH1F *hreso, TH1F *h_genjet_pt, int ptbinlow, int ietahigh, double recoptcut, double &resp, double &resp_err, double &reso, double &reso_err)
 
double getRespUnc (double width, double width_err, double mean, double mean_err)
 
std::string seta (double eta)
 
std::string spt (double ptmin, double ptmax)
 

Private Attributes

bool debug = false
 
std::vector< double > etaBins
 
std::string genjetDir
 
std::vector< std::string > jetResponseDir
 
std::vector< double > ptBins
 
double recoptcut
 

Additional Inherited Members

- Public Types inherited from DQMEDHarvester
typedef dqm::harvesting::DQMStore DQMStore
 
typedef dqm::harvesting::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from DQMEDHarvester
DQMStoredqmstore_
 
edm::GetterOfProducts< DQMTokenjobmegetter_
 
edm::EDPutTokenT< DQMTokenjobToken_
 
edm::GetterOfProducts< DQMTokenlumimegetter_
 
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::GetterOfProducts< DQMTokenrunmegetter_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 26 of file PFJetDQMPostProcessor.cc.

Constructor & Destructor Documentation

◆ PFJetDQMPostProcessor()

PFJetDQMPostProcessor::PFJetDQMPostProcessor ( const edm::ParameterSet iConfig)
explicit

Definition at line 70 of file PFJetDQMPostProcessor.cc.

References etaBins, genjetDir, edm::ParameterSet::getParameter(), jetResponseDir, ptBins, recoptcut, and AlCaHLTBitMon_QueryRunRegistry::string.

70  {
71  jetResponseDir = iConfig.getParameter<std::vector<std::string>>("jetResponseDir");
72  genjetDir = iConfig.getParameter<std::string>("genjetDir");
73  ptBins = iConfig.getParameter<std::vector<double>>("ptBins");
74  etaBins = iConfig.getParameter<std::vector<double>>("etaBins");
75  recoptcut = iConfig.getParameter<double>("recoPtCut");
76 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< std::string > jetResponseDir
std::vector< double > etaBins
std::vector< double > ptBins

◆ ~PFJetDQMPostProcessor()

PFJetDQMPostProcessor::~PFJetDQMPostProcessor ( )
override

Definition at line 78 of file PFJetDQMPostProcessor.cc.

78 {}

Member Function Documentation

◆ dqmEndJob()

void PFJetDQMPostProcessor::dqmEndJob ( DQMStore::IBooker ibook_,
DQMStore::IGetter iget_ 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 81 of file PFJetDQMPostProcessor.cc.

References dqm::implementation::IBooker::book1D(), filterCSVwithJSON::copy, debug, submitPVResolutionJobs::err, etaBins, spr::find(), fitResponse(), genjetDir, dqm::implementation::IGetter::get(), dqm::implementation::IGetter::getMEs(), getRespUnc(), dqm::legacy::MonitorElement::getTH1F(), mps_fire::i, hcalRecHitTable_cff::ieta, jetResponseDir, hlt_dqm_clientPB-live_cfg::me, SiStripPI::mean, HLTTauDQMOffline_cfi::nPtBins, ptBins, recoptcut, alignCSCRings::s, seta(), dqm::implementation::NavigatorBase::setCurrentFolder(), spt(), and AlCaHLTBitMon_QueryRunRegistry::string.

81  {
82  for (unsigned int idir = 0; idir < jetResponseDir.size(); idir++) {
84  std::vector<std::string> sME_genjets = iget_.getMEs();
85  std::for_each(sME_genjets.begin(), sME_genjets.end(), [&](auto& s) { s.insert(0, genjetDir); });
86  //for (unsigned int i=0; i<sME_genjets.size(); i++) std::cout << sME_genjets[i] << std::endl;
87 
88  iget_.setCurrentFolder(jetResponseDir[idir]);
89  std::vector<std::string> sME_response = iget_.getMEs();
90  std::for_each(sME_response.begin(), sME_response.end(), [&](auto& s) { s.insert(0, jetResponseDir[idir]); });
91  //for (unsigned int i=0; i<sME_response.size(); i++) std::cout << sME_response[i] << std::endl;
92 
93  iget_.setCurrentFolder(jetResponseDir[idir]);
94 
95  double ptBinsArray[ptBins.size()];
96  unsigned int nPtBins = ptBins.size() - 1;
97  std::copy(ptBins.begin(), ptBins.end(), ptBinsArray);
98  //for(unsigned int ipt = 0; ipt < ptBins.size(); ++ipt) std::cout << ptBins[ipt] << std::endl;
99 
100  std::string stitle;
101  char ctitle[50];
102  std::vector<MonitorElement*> vME_presponse;
103  std::vector<MonitorElement*> vME_preso;
104  std::vector<MonitorElement*> vME_preso_rms;
105 
107  TH1F* h_resp;
108  TH1F* h_genjet_pt;
109 
110  //
111  // Response distributions
112  //
113  for (unsigned int ieta = 1; ieta < etaBins.size(); ++ieta) {
114  stitle = genjetDir + "genjet_pt" + "_eta" + seta(etaBins[ieta]);
115  //std::cout << ieta << " " << stitle << std::endl;
116 
117  std::vector<std::string>::const_iterator it = std::find(sME_genjets.begin(), sME_genjets.end(), stitle);
118  if (it == sME_genjets.end())
119  continue;
120  me = iget_.get(stitle);
121  h_genjet_pt = (TH1F*)me->getTH1F();
122 
123  stitle = "presponse_eta" + seta(etaBins[ieta]);
124  // adding "Raw" to the title of raw jet response histograms
125  if (jetResponseDir[idir].find("noJEC") != std::string::npos) {
126  sprintf(ctitle, "Raw Jet pT response, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]);
127  } else {
128  sprintf(ctitle, "Jet pT response, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]);
129  }
130  TH1F* h_presponse = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray);
131 
132  stitle = "preso_eta" + seta(etaBins[ieta]);
133  if (jetResponseDir[idir].find("noJEC") != std::string::npos) {
134  sprintf(ctitle, "Raw Jet pT resolution, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]);
135  } else {
136  sprintf(ctitle, "Jet pT resolution, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]);
137  }
138  TH1F* h_preso = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray);
139 
140  stitle = "preso_eta" + seta(etaBins[ieta]) + "_rms";
141  if (jetResponseDir[idir].find("noJEC") != std::string::npos) {
142  sprintf(ctitle, "Raw Jet pT resolution using RMS, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]);
143  } else {
144  sprintf(ctitle, "Jet pT resolution using RMS, %4.1f<|#eta|<%4.1f", etaBins[ieta - 1], etaBins[ieta]);
145  }
146  TH1F* h_preso_rms = new TH1F(stitle.c_str(), ctitle, nPtBins, ptBinsArray);
147 
148  for (unsigned int ipt = 0; ipt < ptBins.size() - 1; ++ipt) {
149  stitle = jetResponseDir[idir] + "reso_dist_" + spt(ptBins[ipt], ptBins[ipt + 1]) + "_eta" + seta(etaBins[ieta]);
150  std::vector<std::string>::const_iterator it = std::find(sME_response.begin(), sME_response.end(), stitle);
151  if (it == sME_response.end())
152  continue;
153  me = iget_.get(stitle);
154  h_resp = (TH1F*)me->getTH1F();
155 
156  // Fit-based
157  double resp = 1.0, resp_err = 0.0, reso = 0.0, reso_err = 0.0;
158  fitResponse(h_resp, h_genjet_pt, ipt, ieta, recoptcut, resp, resp_err, reso, reso_err);
159 
160  h_presponse->SetBinContent(ipt + 1, resp);
161  h_presponse->SetBinError(ipt + 1, resp_err);
162  h_preso->SetBinContent(ipt + 1, reso);
163  h_preso->SetBinError(ipt + 1, reso_err);
164 
165  // RMS-based
166  double std = h_resp->GetStdDev();
167  double std_error = h_resp->GetStdDevError();
168 
169  // Scale each bin with mean response
170  double mean = 1.0;
171  double mean_error = 0.0;
172  double err = 0.0;
173  if (h_resp->GetMean() > 0) {
174  mean = h_resp->GetMean();
175  mean_error = h_resp->GetMeanError();
176 
177  // Scale resolution by response.
178  std /= mean;
179  std_error /= mean;
180 
181  err = getRespUnc(std, std_error, mean, mean_error);
182  }
183 
184  h_preso_rms->SetBinContent(ipt + 1, std);
185  h_preso_rms->SetBinError(ipt + 1, err);
186 
187  } // ipt
188 
189  stitle = "presponse_eta" + seta(etaBins[ieta]);
190  me = ibook_.book1D(stitle.c_str(), h_presponse);
191  vME_presponse.push_back(me);
192 
193  stitle = "preso_eta" + seta(etaBins[ieta]);
194  me = ibook_.book1D(stitle.c_str(), h_preso);
195  vME_preso.push_back(me);
196 
197  stitle = "preso_eta" + seta(etaBins[ieta]) + "_rms";
198  me = ibook_.book1D(stitle.c_str(), h_preso_rms);
199  vME_preso_rms.push_back(me);
200 
201  } // ieta
202 
203  //
204  // Checks
205  //
206  if (debug) {
207  for (std::vector<MonitorElement*>::const_iterator i = vME_presponse.begin(); i != vME_presponse.end(); ++i)
208  (*i)->getTH1F()->Print();
209  for (std::vector<MonitorElement*>::const_iterator i = vME_preso.begin(); i != vME_preso.end(); ++i)
210  (*i)->getTH1F()->Print();
211  for (std::vector<MonitorElement*>::const_iterator i = vME_preso_rms.begin(); i != vME_preso_rms.end(); ++i)
212  (*i)->getTH1F()->Print();
213  }
214  }
215 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< std::string > jetResponseDir
virtual std::vector< std::string > getMEs() const
Definition: DQMStore.cc:759
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::string spt(double ptmin, double ptmax)
std::vector< double > etaBins
virtual TH1F * getTH1F() const
void fitResponse(TH1F *hreso, TH1F *h_genjet_pt, int ptbinlow, int ietahigh, double recoptcut, double &resp, double &resp_err, double &reso, double &reso_err)
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
std::vector< double > ptBins
std::string seta(double eta)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
double getRespUnc(double width, double width_err, double mean, double mean_err)

◆ fitResponse()

void PFJetDQMPostProcessor::fitResponse ( TH1F *  hreso,
TH1F *  h_genjet_pt,
int  ptbinlow,
int  ietahigh,
double  recoptcut,
double &  resp,
double &  resp_err,
double &  reso,
double &  reso_err 
)
private

Definition at line 217 of file PFJetDQMPostProcessor.cc.

References etaBins, getRespUnc(), METSkim_cff::Max, ptBins, recoptcut, and seta().

Referenced by dqmEndJob().

225  {
226  // This 'smartfitter' is converted from the original Python smart_fit() -function
227  // implemented in test/helperFunctions.py. See that file for more commentary.
228  // Juska 23 May 2019
229 
230  // Only do plots if needed for debugging
231  // NOTE a directory called 'debug' must exist in the working directory
232  //
233  bool doPlots = false;
234 
235  double ptlow = ptBins[ptbinlow];
236  double pthigh = ptBins[ptbinlow + 1];
237 
238  // Take range by Mikko's advice: -1.5 and + 1.5 * RMS width
239 
240  double rmswidth = hreso->GetStdDev();
241  double rmsmean = hreso->GetMean();
242  double fitlow = rmsmean - 1.5 * rmswidth;
243  fitlow = TMath::Max(recoptcut / ptlow, fitlow);
244  double fithigh = rmsmean + 1.5 * rmswidth;
245 
246  TF1* fg = new TF1("mygaus", "gaus", fitlow, fithigh);
247  TF1* fg2 = new TF1("fg2", "TMath::Gaus(x,[0],[1],true)*[2]", fitlow, fithigh);
248 
249  hreso->Fit("mygaus", "RQN");
250 
251  fg2->SetParameter(0, fg->GetParameter(1));
252  fg2->SetParameter(1, fg->GetParameter(2));
253 
254  // Extract ngenjet in the current pT bin from the genjet histo
255  float ngenjet = h_genjet_pt->GetBinContent(ptbinlow + 1);
256 
257  // Here the fit is forced to take the area of ngenjets.
258  // The area is further normalized for the response histogram x-axis length
259  // (3) and number of bins (100)
260  fg2->FixParameter(2, ngenjet * 3. / 100.);
261 
262  hreso->Fit("fg2", "RQN");
263 
264  fitlow = fg2->GetParameter(0) - 1.5 * fg2->GetParameter(1);
265  fitlow = TMath::Max(15. / ptlow, fitlow);
266  fithigh = fg2->GetParameter(0) + 1.5 * fg2->GetParameter(1);
267 
268  fg2->SetRange(fitlow, fithigh);
269 
270  hreso->Fit("fg2", "RQ");
271 
272  fg->SetRange(0, 3);
273  fg2->SetRange(0, 3);
274  fg->SetLineWidth(2);
275  fg2->SetLineColor(kGreen + 2);
276 
277  hreso->GetXaxis()->SetRangeUser(0, 2);
278 
279  // Save plots to a subdirectory if asked (debug-directory must exist!)
280  if (doPlots & (hreso->GetEntries() > 0)) {
281  TCanvas* cfit = new TCanvas(Form("respofit_%i", int(ptlow)), "respofit", 600, 600);
282  hreso->Draw("ehist");
283  fg->Draw("same");
284  fg2->Draw("same");
285  cfit->SaveAs(
286  Form("debug/respo_smartfit_%04d_%i_eta%s.pdf", (int)ptlow, (int)pthigh, seta(etaBins[ietahigh]).c_str()));
287  }
288 
289  resp = fg2->GetParameter(0);
290  resp_err = fg2->GetParError(0);
291 
292  // Scale resolution by response. Avoid division by zero.
293  if (0 == resp)
294  reso = 0;
295  else
296  reso = fg2->GetParameter(1) / resp;
297  reso_err = fg2->GetParError(1) / resp;
298 
299  reso_err = getRespUnc(reso, reso_err, resp, resp_err);
300 }
std::vector< double > etaBins
std::vector< double > ptBins
std::string seta(double eta)
double getRespUnc(double width, double width_err, double mean, double mean_err)

◆ getRespUnc()

double PFJetDQMPostProcessor::getRespUnc ( double  width,
double  width_err,
double  mean,
double  mean_err 
)
private

Definition at line 303 of file PFJetDQMPostProcessor.cc.

References SiStripPI::mean, conifer::pow(), and ApeEstimator_cff::width.

Referenced by dqmEndJob(), and fitResponse().

303  {
304  if (0 == width || 0 == mean)
305  return 0;
306  return TMath::Sqrt(pow(width_err, 2) / pow(width, 2) + pow(mean_err, 2) / pow(mean, 2)) * width;
307 }
constexpr int pow(int x)
Definition: conifer.h:24

◆ seta()

std::string PFJetDQMPostProcessor::seta ( double  eta)
inlineprivate

Definition at line 53 of file PFJetDQMPostProcessor.cc.

References PVValHelper::eta, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

Referenced by dqmEndJob(), and fitResponse().

53  {
54  std::string seta = std::to_string(int(eta * 10.));
55  if (seta.length() < 2)
56  seta = "0" + seta;
57  return seta;
58  }
static std::string to_string(const XMLCh *ch)
std::string seta(double eta)

◆ spt()

std::string PFJetDQMPostProcessor::spt ( double  ptmin,
double  ptmax 
)
inlineprivate

Definition at line 60 of file PFJetDQMPostProcessor.cc.

References muonTiming_cfi::ptmax, ptmin, AlCaHLTBitMon_QueryRunRegistry::string, and to_string().

Referenced by dqmEndJob().

60  {
62  return spt;
63  }
static std::string to_string(const XMLCh *ch)
std::string spt(double ptmin, double ptmax)
double ptmin
Definition: HydjetWrapper.h:86

Member Data Documentation

◆ debug

bool PFJetDQMPostProcessor::debug = false
private

Definition at line 51 of file PFJetDQMPostProcessor.cc.

Referenced by dqmEndJob().

◆ etaBins

std::vector<double> PFJetDQMPostProcessor::etaBins
private

Definition at line 47 of file PFJetDQMPostProcessor.cc.

Referenced by dqmEndJob(), fitResponse(), and PFJetDQMPostProcessor().

◆ genjetDir

std::string PFJetDQMPostProcessor::genjetDir
private

Definition at line 45 of file PFJetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and PFJetDQMPostProcessor().

◆ jetResponseDir

std::vector<std::string> PFJetDQMPostProcessor::jetResponseDir
private

Definition at line 44 of file PFJetDQMPostProcessor.cc.

Referenced by dqmEndJob(), and PFJetDQMPostProcessor().

◆ ptBins

std::vector<double> PFJetDQMPostProcessor::ptBins
private

Definition at line 46 of file PFJetDQMPostProcessor.cc.

Referenced by dqmEndJob(), fitResponse(), and PFJetDQMPostProcessor().

◆ recoptcut

double PFJetDQMPostProcessor::recoptcut
private

Definition at line 49 of file PFJetDQMPostProcessor.cc.

Referenced by dqmEndJob(), fitResponse(), and PFJetDQMPostProcessor().