CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFClient_JetRes Class Reference

#include <PFClient_JetRes.h>

Inheritance diagram for PFClient_JetRes:
DQMEDHarvester edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PFClient_JetRes (const edm::ParameterSet &parameterSet)
 
- Public Member Functions inherited from DQMEDHarvester
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 DQMEDHarvester ()
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
void endJob () final
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDHarvester () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void createEfficiencyPlots (DQMStore::IBooker &, DQMStore::IGetter &, std::string &folder, std::string &name)
 
void createResolutionPlots (DQMStore::IBooker &, DQMStore::IGetter &, std::string &folder, std::string &name)
 
void doEfficiency (DQMStore::IBooker &, DQMStore::IGetter &)
 
void doSummaries (DQMStore::IBooker &, DQMStore::IGetter &)
 
void dqmEndJob (DQMStore::IBooker &, DQMStore::IGetter &) override
 
void getHistogramParameters (MonitorElement *me_slice, double &avarage, double &rms, double &mean, double &sigma)
 

Private Attributes

std::vector< std::string > effHistogramNames_
 
bool efficiencyFlag_
 
std::vector< std::string > folderNames_
 
std::vector< std::string > histogramNames_
 
std::vector< int > PtBins_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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<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)
 
- Protected Attributes inherited from DQMEDHarvester
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 13 of file PFClient_JetRes.h.

Constructor & Destructor Documentation

PFClient_JetRes::PFClient_JetRes ( const edm::ParameterSet parameterSet)

Definition at line 18 of file PFClient_JetRes.cc.

References effHistogramNames_, efficiencyFlag_, folderNames_, edm::ParameterSet::getParameter(), histogramNames_, and PtBins_.

18  {
19  folderNames_ = parameterSet.getParameter<std::vector<std::string>>("FolderNames");
20  histogramNames_ = parameterSet.getParameter<std::vector<std::string>>("HistogramNames");
21  efficiencyFlag_ = parameterSet.getParameter<bool>("CreateEfficiencyPlots");
22  effHistogramNames_ = parameterSet.getParameter<std::vector<std::string>>("HistogramNamesForEfficiencyPlots");
23  PtBins_ = parameterSet.getParameter<std::vector<int>>("VariablePtBins");
24 }
T getParameter(std::string const &) const
std::vector< std::string > effHistogramNames_
std::vector< int > PtBins_
std::vector< std::string > folderNames_
std::vector< std::string > histogramNames_

Member Function Documentation

void PFClient_JetRes::createEfficiencyPlots ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string &  folder,
std::string &  name 
)
private

Definition at line 205 of file PFClient_JetRes.cc.

References DQMStore::IBooker::book1D(), DEFINE_FWK_MODULE, MonitorElement::DQM_KIND_TH1F, PostProcessor_cff::efficiency, DQMStore::IGetter::get(), MonitorElement::getAxisTitle(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getTH1F(), MonitorElement::kind(), MonitorElement::Reset(), MonitorElement::setBinContent(), DQMStore::IBooker::setCurrentFolder(), MonitorElement::setEfficiencyFlag(), AlCaHLTBitMon_QueryRunRegistry::string, TrackerOfflineValidation_Dqm_cff::xmax, and TrackerOfflineValidation_Dqm_cff::xmin.

Referenced by doEfficiency().

208  {
209  MonitorElement *me1 = igetter.get(folder + "/" + name);
210  MonitorElement *me2 = igetter.get(folder + "/" + name + "ref_");
211  if (!me1 || !me2)
212  return;
213  MonitorElement *me_eff;
214  if ((me1->kind() == MonitorElement::DQM_KIND_TH1F) && (me1->kind() == MonitorElement::DQM_KIND_TH1F)) {
215  TH1 *th1 = me1->getTH1F();
216  size_t nbinx = me1->getNbinsX();
217 
218  float xmin = th1->GetXaxis()->GetXmin();
219  float xmax = th1->GetXaxis()->GetXmax();
220  std::string xtit = me1->getAxisTitle(1);
221  std::string tit_new;
222  tit_new = ";" + xtit + ";Efficiency";
223 
224  ibooker.setCurrentFolder(folder);
225  me_eff = ibooker.book1D("efficiency_" + name, tit_new, nbinx, xmin, xmax);
226 
227  double efficiency;
228  me_eff->Reset();
229  me_eff->setEfficiencyFlag();
230  for (size_t ix = 1; ix < nbinx + 1; ++ix) {
231  float val1 = me1->getBinContent(ix);
232  float val2 = me2->getBinContent(ix);
233  if (val2 > 0.0)
234  efficiency = val1 / val2;
235  else
236  efficiency = 0;
237  me_eff->setBinContent(ix, efficiency);
238  }
239  }
240 }
void setBinContent(int binx, double content)
set content of bin (1-D)
TH1F * getTH1F() const
std::string getAxisTitle(int axis=1) const
get x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setEfficiencyFlag()
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void Reset()
reset ME (ie. contents, errors, etc)
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
double getBinContent(int binx) const
get content of bin (1-D)
int getNbinsX() const
get # of bins in X-axis
Kind kind() const
Get the type of the monitor element.
void PFClient_JetRes::createResolutionPlots ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter,
std::string &  folder,
std::string &  name 
)
private

