CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes | Private Attributes
HResolution Class Reference

#include <Histograms.h>

Inheritance diagram for HResolution:

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

Public Member Functions

void Fill (double p, double pt, double eta, double phi, double rp, double rpt)
 
void Fill (double p, double pt, double eta, double phi, double rp, double rpt, double reta, double rphi, double rcharge)
 
void Fill (double rp, double rpt, double reta, double rphi, double rcharge)
 
Int_t Fill (Double_t x, Double_t y) override
 
 HResolution (const TString &name, const TString &title, const int totBins, const double &xMin, const double &xMax, const double &yMin, const double &yMax, TDirectory *dir=nullptr)
 
 HResolution (DQMStore::IBooker &ibooker, std::string dirName_, std::string name, std::string whereIs)
 
 HResolution (DQMStore::IBooker &ibooker, std::string name, TFile *file)
 
Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
 
 ~HResolution ()
 
 ~HResolution () override
 

Protected Attributes

TDirectory * diffDir_
 
TProfile * diffHisto_
 
TDirectory * dir2D_
 
TDirectory * dir_
 
TH2F * histo2D_
 
TH1F * resoHisto_
 

Private Attributes

MonitorElementh2Eta
 
MonitorElementh2EtaVsPhi
 
MonitorElementh2EtaVsPt
 
MonitorElementh2P
 
MonitorElementh2Phi
 
MonitorElementh2PhiVsEta
 
MonitorElementh2PhiVsPt
 
MonitorElementh2Pt
 
MonitorElementh2PtVsEta
 
MonitorElementh2PtVsPhi
 
MonitorElementhCharge
 
MonitorElementhEta
 
MonitorElementhP
 
MonitorElementhPhi
 
MonitorElementhPt
 
std::string theName
 
std::string where
 

Detailed Description

This histogram class can be used to evaluate the resolution of a variable. It has a TProfile, a TH2F and a TH1F. The TProfile is used to compute the rms of the distribution which is filled in the TH1F (the resolution histogram) in the Write method. If a TDirectory is passed to the constructor, the different histograms are placed in subdirectories.

Definition at line 1800 of file Histograms.h.

Member Typedef Documentation

◆ DQMStore

Definition at line 151 of file Histograms.h.

◆ MonitorElement

Definition at line 152 of file Histograms.h.

Constructor & Destructor Documentation

◆ HResolution() [1/3]

HResolution::HResolution ( const TString &  name,
const TString &  title,
const int  totBins,
const double &  xMin,
const double &  xMax,
const double &  yMin,
const double &  yMax,
TDirectory *  dir = nullptr 
)
inline

Definition at line 1802 of file Histograms.h.

1810  : dir_(dir), dir2D_(nullptr), diffDir_(nullptr) {
1811  if (dir_ != nullptr) {
1812  dir2D_ = (TDirectory*)dir_->Get("2D");
1813  if (dir2D_ == nullptr)
1814  dir2D_ = dir_->mkdir("2D");
1815  diffDir_ = (TDirectory*)dir_->Get("deltaXoverX");
1816  if (diffDir_ == nullptr)
1817  diffDir_ = dir->mkdir("deltaXoverX");
1818  }
1819  diffHisto_ = new TProfile(name + "_prof", title + " profile", totBins, xMin, xMax, yMin, yMax);
1820  histo2D_ = new TH2F(name + "2D", title, totBins, xMin, xMax, 4000, yMin, yMax);
1821  resoHisto_ = new TH1F(name, title, totBins, xMin, xMax);
1822  }

References diffDir_, diffHisto_, DeadROC_duringRun::dir, dir2D_, dir_, histo2D_, Skims_PA_cff::name, resoHisto_, runGCPTkAlMap::title, multiplicitycorr_cfi::xMax, photonAnalyzer_cfi::xMin, multiplicitycorr_cfi::yMax, and photonAnalyzer_cfi::yMin.

