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 Attributes
HTrackVariables Class Reference

#include <Histograms.h>

Public Member Functions

MonitorElementcharge ()
 
double computeEfficiency (HTrackVariables *sim)
 
MonitorElementcomputeEfficiency (MonitorElement *reco, MonitorElement *sim)
 
int entries ()
 
MonitorElementeta ()
 
void Fill (double p, double pt, double eta, double phi, double charge)
 
void Fill (double pt, double eta, double phi)
 
void FillDeltaR (double deltaR)
 
 HTrackVariables (std::string dirName_, std::string name, std::string whereIs="")
 
MonitorElementp ()
 
MonitorElementphi ()
 
MonitorElementpt ()
 
 ~HTrackVariables ()
 

Private Attributes

DQMStoredbe_
 
std::vector< MonitorElement * > efficiencyHistos
 
MonitorElementhCharge
 
MonitorElementhDeltaR
 
MonitorElementhEta
 
MonitorElementhEtaVsGen
 
MonitorElementhP
 
MonitorElementhPhi
 
MonitorElementhPhiVsGen
 
MonitorElementhPt
 
MonitorElementhPtVsGen
 
int theEntries
 
std::string theName
 
std::string where
 

Detailed Description

Definition at line 24 of file Histograms.h.

Constructor & Destructor Documentation

HTrackVariables::HTrackVariables ( std::string  dirName_,
std::string  name,
std::string  whereIs = "" 
)
inline

Definition at line 27 of file Histograms.h.