Definition at line 70 of file PFClient_JetRes.cc.

References DQMStore::IBooker::book1D(), MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, DQMStore::IGetter::get(), getHistogramParameters(), MonitorElement::getNbinsY(), MonitorElement::getTH2F(), MonitorElement::kind(), SiStripPI::mean, PVValHelper::pT, PtBins_, SiStripPI::rms, MonitorElement::setBinContent(), MonitorElement::setBinError(), DQMStore::IBooker::setCurrentFolder(), MonitorElement::setEfficiencyFlag(), MonitorElement::setEntries(), AlCaHLTBitMon_QueryRunRegistry::string, fw3dlego::xbins, Phase2TrackerMonitorDigi_cff::ymax, and Phase2TrackerMonitorDigi_cff::ymin.

Referenced by doSummaries().

73  {
74  MonitorElement *me = igetter.get(folder + "/" + name);
75  if (!me)
76  return;
77 
78  MonitorElement *pT[PtBins_.size() - 1];
79  std::vector<double> pTEntries(PtBins_.size() - 1, 0);
80 
81  // std::vector<std::string> pTRange (PtBins_.size() -1) ;
82  // char* pTRange[PtBins_.size() -1] ;
83  std::vector<TString> pTRange(PtBins_.size() - 1);
84  // float pTCenter[PtBins_.size() -1] ;
85 
86  MonitorElement *me_average;
87  MonitorElement *me_rms;
88  MonitorElement *me_mean;
89  MonitorElement *me_sigma;
90 
93  TH2 *th = me->getTH2F();
94  // size_t nbinx = me->getNbinsX();
95  size_t nbinx = PtBins_.size() - 1;
96  size_t nbiny = me->getNbinsY();
97 
98  float ymin = th->GetYaxis()->GetXmin();
99  float ymax = th->GetYaxis()->GetXmax();
100  std::string xtit = th->GetXaxis()->GetTitle();
101  // std::string ytit = th->GetYaxis()->GetTitle();
102  std::string ytit = "#Deltap_{T}/p_{T}";
103 
104  float *xbins = new float[nbinx + 1];
105  for (size_t ix = 1; ix < nbinx + 1; ++ix) {
106  // xbins[ix-1] = th->GetBinLowEdge(ix);
107  xbins[ix - 1] = PtBins_[ix - 1];
108  // snprintf(pTRange[ix-1].data(), 15, "Pt%d_%d", PtBins_[ix-1],
109  // PtBins_[ix]);
110  pTRange[ix - 1] = TString::Format("Pt%d_%d", PtBins_[ix - 1], PtBins_[ix]);
111  if (name == "BRdelta_et_Over_et_VS_et_")
112  pTRange[ix - 1] = TString::Format("BRPt%d_%d", PtBins_[ix - 1], PtBins_[ix]);
113  else if (name == "ERdelta_et_Over_et_VS_et_")
114  pTRange[ix - 1] = TString::Format("ERPt%d_%d", PtBins_[ix - 1], PtBins_[ix]);
115 
116  // pTCenter[ix-1] = (PtBins_[ix] - PtBins_[ix-1]) / 2. ;
117  if (ix == nbinx) {
118  // xbins[ix] = th->GetXaxis()->GetBinUpEdge(ix);
119  xbins[ix] = PtBins_[ix];
120  }
121  }
122 
123  std::string tit_new;
124  ibooker.setCurrentFolder(folder);
125  // MonitorElement* me_slice = ibooker.book1D("PFlowSlice", "PFlowSlice",
126  // nbiny, ymin, ymax);
127 
128  tit_new = "Average " + ytit + ";" + xtit + ";Average_" + ytit;
129  me_average = ibooker.book1D("average_" + name, tit_new, nbinx, xbins);
130  me_average->setEfficiencyFlag();
131  tit_new = "RMS " + ytit + ";" + xtit + ";RMS_" + ytit;
132  me_rms = ibooker.book1D("rms_" + name, tit_new, nbinx, xbins);
133  me_rms->setEfficiencyFlag();
134  tit_new = ";" + xtit + ";Mean_" + ytit;
135  me_mean = ibooker.book1D("mean_" + name, tit_new, nbinx, xbins);
136  me_mean->setEfficiencyFlag();
137  tit_new = ";" + xtit + ";Sigma_" + ytit;
138  me_sigma = ibooker.book1D("sigma_" + name, tit_new, nbinx, xbins);
139  me_sigma->setEfficiencyFlag();
140 
141  double average, rms, mean, sigma;
142  for (size_t ix = 1; ix < nbinx + 1; ++ix) {
143  // me_slice->Reset();
144  if (name == "delta_et_Over_et_VS_et_")
145  pT[ix - 1] = ibooker.book1D(
146  pTRange[ix - 1], TString::Format("Total %s;%s;Events", ytit.data(), ytit.data()), nbiny, ymin, ymax);
147  if (name == "BRdelta_et_Over_et_VS_et_")
148  pT[ix - 1] = ibooker.book1D(
149  pTRange[ix - 1], TString::Format("Barrel %s;%s;Events", ytit.data(), ytit.data()), nbiny, ymin, ymax);
150  else if (name == "ERdelta_et_Over_et_VS_et_")
151  pT[ix - 1] = ibooker.book1D(
152  pTRange[ix - 1], TString::Format("Endcap %s;%s;Events", ytit.data(), ytit.data()), nbiny, ymin, ymax);
153 
154  for (size_t iy = 0; iy <= nbiny + 1; ++iy) // add under and overflow
155  if (th->GetBinContent(ix, iy)) {
156  // me_slice->setBinContent(iy,th->GetBinContent(ix,iy));
157  pT[ix - 1]->setBinContent(iy, th->GetBinContent(ix, iy));
158  pT[ix - 1]->setBinError(iy, th->GetBinError(ix, iy));
159  pTEntries[ix - 1] += th->GetBinContent(ix, iy);
160  }
161 
162  pT[ix - 1]->setEntries(pTEntries[ix - 1]);
163 
164  // getHistogramParameters(me_slice, average, rms, mean, sigma);
165  getHistogramParameters(pT[ix - 1], average, rms, mean, sigma);
166  me_average->setBinContent(ix, average);
167  me_rms->setBinContent(ix, rms);
168  me_mean->setBinContent(ix, mean);
169  me_sigma->setBinContent(ix, sigma);
170  }
171  // if (me_slice) igetter.removeElement(me_slice->getName());
172  delete[] xbins;
173  }
174 }
void setBinContent(int binx, double content)
set content of bin (1-D)
const double xbins[]
void setEfficiencyFlag()
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
void getHistogramParameters(MonitorElement *me_slice, double &avarage, double &rms, double &mean, double &sigma)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
void setEntries(double nentries)
set # of entries
TH2F * getTH2F() const
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
int getNbinsY() const
get # of bins in Y-axis
std::vector< int > PtBins_
Kind kind() const
Get the type of the monitor element.
void PFClient_JetRes::doEfficiency ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 54 of file PFClient_JetRes.cc.