◆ ~HResolution() [1/2]

HResolution::~HResolution ( )
inlineoverride

Definition at line 1823 of file Histograms.h.

1823  {
1824  delete diffHisto_;
1825  delete histo2D_;
1826  delete resoHisto_;
1827  }

References diffHisto_, histo2D_, and resoHisto_.

◆ HResolution() [2/3]

HResolution::HResolution ( DQMStore::IBooker ibooker,
std::string  dirName_,
std::string  name,
std::string  whereIs 
)
inline

Definition at line 154 of file Histograms.h.

155  : theName(name), where(whereIs) {
156  ibooker.cd();
157  const std::string &dirName = dirName_;
158  //dirName+="/";
159  //dirName+=name.c_str();
160 
161  ibooker.setCurrentFolder(dirName);
162 
163  double eta = 15.;
164  int neta = 800;
165  double phi = 12.;
166  int nphi = 400;
167  double pt = 60.;
168  int npt = 2000;
169 
170  hEta = ibooker.book1D(theName + "_Eta_" + where, "#eta " + theName, neta, -eta, eta); // 400
171  hPhi = ibooker.book1D(theName + "_Phi_" + where, "#phi " + theName, nphi, -phi, phi); // 100
172 
173  hP = ibooker.book1D(theName + "_P_" + where, "P " + theName, 400, -4, 4); // 200
174  hPt = ibooker.book1D(theName + "_Pt_" + where, "P_{t} " + theName, npt, -pt, pt); // 200
175 
176  hCharge = ibooker.book1D(theName + "_charge_" + where, "Charge " + theName, 4, -2., 2.);
177 
178  h2Eta = ibooker.book2D(
179  theName + "_Eta_vs_Eta" + where, "#eta " + theName + " as a function of #eta", 200, -2.5, 2.5, neta, -eta, eta);
180  h2Phi = ibooker.book2D(theName + "_Phi_vs_Phi" + where,
181  "#phi " + theName + " as a function of #phi",
182  100,
183  -Geom::pi(),
184  Geom::pi(),
185  nphi,
186  -phi,
187  phi);
188 
189  h2P =
190  ibooker.book2D(theName + "_P_vs_P" + where, "P " + theName + " as a function of P", 1000, 0, 2000, 400, -4, 4);
191  h2Pt = ibooker.book2D(
192  theName + "_Pt_vs_Pt" + where, "P_{t} " + theName + " as a function of P_{t}", 1000, 0, 2000, npt, -pt, pt);
193 
194  h2PtVsEta = ibooker.book2D(
195  theName + "_Pt_vs_Eta" + where, "P_{t} " + theName + " as a function of #eta", 200, -2.5, 2.5, npt, -pt, pt);
196  h2PtVsPhi = ibooker.book2D(theName + "_Pt_vs_Phi" + where,
197  "P_{t} " + theName + " as a function of #phi",
198  100,
199  -Geom::pi(),
200  Geom::pi(),
201  npt,
202  -pt,
203  pt);
204 
205  h2EtaVsPt = ibooker.book2D(
206  theName + "_Eta_vs_Pt" + where, "#eta " + theName + " as a function of P_{t}", 1000, 0, 2000, neta, -eta, eta);
207  h2EtaVsPhi = ibooker.book2D(theName + "_Eta_vs_Phi" + where,
208  "#eta " + theName + " as a function of #phi",
209  100,
210  -Geom::pi(),
211  Geom::pi(),
212  neta,
213  -eta,
214  eta);
215 
216  h2PhiVsPt = ibooker.book2D(
217  theName + "_Phi_vs_Pt" + where, "#phi " + theName + " as a function of P_{t}", 1000, 0, 2000, nphi, -phi, phi);
218  h2PhiVsEta = ibooker.book2D(
219  theName + "_Phi_vs_Eta" + where, "#phi " + theName + " as a function of #eta", 200, -2.5, 2.5, nphi, -phi, phi);
220  }

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::NavigatorBase::cd(), TrackerOfflineValidation_Dqm_cff::dirName, PVValHelper::eta, h2Eta, h2EtaVsPhi, h2EtaVsPt, h2P, h2Phi, h2PhiVsEta, h2PhiVsPt, h2Pt, h2PtVsEta, h2PtVsPhi, hCharge, hEta, hP, hPhi, hPt, neta, nphi, phi, Geom::pi(), DiDispStaMuonMonitor_cfi::pt, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, theName, and where.

