CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes | Private Attributes
HResolution Class Reference

#include <Histograms.h>

Inheritance diagram for HResolution:

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)
 
virtual Int_t Fill (Double_t x, Double_t y)
 
 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)
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 
 ~HResolution ()
 
 ~HResolution ()
 

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 1715 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 1717 of file Histograms.h.

References diffDir_, diffHisto_, dir, dir2D_, dir_, histo2D_, and resoHisto_.

1719  :
1720  dir_(dir),
1721  dir2D_(0),
1722  diffDir_(0)
1723  {
1724  if( dir_ != 0 ) {
1725  dir2D_ = (TDirectory*) dir_->Get("2D");
1726  if(dir2D_ == 0) dir2D_ = dir_->mkdir("2D");
1727  diffDir_ = (TDirectory*) dir_->Get("deltaXoverX");
1728  if(diffDir_ == 0) diffDir_ = dir->mkdir("deltaXoverX");
1729  }
1730  diffHisto_ = new TProfile(name+"_prof", title+" profile", totBins, xMin, xMax, yMin, yMax);
1731  histo2D_ = new TH2F(name+"2D", title, totBins, xMin, xMax, 4000, yMin, yMax);
1732  resoHisto_ = new TH1F(name, title, totBins, xMin, xMax);
1733  }
TDirectory * dir2D_
Definition: Histograms.h:1768
TDirectory * dir_
Definition: Histograms.h:1767
TDirectory * diffDir_
Definition: Histograms.h:1769
TH1F * resoHisto_
Definition: Histograms.h:1772
dbl *** dir
Definition: mlp_gen.cc:35
TH2F * histo2D_
Definition: Histograms.h:1771
TProfile * diffHisto_
Definition: Histograms.h:1770
HResolution::~HResolution ( )
inline

Definition at line 1734 of file Histograms.h.

References diffHisto_, histo2D_, and resoHisto_.

1734  {
1735  delete diffHisto_;
1736  delete histo2D_;
1737  delete resoHisto_;
1738  }
TH1F * resoHisto_
Definition: Histograms.h:1772
TH2F * histo2D_
Definition: Histograms.h:1771
TProfile * diffHisto_
Definition: Histograms.h:1770
HResolution::HResolution ( DQMStore::IBooker ibooker,
std::string  dirName_,
std::string  name,
std::string  whereIs 
)
inline

Definition at line 162 of file Histograms.h.

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

162  :theName(name.c_str()),where(whereIs.c_str()){
163 
164  ibooker.cd();
165  std::string dirName=dirName_;
166  //dirName+="/";
167  //dirName+=name.c_str();
168 
169  ibooker.setCurrentFolder(dirName.c_str());
170 
171  double eta = 15.; int neta = 800;
172  double phi = 12.; int nphi = 400;
173  double pt = 60.; int npt = 2000;
174 
175  hEta = ibooker.book1D(theName+"_Eta_"+where,"#eta "+theName,neta,-eta,eta); // 400
176  hPhi = ibooker.book1D(theName+"_Phi_"+where,"#phi "+theName,nphi,-phi,phi); // 100
177 
178  hP = ibooker.book1D(theName+"_P_"+where,"P "+theName,400,-4,4); // 200
179  hPt = ibooker.book1D(theName+"_Pt_"+where,"P_{t} "+theName,npt,-pt,pt); // 200
180 
181  hCharge = ibooker.book1D(theName+"_charge_"+where,"Charge "+theName,4,-2.,2.);
182 
183 
184  h2Eta = ibooker.book2D(theName+"_Eta_vs_Eta"+where,"#eta "+theName+" as a function of #eta",200,-2.5,2.5,neta,-eta,eta);
185  h2Phi = ibooker.book2D(theName+"_Phi_vs_Phi"+where,"#phi "+theName+" as a function of #phi",100,-Geom::pi(),Geom::pi(),nphi,-phi,phi);
186 
187  h2P = ibooker.book2D(theName+"_P_vs_P"+where,"P "+theName+" as a function of P",1000,0,2000,400,-4,4);
188  h2Pt = ibooker.book2D(theName+"_Pt_vs_Pt"+where,"P_{t} "+theName+" as a function of P_{t}",1000,0,2000,npt,-pt,pt);
189 
190  h2PtVsEta = ibooker.book2D(theName+"_Pt_vs_Eta"+where,"P_{t} "+theName+" as a function of #eta",200,-2.5,2.5,npt,-pt,pt);
191  h2PtVsPhi = ibooker.book2D(theName+"_Pt_vs_Phi"+where,"P_{t} "+theName+" as a function of #phi",100,-Geom::pi(),Geom::pi(),npt,-pt,pt);
192 
193  h2EtaVsPt = ibooker.book2D(theName+"_Eta_vs_Pt"+where,"#eta "+theName+" as a function of P_{t}",1000,0,2000,neta,-eta,eta);
194  h2EtaVsPhi = ibooker.book2D(theName+"_Eta_vs_Phi"+where,"#eta "+theName+" as a function of #phi",100,-Geom::pi(),Geom::pi(),neta,-eta,eta);
195 
196  h2PhiVsPt = ibooker.book2D(theName+"_Phi_vs_Pt"+where,"#phi "+theName+" as a function of P_{t}",1000,0,2000,nphi,-phi,phi);
197  h2PhiVsEta = ibooker.book2D(theName+"_Phi_vs_Eta"+where,"#phi "+theName+" as a function of #eta",200,-2.5,2.5,nphi,-phi,phi);
198  }
MonitorElement * h2PhiVsPt
Definition: Histograms.h:284
MonitorElement * h2Eta
Definition: Histograms.h:272
MonitorElement * h2EtaVsPhi
Definition: Histograms.h:282
std::string where
Definition: Histograms.h:262
MonitorElement * hP
Definition: Histograms.h:267
void cd(void)
Definition: DQMStore.cc:266
MonitorElement * hPt
Definition: Histograms.h:268
MonitorElement * h2P
Definition: Histograms.h:275
MonitorElement * hCharge
Definition: Histograms.h:270
MonitorElement * hPhi
Definition: Histograms.h:265
T eta() const
MonitorElement * h2PhiVsEta
Definition: Histograms.h:285
std::string theName
Definition: Histograms.h:261
MonitorElement * h2Phi
Definition: Histograms.h:273
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:112
MonitorElement * h2Pt
Definition: Histograms.h:276
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:130
double pi()
Definition: Pi.h:31
MonitorElement * h2EtaVsPt
Definition: Histograms.h:281
MonitorElement * h2PtVsPhi
Definition: Histograms.h:279
MonitorElement * hEta
Definition: Histograms.h:264
MonitorElement * h2PtVsEta
Definition: Histograms.h:278
Definition: DDAxes.h:10
HResolution::HResolution ( DQMStore::IBooker ibooker,
std::string  name,
TFile *  file 
)
inline