References createEfficiencyPlots(), effHistogramNames_, folderNames_, callgraph::path, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmEndJob().

54  {
55  for (std::vector<std::string>::const_iterator ifolder = folderNames_.begin(); ifolder != folderNames_.end();
56  ifolder++) {
57  std::string path = "ParticleFlow/" + (*ifolder);
58 
59  for (std::vector<std::string>::const_iterator ihist = effHistogramNames_.begin(); ihist != effHistogramNames_.end();
60  ihist++) {
61  std::string hname = (*ihist);
62  createEfficiencyPlots(ibooker, igetter, path, hname);
63  }
64  }
65 }
void createEfficiencyPlots(DQMStore::IBooker &, DQMStore::IGetter &, std::string &folder, std::string &name)
std::vector< std::string > effHistogramNames_
std::vector< std::string > folderNames_
void PFClient_JetRes::doSummaries ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 38 of file PFClient_JetRes.cc.

References createResolutionPlots(), folderNames_, histogramNames_, callgraph::path, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by dqmEndJob().

38  {
39  for (std::vector<std::string>::const_iterator ifolder = folderNames_.begin(); ifolder != folderNames_.end();
40  ifolder++) {
41  std::string path = "ParticleFlow/" + (*ifolder);
42 
43  for (std::vector<std::string>::const_iterator ihist = histogramNames_.begin(); ihist != histogramNames_.end();
44  ihist++) {
45  std::string hname = (*ihist);
46  createResolutionPlots(ibooker, igetter, path, hname);
47  }
48  }
49 }
void createResolutionPlots(DQMStore::IBooker &, DQMStore::IGetter &, std::string &folder, std::string &name)
std::vector< std::string > folderNames_
std::vector< std::string > histogramNames_
void PFClient_JetRes::dqmEndJob ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
overrideprivatevirtual