◆ HResolution() [3/3]

HResolution::HResolution ( DQMStore::IBooker ibooker,
std::string  name,
TFile *  file 
)
inline

Definition at line 222 of file Histograms.h.

222  : theName(name) {
223  // dynamic_cast<TH1F*>( file->Get(theName+"") );
224  }

◆ ~HResolution() [2/2]

HResolution::~HResolution ( )
inline

Definition at line 226 of file Histograms.h.

226 {}

Member Function Documentation

◆ Fill() [1/4]

void HResolution::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  rp,
double  rpt 
)
inline

Definition at line 248 of file Histograms.h.

248  {
249  hP->Fill(rp);
250  hPt->Fill(rpt);
251 
252  h2P->Fill(p, rp);
253  // h2PVsEta->Fill(eta,rp);
254  // h2PVsPhi->Fill(phi,rp);
255 
256  h2Pt->Fill(pt, rpt);
257  h2PtVsEta->Fill(eta, rpt);
258  h2PtVsPhi->Fill(phi, rpt);
259  }

References PVValHelper::eta, dqm::impl::MonitorElement::Fill(), h2P, h2Pt, h2PtVsEta, h2PtVsPhi, hP, hPt, AlCaHLTBitMon_ParallelJobs::p, phi, and DiDispStaMuonMonitor_cfi::pt.

◆ Fill() [2/4]

void HResolution::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  rp,
double  rpt,
double  reta,
double  rphi,
double  rcharge 
)
inline

Definition at line 228 of file Histograms.h.

229  {
230  Fill(rp, rpt, reta, rphi, rcharge);
231 
232  h2Eta->Fill(eta, reta);
233  h2Phi->Fill(phi, rphi);
234 
235  h2P->Fill(p, rp);
236  h2Pt->Fill(pt, rpt);
237 
238  h2PtVsEta->Fill(eta, rpt);
239  h2PtVsPhi->Fill(phi, rpt);
240 
241  h2EtaVsPt->Fill(pt, reta);
242  h2EtaVsPhi->Fill(phi, reta);
243 
244  h2PhiVsPt->Fill(pt, rphi);
245  h2PhiVsEta->Fill(eta, rphi);
246  }

References PVValHelper::eta, dqm::impl::MonitorElement::Fill(), Fill(), h2Eta, h2EtaVsPhi, h2EtaVsPt, h2P, h2Phi, h2PhiVsEta, h2PhiVsPt, h2Pt, h2PtVsEta, h2PtVsPhi, AlCaHLTBitMon_ParallelJobs::p, phi, and DiDispStaMuonMonitor_cfi::pt.

◆ Fill() [3/4]

void HResolution::Fill ( double  rp,
double  rpt,
double  reta,
double  rphi,
double  rcharge 
)
inline

Definition at line 261 of file Histograms.h.

261  {
262  hEta->Fill(reta);
263  hPhi->Fill(rphi);
264 
265  hP->Fill(rp);
266  hPt->Fill(rpt);
267 
268  hCharge->Fill(rcharge);
269  }

References dqm::impl::MonitorElement::Fill(), hCharge, hEta, hP, hPhi, and hPt.

◆ Fill() [4/4]

Int_t HResolution::Fill ( Double_t  x,
Double_t  y 
)
inlineoverride

Definition at line 1828 of file Histograms.h.

