CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 PFClient_JetRes (const edm::ParameterSet &parameterSet)
 
- Public Member Functions inherited from DQMEDHarvester
virtual void analyze (edm::Event const &, edm::EventSetup const &) final
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDHarvester (void)
 
virtual void dqmEndLuminosityBlock (DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endJob () final
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns, edm::one::WatchLuminosityBlocks, edm::one::SharedResources >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
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 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)
 

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 20 of file PFClient_JetRes.cc.

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

21 {
22  folderNames_ = parameterSet.getParameter< std::vector<std::string> >( "FolderNames" );
23  histogramNames_ = parameterSet.getParameter< std::vector<std::string> >( "HistogramNames" );
24  efficiencyFlag_ = parameterSet.getParameter< bool> ("CreateEfficiencyPlots" );
25  effHistogramNames_ = parameterSet.getParameter< std::vector<std::string> >( "HistogramNamesForEfficiencyPlots" );
26  PtBins_ = parameterSet.getParameter< std::vector<int> >( "VariablePtBins" ) ;
27 }
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 200 of file PFClient_JetRes.cc.

References DQMStore::IBooker::book1D(), MonitorElement::DQM_KIND_TH1F, postValidation_cfi::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, value::val1, value::val2, SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

Referenced by doEfficiency().

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

Definition at line 78 of file PFClient_JetRes.cc.

References PDRates::average, 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(), timingPdfMaker::mean, PtBins_, plotscripts::rms(), MonitorElement::setBinContent(), MonitorElement::setBinError(), DQMStore::IBooker::setCurrentFolder(), MonitorElement::setEfficiencyFlag(), MonitorElement::setEntries(), AlCaHLTBitMon_QueryRunRegistry::string, fw3dlego::xbins, SiStripMonitorClusterAlca_cfi::ymax, and SiStripMonitorClusterAlca_cfi::ymin.

Referenced by doSummaries().

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

Definition at line 61 of file PFClient_JetRes.cc.

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

Referenced by dqmEndJob().

61  {
62  for (std::vector<std::string>::const_iterator ifolder = folderNames_.begin();
63  ifolder != folderNames_.end(); ifolder++) {
64  std::string path = "ParticleFlow/"+(*ifolder);
65 
66  for (std::vector<std::string>::const_iterator ihist = effHistogramNames_.begin();
67  ihist != effHistogramNames_.end(); ihist++) {
68  std::string hname = (*ihist);
69  createEfficiencyPlots(ibooker, igetter, path, hname);
70  }
71  }
72 }
void createEfficiencyPlots(DQMStore::IBooker &, DQMStore::IGetter &, std::string &folder, std::string &name)
tuple path
else: Piece not in the list, fine.
std::vector< std::string > effHistogramNames_
std::vector< std::string > folderNames_
void PFClient_JetRes::doSummaries ( DQMStore::IBooker ibooker,
DQMStore::IGetter igetter 
)
private

Definition at line 43 of file PFClient_JetRes.cc.

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

Referenced by dqmEndJob().

43  {
44 
45  for (std::vector<std::string>::const_iterator ifolder = folderNames_.begin();
46  ifolder != folderNames_.end(); ifolder++) {
47  std::string path = "ParticleFlow/"+(*ifolder);
48 
49  for (std::vector<std::string>::const_iterator ihist = histogramNames_.begin();
50  ihist != histogramNames_.end(); ihist++) {
51  std::string hname = (*ihist);
52  createResolutionPlots(ibooker, igetter, path, hname);
53  }
54  }
55 }
void createResolutionPlots(DQMStore::IBooker &, DQMStore::IGetter &, std::string &folder, std::string &name)
tuple path
else: Piece not in the list, fine.
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 33 of file PFClient_JetRes.cc.

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

34 {
35  doSummaries(ibooker, igetter);
36  if (efficiencyFlag_) doEfficiency(ibooker, igetter);
37 }
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 174 of file PFClient_JetRes.cc.

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

Referenced by createResolutionPlots().

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

Member Data Documentation

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

Definition at line 30 of file PFClient_JetRes.h.

Referenced by doEfficiency(), and PFClient_JetRes().

bool PFClient_JetRes::efficiencyFlag_
private

Definition at line 33 of file PFClient_JetRes.h.

Referenced by dqmEndJob(), and PFClient_JetRes().

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

Definition at line 28 of file PFClient_JetRes.h.

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

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

Definition at line 29 of file PFClient_JetRes.h.

Referenced by doSummaries(), and PFClient_JetRes().

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

Definition at line 31 of file PFClient_JetRes.h.

Referenced by createResolutionPlots(), and PFClient_JetRes().