References DQMStore::book1D(), DQMStore::cd(), dbe_, TrackerOfflineValidation_Dqm_cff::dirName, hCharge, hDeltaR, hEta, hEtaVsGen, hP, hPhi, hPhiVsGen, hPt, hPtVsGen, cppFunctionSkipper::operator, Geom::pi(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, theEntries, theName, and where.

27  :theName(name.c_str()),where(whereIs.c_str()){
29  dbe_->cd();
30  std::string dirName=dirName_;
31  //dirName+="/";
32  //dirName+=name.c_str();
33 
34  dbe_->setCurrentFolder(dirName.c_str());
35 
36  hEta = dbe_->book1D(theName+"_Eta_"+where,"#eta at "+where,120,-3.,3.);
37  hPhi = dbe_->book1D(theName+"_Phi_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
38  hP = dbe_->book1D(theName+"_P_"+where,"p_{t} at "+where,1000,0,2000);
39  hPt = dbe_->book1D(theName+"_Pt_"+where,"p_{t} at "+where,1000,0,2000);
40  hCharge = dbe_->book1D(theName+"_charge_"+where,"Charge at "+where,4,-2.,2.);
41 
42  hEtaVsGen = dbe_->book1D(theName+"_EtaVsGen_"+where,"#eta at "+where,120,-3.,3.);
43  hPhiVsGen = dbe_->book1D(theName+"_PhiVsGen_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
44  hPtVsGen = dbe_->book1D(theName+"_PtVsGen_"+where,"p_{t} at "+where,1000,0,2000);
45 
46  hDeltaR = dbe_->book1D(theName+"_DeltaR_"+where,"Delta R w.r.t. sim track for "+where,1000,0,20);
47 
48  theEntries = 0;
49  }
MonitorElement * hCharge
Definition: Histograms.h:148
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * hPt
Definition: Histograms.h:147
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:561
MonitorElement * hPhi
Definition: Histograms.h:145
MonitorElement * hP
Definition: Histograms.h:146
MonitorElement * hPhiVsGen
Definition: Histograms.h:151
MonitorElement * hPtVsGen
Definition: Histograms.h:152
MonitorElement * hEtaVsGen
Definition: Histograms.h:150
double pi()
Definition: Pi.h:31
std::string theName
Definition: Histograms.h:139
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * hDeltaR
Definition: Histograms.h:154
DQMStore * dbe_
Definition: Histograms.h:137
MonitorElement * hEta
Definition: Histograms.h:144
std::string where
Definition: Histograms.h:140
HTrackVariables::~HTrackVariables ( )
inline

Definition at line 62 of file Histograms.h.

62 {}

Member Function Documentation

MonitorElement* HTrackVariables::charge ( void  )
inline

Definition at line 68 of file Histograms.h.

References hCharge.

68 {return hCharge;}
MonitorElement * hCharge
Definition: Histograms.h:148
double HTrackVariables::computeEfficiency ( HTrackVariables sim)
inline

Definition at line 90 of file Histograms.h.

References postValidation_cfi::efficiency, efficiencyHistos, entries(), eta(), hEtaVsGen, hPhiVsGen, hPtVsGen, phi(), and pt().

Referenced by HTrack::computeEfficiency().

90  {
91 
94  // efficiencyHistos.push_back(computeEfficiency(p(),sim->p()));
95  efficiencyHistos.push_back(computeEfficiency(hPtVsGen,sim->pt()));
96  // efficiencyHistos.push_back(computeEfficiency(charge(),sim->charge()));
97 
98  double efficiency = 100*entries()/sim->entries();
99  return efficiency;
100  }
double computeEfficiency(HTrackVariables *sim)
Definition: Histograms.h:90
MonitorElement * eta()
Definition: Histograms.h:64
std::vector< MonitorElement * > efficiencyHistos
Definition: Histograms.h:156
MonitorElement * hPhiVsGen
Definition: Histograms.h:151
MonitorElement * phi()
Definition: Histograms.h:65
MonitorElement * hPtVsGen
Definition: Histograms.h:152
MonitorElement * pt()
Definition: Histograms.h:67
MonitorElement * hEtaVsGen
Definition: Histograms.h:150
MonitorElement* HTrackVariables::computeEfficiency ( MonitorElement reco,
MonitorElement sim 
)
inline

Definition at line 102 of file Histograms.h.

References newFWLiteAna::bin, DQMStore::book1D(), dbe_, relativeConstraints::error, MonitorElement::getTH1F(), mergeVDriftHistosByStation::name, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

102  {
103 
104  TH1F* hReco = reco->getTH1F();
105  TH1F* hSim = sim->getTH1F();
106 
107  std::string name = hReco->GetName();
108  std::string title = hReco->GetTitle();
109 
110  MonitorElement * me = dbe_->book1D(
111  "Eff_"+name,
112  "Efficiecny as a function of "+title,
113  hSim->GetNbinsX(),
114  hSim->GetXaxis()->GetXmin(),
115  hSim->GetXaxis()->GetXmax()
116  );
117 
118  me->getTH1F()->Divide(hReco,hSim,1.,1.,"b");
119 
120  // Set the error accordingly to binomial statistics
121  int nBinsEta = me->getTH1F()->GetNbinsX();
122  for(int bin = 1; bin <= nBinsEta; bin++) {
123  float nSimHit = hSim->GetBinContent(bin);
124  float eff = me->getTH1F()->GetBinContent(bin);
125  float error = 0;
126  if(nSimHit != 0 && eff <= 1) {
127  error = sqrt(eff*(1-eff)/nSimHit);
128  }
129  me->getTH1F()->SetBinError(bin, error);
130  }
131 
132  return me;
133  }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
T sqrt(T t)
Definition: SSEVec.h:48
TH1F * getTH1F(void) const
DQMStore * dbe_
Definition: Histograms.h:137
int HTrackVariables::entries ( )
inline

Definition at line 69 of file Histograms.h.

References theEntries.

Referenced by computeEfficiency().

69 {return theEntries;}
MonitorElement* HTrackVariables::eta ( void  )
inline

Definition at line 64 of file Histograms.h.

References hEta.

Referenced by computeEfficiency().

64 {return hEta;}
MonitorElement * hEta
Definition: Histograms.h:144
void HTrackVariables::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  charge 
)
inline

Definition at line 71 of file Histograms.h.

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

Referenced by HTrack::computeResolutionAndPull(), and HTrack::Fill().

71  {
72  hEta->Fill(eta);
73  hPhi->Fill(phi);
74  hP->Fill(p);
75  hPt->Fill(pt);
77  ++theEntries;
78  }
MonitorElement * hCharge
Definition: Histograms.h:148
MonitorElement * hPt
Definition: Histograms.h:147
MonitorElement * hPhi
Definition: Histograms.h:145
MonitorElement * p()
Definition: Histograms.h:66
MonitorElement * eta()
Definition: Histograms.h:64
MonitorElement * hP
Definition: Histograms.h:146
void Fill(long long x)
MonitorElement * phi()
Definition: Histograms.h:65
MonitorElement * charge()
Definition: Histograms.h:68
MonitorElement * pt()
Definition: Histograms.h:67
MonitorElement * hEta
Definition: Histograms.h:144
void HTrackVariables::Fill ( double  pt,
double  eta,
double  phi 
)
inline

Definition at line 80 of file Histograms.h.

References MonitorElement::Fill(), hEtaVsGen, hPhiVsGen, and hPtVsGen.

80  {
81  hEtaVsGen->Fill(eta);
82  hPhiVsGen->Fill(phi);
83  hPtVsGen->Fill(pt);
84  }
MonitorElement * eta()
Definition: Histograms.h:64
void Fill(long long x)
MonitorElement * hPhiVsGen
Definition: Histograms.h:151
MonitorElement * phi()
Definition: Histograms.h:65
MonitorElement * hPtVsGen
Definition: Histograms.h:152
MonitorElement * pt()
Definition: Histograms.h:67
MonitorElement * hEtaVsGen
Definition: Histograms.h:150
void HTrackVariables::FillDeltaR ( double  deltaR)
inline

Definition at line 86 of file Histograms.h.

References MonitorElement::Fill(), and hDeltaR.

Referenced by HTrack::FillDeltaR().

86  {
88  }
void Fill(long long x)
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
MonitorElement * hDeltaR
Definition: Histograms.h:154
MonitorElement* HTrackVariables::p ( )
inline

Definition at line 66 of file Histograms.h.

References hP.

66 {return hP;}
MonitorElement * hP
Definition: Histograms.h:146
MonitorElement* HTrackVariables::phi ( void  )
inline

Definition at line 65 of file Histograms.h.

References hPhi.

Referenced by computeEfficiency().

65 {return hPhi;}
MonitorElement * hPhi
Definition: Histograms.h:145
MonitorElement* HTrackVariables::pt ( )
inline

Definition at line 67 of file Histograms.h.

References hPt.

Referenced by computeEfficiency().

67 {return hPt;}
MonitorElement * hPt
Definition: Histograms.h:147

Member Data Documentation

DQMStore* HTrackVariables::dbe_
private

Definition at line 137 of file Histograms.h.

Referenced by computeEfficiency(), and HTrackVariables().

std::vector<MonitorElement*> HTrackVariables::efficiencyHistos
private

Definition at line 156 of file Histograms.h.

Referenced by computeEfficiency().

MonitorElement* HTrackVariables::hCharge
private

Definition at line 148 of file Histograms.h.

Referenced by charge(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hDeltaR
private

Definition at line 154 of file Histograms.h.

Referenced by FillDeltaR(), and HTrackVariables().

MonitorElement* HTrackVariables::hEta
private

Definition at line 144 of file Histograms.h.

Referenced by eta(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hEtaVsGen
private

Definition at line 150 of file Histograms.h.

Referenced by computeEfficiency(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hP
private

Definition at line 146 of file Histograms.h.

Referenced by Fill(), HTrackVariables(), and p().

MonitorElement* HTrackVariables::hPhi
private

Definition at line 145 of file Histograms.h.

Referenced by Fill(), HTrackVariables(), and phi().

MonitorElement* HTrackVariables::hPhiVsGen
private

Definition at line 151 of file Histograms.h.

Referenced by computeEfficiency(), Fill(), and HTrackVariables().

MonitorElement* HTrackVariables::hPt
private

Definition at line 147 of file Histograms.h.

Referenced by Fill(), HTrackVariables(), and pt().

MonitorElement* HTrackVariables::hPtVsGen
private

Definition at line 152 of file Histograms.h.

Referenced by computeEfficiency(), Fill(), and HTrackVariables().

int HTrackVariables::theEntries
private

Definition at line 142 of file Histograms.h.

Referenced by entries(), Fill(), and HTrackVariables().

std::string HTrackVariables::theName
private

Definition at line 139 of file Histograms.h.

Referenced by HTrackVariables().

std::string HTrackVariables::where
private

Definition at line 140 of file Histograms.h.

Referenced by HTrackVariables().