Definition at line 200 of file Histograms.h.

200  :theName(name.c_str()){
201  // dynamic_cast<TH1F*>( file->Get(theName+"") );
202  }
std::string theName
Definition: Histograms.h:261
HResolution::~HResolution ( )
inline

Definition at line 204 of file Histograms.h.

204 {}

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 207 of file Histograms.h.

References MonitorElement::Fill(), Fill(), h2Eta, h2EtaVsPhi, h2EtaVsPt, h2P, h2Phi, h2PhiVsEta, h2PhiVsPt, h2Pt, h2PtVsEta, and h2PtVsPhi.

208  {
209 
210  Fill(rp, rpt, reta, rphi, rcharge);
211 
212 
213  h2Eta->Fill(eta,reta);
214  h2Phi->Fill(phi,rphi);
215 
216  h2P->Fill(p,rp);
217  h2Pt->Fill(pt,rpt);
218 
219  h2PtVsEta->Fill(eta,rpt);
220  h2PtVsPhi->Fill(phi,rpt);
221 
222  h2EtaVsPt ->Fill(pt,reta);
223  h2EtaVsPhi->Fill(phi,reta);
224 
225  h2PhiVsPt ->Fill(pt,rphi);
226  h2PhiVsEta->Fill(eta,rphi);
227  }
MonitorElement * h2PhiVsPt
Definition: Histograms.h:284
MonitorElement * h2Eta
Definition: Histograms.h:272
MonitorElement * h2EtaVsPhi
Definition: Histograms.h:282
MonitorElement * h2P
Definition: Histograms.h:275
T eta() const
MonitorElement * h2PhiVsEta
Definition: Histograms.h:285
void Fill(long long x)
MonitorElement * h2Phi
Definition: Histograms.h:273
MonitorElement * h2Pt
Definition: Histograms.h:276
MonitorElement * h2EtaVsPt
Definition: Histograms.h:281
MonitorElement * h2PtVsPhi
Definition: Histograms.h:279
virtual Int_t Fill(Double_t x, Double_t y)
Definition: Histograms.h:1739
MonitorElement * h2PtVsEta
Definition: Histograms.h:278
Definition: DDAxes.h:10
void HResolution::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  rp,
double  rpt 
)
inline

Definition at line 230 of file Histograms.h.

References MonitorElement::Fill(), h2P, h2Pt, h2PtVsEta, h2PtVsPhi, hP, and hPt.

231  {
232 
233  hP->Fill(rp);
234  hPt->Fill(rpt);
235 
236  h2P->Fill(p,rp);
237  // h2PVsEta->Fill(eta,rp);
238  // h2PVsPhi->Fill(phi,rp);
239 
240  h2Pt->Fill(pt,rpt);
241  h2PtVsEta->Fill(eta,rpt);
242  h2PtVsPhi->Fill(phi,rpt);
243  }
MonitorElement * hP
Definition: Histograms.h:267
MonitorElement * hPt
Definition: Histograms.h:268
MonitorElement * h2P
Definition: Histograms.h:275
T eta() const
void Fill(long long x)
MonitorElement * h2Pt
Definition: Histograms.h:276
MonitorElement * h2PtVsPhi
Definition: Histograms.h:279
MonitorElement * h2PtVsEta
Definition: Histograms.h:278
Definition: DDAxes.h:10
void HResolution::Fill ( double  rp,
double  rpt,
double  reta,
double  rphi,
double  rcharge 
)
inline

