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

Definition at line 151 of file Histograms.h.

Definition at line 152 of file Histograms.h.

Constructor & Destructor Documentation

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 = 0 
)
inline

Definition at line 1802 of file Histograms.h.

References DeadROC_duringRun::dir, and sistrip::dir_.

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  }
TDirectory * dir2D_
Definition: Histograms.h:1861
TDirectory * dir_
Definition: Histograms.h:1860
TDirectory * diffDir_
Definition: Histograms.h:1862
TH1F * resoHisto_
Definition: Histograms.h:1865
TH2F * histo2D_
Definition: Histograms.h:1864
TProfile * diffHisto_
Definition: Histograms.h:1863
HResolution::~HResolution ( )
inlineoverride

Definition at line 1823 of file Histograms.h.

1823  {
1824  delete diffHisto_;
1825  delete histo2D_;
1826  delete resoHisto_;
1827  }
TH1F * resoHisto_
Definition: Histograms.h:1865
TH2F * histo2D_
Definition: Histograms.h:1864
TProfile * diffHisto_
Definition: Histograms.h:1863
HResolution::HResolution ( DQMStore::IBooker ibooker,
std::string  dirName_,
std::string  name,
std::string  whereIs 
)
inline

Definition at line 154 of file Histograms.h.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::book2D(), dqm::dqmstoreimpl::DQMStore::IBooker::cd(), TrackerOfflineValidation_Dqm_cff::dirName, HTrackVariables::eta(), HTrackVariables::hCharge, HTrackVariables::hEta, HTrackVariables::hP, HTrackVariables::hPhi, HTrackVariables::hPt, HTrackVariables::phi(), Geom::pi(), HTrackVariables::pt(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, HTrackVariables::theName, and HTrackVariables::where.

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  }
MonitorElement * h2PhiVsPt
Definition: Histograms.h:295
MonitorElement * h2Eta
Definition: Histograms.h:283
MonitorElement * h2EtaVsPhi
Definition: Histograms.h:293
std::string where
Definition: Histograms.h:273
MonitorElement * hP
Definition: Histograms.h:278
MonitorElement * hPt
Definition: Histograms.h:279
MonitorElement * h2P
Definition: Histograms.h:286
MonitorElement * hCharge
Definition: Histograms.h:281
MonitorElement * hPhi
Definition: Histograms.h:276
MonitorElement * h2PhiVsEta
Definition: Histograms.h:296
std::string theName
Definition: Histograms.h:272
MonitorElement * h2Phi
Definition: Histograms.h:284
MonitorElement * h2Pt
Definition: Histograms.h:287
MonitorElement * h2EtaVsPt
Definition: Histograms.h:292
MonitorElement * h2PtVsPhi
Definition: Histograms.h:290
constexpr double pi()
Definition: Pi.h:31
MonitorElement * hEta
Definition: Histograms.h:275
MonitorElement * h2PtVsEta
Definition: Histograms.h:289
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  }
std::string theName
Definition: Histograms.h:272
HResolution::~HResolution ( )
inline

Definition at line 226 of file Histograms.h.

226 {}

Member Function Documentation

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.

References HTrackVariables::Fill().

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  }
MonitorElement * h2PhiVsPt
Definition: Histograms.h:295
MonitorElement * h2Eta
Definition: Histograms.h:283
MonitorElement * h2EtaVsPhi
Definition: Histograms.h:293
MonitorElement * h2P
Definition: Histograms.h:286
MonitorElement * h2PhiVsEta
Definition: Histograms.h:296
void Fill(long long x)
MonitorElement * h2Phi
Definition: Histograms.h:284
Int_t Fill(Double_t x, Double_t y) override
Definition: Histograms.h:1828
MonitorElement * h2Pt
Definition: Histograms.h:287
MonitorElement * h2EtaVsPt
Definition: Histograms.h:292
MonitorElement * h2PtVsPhi
Definition: Histograms.h:290
MonitorElement * h2PtVsEta
Definition: Histograms.h:289
void HResolution::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  rp,
double  rpt 
)
inline

Definition at line 248 of file Histograms.h.