1828  {
1829  diffHisto_->Fill(x, y);
1830  histo2D_->Fill(x, y);
1831  return 0;
1832  }

References diffHisto_, histo2D_, x, and y.

Referenced by HTrack::computePull(), HTrack::computeResolution(), HTrack::computeTDRResolution(), and Fill().

◆ Write()

Int_t HResolution::Write ( const char *  name = nullptr,
Int_t  option = 0,
Int_t  bufsize = 0 
)
inlineoverride

Definition at line 1833 of file Histograms.h.

1833  {
1834  // Loop on all the bins and take the rms.
1835  // The TProfile bin error is by default the standard error on the mean, that is
1836  // rms/sqrt(N). If it is created with the "S" option (as we did NOT do), it would
1837  // already be the rms. Thus we take the error and multiply it by the sqrt of the
1838  // bin entries to get the rms.
1839  // bin 0 is the underflow, bin totBins+1 is the overflow.
1840  unsigned int totBins = diffHisto_->GetNbinsX();
1841  // std::cout << "totBins = " << totBins << std::endl;
1842  for (unsigned int iBin = 1; iBin <= totBins; ++iBin) {
1843  // std::cout << "iBin = " << iBin << ", " << diffHisto_->GetBinError(iBin)*sqrt(diffHisto_->GetBinEntries(iBin)) << std::endl;
1844  resoHisto_->SetBinContent(iBin, diffHisto_->GetBinError(iBin) * sqrt(diffHisto_->GetBinEntries(iBin)));
1845  }
1846  if (dir_ != nullptr)
1847  dir_->cd();
1848  resoHisto_->Write();
1849  if (diffDir_ != nullptr)
1850  diffDir_->cd();
1851  diffHisto_->Write();
1852  if (dir2D_ != nullptr)
1853  dir2D_->cd();
1854  histo2D_->Write();
1855 
1856  return 0;
1857  }

References diffDir_, diffHisto_, dir2D_, dir_, histo2D_, resoHisto_, and mathSSE::sqrt().

Member Data Documentation

◆ diffDir_

TDirectory* HResolution::diffDir_
protected

Definition at line 1862 of file Histograms.h.

Referenced by HResolution(), and Write().

◆ diffHisto_

TProfile* HResolution::diffHisto_
protected

Definition at line 1863 of file Histograms.h.

Referenced by Fill(), HResolution(), Write(), and ~HResolution().

◆ dir2D_

TDirectory* HResolution::dir2D_
protected

Definition at line 1861 of file Histograms.h.

Referenced by HResolution(), and Write().

◆ dir_

TDirectory* HResolution::dir_
protected

Definition at line 1860 of file Histograms.h.

Referenced by HResolution(), and Write().

◆ h2Eta

MonitorElement* HResolution::h2Eta
private

Definition at line 283 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2EtaVsPhi

MonitorElement* HResolution::h2EtaVsPhi
private

Definition at line 293 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2EtaVsPt

MonitorElement* HResolution::h2EtaVsPt
private

Definition at line 292 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2P

MonitorElement* HResolution::h2P
private

Definition at line 286 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2Phi

MonitorElement* HResolution::h2Phi
private

Definition at line 284 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2PhiVsEta

MonitorElement* HResolution::h2PhiVsEta
private

Definition at line 296 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2PhiVsPt

MonitorElement* HResolution::h2PhiVsPt
private

Definition at line 295 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2Pt

MonitorElement* HResolution::h2Pt
private

Definition at line 287 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2PtVsEta

MonitorElement* HResolution::h2PtVsEta
private

Definition at line 289 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ h2PtVsPhi

MonitorElement* HResolution::h2PtVsPhi
private

Definition at line 290 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ hCharge

MonitorElement* HResolution::hCharge
private

Definition at line 281 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ hEta

MonitorElement* HResolution::hEta
private

Definition at line 275 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ histo2D_

TH2F* HResolution::histo2D_
protected

Definition at line 1864 of file Histograms.h.