Implements DQMEDHarvester.

Definition at line 29 of file PFClient_JetRes.cc.

References doEfficiency(), doSummaries(), and efficiencyFlag_.

29  {
30  doSummaries(ibooker, igetter);
31  if (efficiencyFlag_)
32  doEfficiency(ibooker, igetter);
33 }
void doSummaries(DQMStore::IBooker &, DQMStore::IGetter &)
void doEfficiency(DQMStore::IBooker &, DQMStore::IGetter &)
void PFClient_JetRes::getHistogramParameters ( MonitorElement me_slice,
double &  avarage,
double &  rms,
double &  mean,
double &  sigma 
)
private

Definition at line 179 of file PFClient_JetRes.cc.

References MonitorElement::DQM_KIND_TH1F, MonitorElement::getMean(), MonitorElement::getRMS(), MonitorElement::getTH1F(), and MonitorElement::kind().

Referenced by createResolutionPlots().

180  {
181  average = 0.0;
182  rms = 0.0;
183  mean = 0.0;
184  sigma = 0.0;
185 
186  if (!me_slice)
187  return;
188  if (me_slice->kind() == MonitorElement::DQM_KIND_TH1F) {
189  average = me_slice->getMean();
190  rms = me_slice->getRMS();
191  TH1F *th_slice = me_slice->getTH1F();
192  if (th_slice && th_slice->GetEntries() > 0) {
193  // need our own copy for thread safety
194  TF1 gaus("mygaus", "gaus");
195  th_slice->Fit(&gaus, "Q0 SERIAL");
196  sigma = gaus.GetParameter(2);
197  mean = gaus.GetParameter(1);
198  }
199  }
200 }
TH1F * getTH1F() const
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
Kind kind() const
Get the type of the monitor element.

Member Data Documentation

std::vector<std::string> PFClient_JetRes::effHistogramNames_
private

Definition at line 28 of file PFClient_JetRes.h.

Referenced by doEfficiency(), and PFClient_JetRes().

bool PFClient_JetRes::efficiencyFlag_
private

Definition at line 31 of file PFClient_JetRes.h.

Referenced by dqmEndJob(), and PFClient_JetRes().

std::vector<std::string> PFClient_JetRes::folderNames_
private

Definition at line 26 of file PFClient_JetRes.h.

Referenced by doEfficiency(), doSummaries(), and PFClient_JetRes().

std::vector<std::string> PFClient_JetRes::histogramNames_
private

Definition at line 27 of file PFClient_JetRes.h.

Referenced by doSummaries(), and PFClient_JetRes().

std::vector<int> PFClient_JetRes::PtBins_
private

Definition at line 29 of file PFClient_JetRes.h.

Referenced by createResolutionPlots(), and PFClient_JetRes().