References dqm::impl::MonitorElement::Fill(), HTrackVariables::hP, and HTrackVariables::hPt.

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  }
MonitorElement * hP
Definition: Histograms.h:278
MonitorElement * hPt
Definition: Histograms.h:279
MonitorElement * h2P
Definition: Histograms.h:286
void Fill(long long x)
MonitorElement * h2Pt
Definition: Histograms.h:287
MonitorElement * h2PtVsPhi
Definition: Histograms.h:290
MonitorElement * h2PtVsEta
Definition: Histograms.h:289
void HResolution::Fill ( double  rp,
double  rpt,
double  reta,
double  rphi,
double  rcharge 
)
inline

Definition at line 261 of file Histograms.h.

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

261  {
262  hEta->Fill(reta);
263  hPhi->Fill(rphi);
264 
265  hP->Fill(rp);
266  hPt->Fill(rpt);
267 
268  hCharge->Fill(rcharge);
269  }
MonitorElement * hP
Definition: Histograms.h:278
MonitorElement * hPt
Definition: Histograms.h:279
MonitorElement * hCharge
Definition: Histograms.h:281
MonitorElement * hPhi
Definition: Histograms.h:276
void Fill(long long x)
MonitorElement * hEta
Definition: Histograms.h:275
Int_t HResolution::Fill ( Double_t  x,
Double_t  y 
)
inlineoverride

Definition at line 1828 of file Histograms.h.

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

1828  {
1829  diffHisto_->Fill(x, y);
1830  histo2D_->Fill(x, y);
1831  return 0;
1832  }
TH2F * histo2D_
Definition: Histograms.h:1864
TProfile * diffHisto_
Definition: Histograms.h:1863
Int_t HResolution::Write ( const char *  name = 0,
Int_t  option = 0,
Int_t  bufsize = 0 
)
inlineoverride

Definition at line 1833 of file Histograms.h.

References sistrip::dir_, and mathSSE::sqrt().

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  }
TDirectory * dir2D_
Definition: Histograms.h:1861
T sqrt(T t)
Definition: SSEVec.h:19
TDirectory * dir_
Definition: Histograms.h:1860
TDirectory * diffDir_
Definition: Histograms.h:1862
TH1F * resoHisto_
Definition: Histograms.h:1865
TH2F * histo2D_
Definition: Histograms.h:1864
TProfile * diffHisto_
Definition: Histograms.h:1863

Member Data Documentation

TDirectory* HResolution::diffDir_
protected

Definition at line 1862 of file Histograms.h.

TProfile* HResolution::diffHisto_
protected

Definition at line 1863 of file Histograms.h.

TDirectory* HResolution::dir2D_
protected

Definition at line 1861 of file Histograms.h.

TDirectory* HResolution::dir_
protected

Definition at line 1860 of file Histograms.h.

MonitorElement* HResolution::h2Eta
private

Definition at line 283 of file Histograms.h.

MonitorElement* HResolution::h2EtaVsPhi
private

Definition at line 293 of file Histograms.h.

MonitorElement* HResolution::h2EtaVsPt
private

Definition at line 292 of file Histograms.h.

MonitorElement* HResolution::h2P
private

Definition at line 286 of file Histograms.h.

MonitorElement* HResolution::h2Phi
private

Definition at line 284 of file Histograms.h.

MonitorElement* HResolution::h2PhiVsEta
private

Definition at line 296 of file Histograms.h.

MonitorElement* HResolution::h2PhiVsPt
private

Definition at line 295 of file Histograms.h.

MonitorElement* HResolution::h2Pt
private

Definition at line 287 of file Histograms.h.

MonitorElement* HResolution::h2PtVsEta
private

Definition at line 289 of file Histograms.h.

MonitorElement* HResolution::h2PtVsPhi
private

Definition at line 290 of file Histograms.h.

MonitorElement* HResolution::hCharge
private

Definition at line 281 of file Histograms.h.

MonitorElement* HResolution::hEta
private

Definition at line 275 of file Histograms.h.

TH2F* HResolution::histo2D_
protected

Definition at line 1864 of file Histograms.h.

MonitorElement* HResolution::hP
private

Definition at line 278 of file Histograms.h.

MonitorElement* HResolution::hPhi
private

Definition at line 276 of file Histograms.h.

MonitorElement* HResolution::hPt
private

Definition at line 279 of file Histograms.h.

TH1F* HResolution::resoHisto_
protected

Definition at line 1865 of file Histograms.h.

std::string HResolution::theName
private

Definition at line 272 of file Histograms.h.

std::string HResolution::where
private

Definition at line 273 of file Histograms.h.