Referenced by Fill(), HResolution(), Write(), and ~HResolution().

◆ hP

MonitorElement* HResolution::hP
private

Definition at line 278 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ hPhi

MonitorElement* HResolution::hPhi
private

Definition at line 276 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ hPt

MonitorElement* HResolution::hPt
private

Definition at line 279 of file Histograms.h.

Referenced by Fill(), and HResolution().

◆ resoHisto_

TH1F* HResolution::resoHisto_
protected

Definition at line 1865 of file Histograms.h.

Referenced by HResolution(), Write(), and ~HResolution().

◆ theName

std::string HResolution::theName
private

Definition at line 272 of file Histograms.h.

Referenced by HResolution().

◆ where

std::string HResolution::where
private

Definition at line 273 of file Histograms.h.

Referenced by HResolution().

DDAxes::y
neta
const int neta
Definition: CMTRawAnalyzer.h:423
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
HResolution::where
std::string where
Definition: Histograms.h:273
HResolution::hPt
MonitorElement * hPt
Definition: Histograms.h:279
HResolution::h2PhiVsPt
MonitorElement * h2PhiVsPt
Definition: Histograms.h:295
HResolution::dir2D_
TDirectory * dir2D_
Definition: Histograms.h:1861
HResolution::h2Eta
MonitorElement * h2Eta
Definition: Histograms.h:283
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HResolution::h2P
MonitorElement * h2P
Definition: Histograms.h:286
HResolution::theName
std::string theName
Definition: Histograms.h:272
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
HResolution::hCharge
MonitorElement * hCharge
Definition: Histograms.h:281
photonAnalyzer_cfi.yMin
yMin
Definition: photonAnalyzer_cfi.py:86
DDAxes::x
HResolution::hP
MonitorElement * hP
Definition: Histograms.h:278
HResolution::dir_
TDirectory * dir_
Definition: Histograms.h:1860
photonAnalyzer_cfi.xMin
xMin
Definition: photonAnalyzer_cfi.py:82
nphi
const int nphi
Definition: CMTRawAnalyzer.h:424
HResolution::Fill
Int_t Fill(Double_t x, Double_t y) override
Definition: Histograms.h:1828
PVValHelper::eta
Definition: PVValidationHelpers.h:70
HResolution::h2Pt
MonitorElement * h2Pt
Definition: Histograms.h:287
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
HResolution::hPhi
MonitorElement * hPhi
Definition: Histograms.h:276
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
HResolution::h2PhiVsEta
MonitorElement * h2PhiVsEta
Definition: Histograms.h:296
Geom::pi
constexpr double pi()
Definition: Pi.h:31
HResolution::resoHisto_
TH1F * resoHisto_
Definition: Histograms.h:1865
multiplicitycorr_cfi.yMax
yMax
Definition: multiplicitycorr_cfi.py:6
HResolution::diffDir_
TDirectory * diffDir_
Definition: Histograms.h:1862
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HResolution::h2Phi
MonitorElement * h2Phi
Definition: Histograms.h:284
HResolution::h2EtaVsPt
MonitorElement * h2EtaVsPt
Definition: Histograms.h:292
DDAxes::phi
HResolution::histo2D_
TH2F * histo2D_
Definition: Histograms.h:1864
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
HResolution::h2PtVsEta
MonitorElement * h2PtVsEta
Definition: Histograms.h:289
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
multiplicitycorr_cfi.xMax
xMax
Definition: multiplicitycorr_cfi.py:5
HResolution::diffHisto_
TProfile * diffHisto_
Definition: Histograms.h:1863
HResolution::h2PtVsPhi
MonitorElement * h2PtVsPhi
Definition: Histograms.h:290
HResolution::h2EtaVsPhi
MonitorElement * h2EtaVsPhi
Definition: Histograms.h:293
HResolution::hEta
MonitorElement * hEta
Definition: Histograms.h:275
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23