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

Constructor & Destructor Documentation

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

Definition at line 29 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.

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

Definition at line 64 of file Histograms.h.

64 {}

Member Function Documentation

MonitorElement* HTrackVariables::charge ( void  )
inline

Definition at line 70 of file Histograms.h.

References hCharge.

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

Definition at line 92 of file Histograms.h.

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

Referenced by HTrack::computeEfficiency().

92  {
93 
96  // efficiencyHistos.push_back(computeEfficiency(p(),sim->p()));
97  efficiencyHistos.push_back(computeEfficiency(hPtVsGen,sim->pt()));
98  // efficiencyHistos.push_back(computeEfficiency(charge(),sim->charge()));
99 
100  double efficiency = 100*entries()/sim->entries();
101  return efficiency;
102  }
double computeEfficiency(HTrackVariables *sim)
Definition: Histograms.h:92
MonitorElement * eta()
Definition: Histograms.h:66
std::vector< MonitorElement * > efficiencyHistos
Definition: Histograms.h:158
MonitorElement * hPhiVsGen
Definition: Histograms.h:153
MonitorElement * phi()
Definition: Histograms.h:67
MonitorElement * hPtVsGen
Definition: Histograms.h:154
MonitorElement * pt()
Definition: Histograms.h:69
MonitorElement * hEtaVsGen
Definition: Histograms.h:152
MonitorElement* HTrackVariables::computeEfficiency ( MonitorElement reco,
MonitorElement sim 
)
inline

Definition at line 104 of file Histograms.h.

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

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

Definition at line 71 of file Histograms.h.

References theEntries.

Referenced by computeEfficiency().

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

Definition at line 66 of file Histograms.h.

References hEta.

Referenced by computeEfficiency().

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

Definition at line 73 of file Histograms.h.

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

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

73  {
74  hEta->Fill(eta);
75  hPhi->Fill(phi);
76  hP->Fill(p);
77  hPt->Fill(pt);
79  ++theEntries;
80  }
MonitorElement * hCharge
Definition: Histograms.h:150
MonitorElement * hPt
Definition: Histograms.h:149
MonitorElement * hPhi
Definition: Histograms.h:147
MonitorElement * p()
Definition: Histograms.h:68
MonitorElement * eta()
Definition: Histograms.h:66
MonitorElement * hP
Definition: Histograms.h:148
void Fill(long long x)
MonitorElement * phi()
Definition: Histograms.h:67
MonitorElement * charge()
Definition: Histograms.h:70
MonitorElement * pt()
Definition: Histograms.h:69
MonitorElement * hEta
Definition: Histograms.h:146
void HTrackVariables::Fill ( double  pt,
double  eta,
double  phi 
)
inline

Definition at line 82 of file Histograms.h.

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

82  {
83  hEtaVsGen->Fill(eta);
84  hPhiVsGen->Fill(phi);
85  hPtVsGen->Fill(pt);
86  }
MonitorElement * eta()
Definition: Histograms.h:66
void Fill(long long x)
MonitorElement * hPhiVsGen
Definition: Histograms.h:153
MonitorElement * phi()
Definition: Histograms.h:67
MonitorElement * hPtVsGen
Definition: Histograms.h:154
MonitorElement * pt()
Definition: Histograms.h:69
MonitorElement * hEtaVsGen
Definition: Histograms.h:152
void HTrackVariables::FillDeltaR ( double  deltaR)
inline

Definition at line 88 of file Histograms.h.

References MonitorElement::Fill(), and hDeltaR.

Referenced by HTrack::FillDeltaR().

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

Definition at line 68 of file Histograms.h.

References hP.

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

Definition at line 67 of file Histograms.h.

References hPhi.

Referenced by computeEfficiency().

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

Definition at line 69 of file Histograms.h.

References hPt.

Referenced by computeEfficiency().

69 {return hPt;}
MonitorElement * hPt
Definition: Histograms.h:149

Member Data Documentation

DQMStore* HTrackVariables::dbe_
private

Definition at line 139 of file Histograms.h.

Referenced by computeEfficiency(), and HTrackVariables().

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

Definition at line 158 of file Histograms.h.

Referenced by computeEfficiency().

MonitorElement* HTrackVariables::hCharge
private

Definition at line 150 of file Histograms.h.

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

MonitorElement* HTrackVariables::hDeltaR
private

Definition at line 156 of file Histograms.h.

Referenced by FillDeltaR(), and HTrackVariables().

MonitorElement* HTrackVariables::hEta
private

Definition at line 146 of file Histograms.h.

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

MonitorElement* HTrackVariables::hEtaVsGen
private

Definition at line 152 of file Histograms.h.

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

MonitorElement* HTrackVariables::hP
private

Definition at line 148 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPhi
private

Definition at line 147 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPhiVsGen
private

Definition at line 153 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPt
private

Definition at line 149 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPtVsGen
private

Definition at line 154 of file Histograms.h.

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

int HTrackVariables::theEntries
private

Definition at line 144 of file Histograms.h.

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

std::string HTrackVariables::theName
private

Definition at line 141 of file Histograms.h.

Referenced by HTrackVariables().

std::string HTrackVariables::where
private

Definition at line 142 of file Histograms.h.

Referenced by HTrackVariables().