Definition at line 245 of file Histograms.h.

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

246  {
247 
248  hEta->Fill(reta);
249  hPhi->Fill(rphi);
250 
251  hP->Fill(rp);
252  hPt->Fill(rpt);
253 
254  hCharge->Fill(rcharge);
255  }
MonitorElement * hP
Definition: Histograms.h:267
MonitorElement * hPt
Definition: Histograms.h:268
MonitorElement * hCharge
Definition: Histograms.h:270
MonitorElement * hPhi
Definition: Histograms.h:265
void Fill(long long x)
MonitorElement * hEta
Definition: Histograms.h:264
virtual Int_t HResolution::Fill ( Double_t  x,
Double_t  y 
)
inlinevirtual

Definition at line 1739 of file Histograms.h.

References diffHisto_, and histo2D_.

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

1739  {
1740  diffHisto_->Fill(x, y);
1741  histo2D_->Fill(x, y);
1742  return 0;
1743  }
Definition: DDAxes.h:10
TH2F * histo2D_
Definition: Histograms.h:1771
TProfile * diffHisto_
Definition: Histograms.h:1770
virtual Int_t HResolution::Write ( const char *  name = 0,
Int_t  option = 0,
Int_t  bufsize = 0 
)
inlinevirtual

Definition at line 1744 of file Histograms.h.

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

1744  {
1745  // Loop on all the bins and take the rms.
1746  // The TProfile bin error is by default the standard error on the mean, that is
1747  // rms/sqrt(N). If it is created with the "S" option (as we did NOT do), it would
1748  // already be the rms. Thus we take the error and multiply it by the sqrt of the
1749  // bin entries to get the rms.
1750  // bin 0 is the underflow, bin totBins+1 is the overflow.
1751  unsigned int totBins = diffHisto_->GetNbinsX();
1752  // std::cout << "totBins = " << totBins << std::endl;
1753  for( unsigned int iBin=1; iBin<=totBins; ++iBin ) {
1754  // std::cout << "iBin = " << iBin << ", " << diffHisto_->GetBinError(iBin)*sqrt(diffHisto_->GetBinEntries(iBin)) << std::endl;
1755  resoHisto_->SetBinContent( iBin, diffHisto_->GetBinError(iBin)*sqrt(diffHisto_->GetBinEntries(iBin)) );
1756  }
1757  if( dir_ != 0 ) dir_->cd();
1758  resoHisto_->Write();
1759  if( diffDir_ != 0 ) diffDir_->cd();
1760  diffHisto_->Write();
1761  if( dir2D_ != 0 ) dir2D_->cd();
1762  histo2D_->Write();
1763 
1764  return 0;
1765  }
TDirectory * dir2D_
Definition: Histograms.h:1768
T sqrt(T t)
Definition: SSEVec.h:48
TDirectory * dir_
Definition: Histograms.h:1767
TDirectory * diffDir_
Definition: Histograms.h:1769
TH1F * resoHisto_
Definition: Histograms.h:1772
TH2F * histo2D_
Definition: Histograms.h:1771
TProfile * diffHisto_
Definition: Histograms.h:1770

Member Data Documentation

TDirectory* HResolution::diffDir_
protected

Definition at line 1769 of file Histograms.h.

Referenced by HResolution(), and Write().

TProfile* HResolution::diffHisto_
protected

Definition at line 1770 of file Histograms.h.

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

TDirectory* HResolution::dir2D_
protected

Definition at line 1768 of file Histograms.h.

Referenced by HResolution(), and Write().

TDirectory* HResolution::dir_
protected

Definition at line 1767 of file Histograms.h.

Referenced by HResolution(), and Write().

MonitorElement* HResolution::h2Eta
private

Definition at line 272 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2EtaVsPhi
private

Definition at line 282 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2EtaVsPt
private

Definition at line 281 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2P
private

Definition at line 275 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2Phi
private

Definition at line 273 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2PhiVsEta
private

Definition at line 285 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2PhiVsPt
private

Definition at line 284 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2Pt
private

Definition at line 276 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2PtVsEta
private

Definition at line 278 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::h2PtVsPhi
private

Definition at line 279 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::hCharge
private

Definition at line 270 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::hEta
private

Definition at line 264 of file Histograms.h.

Referenced by Fill(), and HResolution().

TH2F* HResolution::histo2D_
protected

Definition at line 1771 of file Histograms.h.

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

MonitorElement* HResolution::hP
private

Definition at line 267 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::hPhi
private

Definition at line 265 of file Histograms.h.

Referenced by Fill(), and HResolution().

MonitorElement* HResolution::hPt
private

Definition at line 268 of file Histograms.h.

Referenced by Fill(), and HResolution().

TH1F* HResolution::resoHisto_
protected

Definition at line 1772 of file Histograms.h.

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

std::string HResolution::theName
private

Definition at line 261 of file Histograms.h.

Referenced by HResolution().

std::string HResolution::where
private

Definition at line 262 of file Histograms.h.

Referenced by HResolution().