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, DQMStore::IBooker &ibooker)
 
MonitorElementcomputeEfficiency (MonitorElement *reco, MonitorElement *sim, DQMStore::IBooker &ibooker)
 
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 (DQMStore::IBooker &ibooker, std::string dirName_, std::string name, std::string whereIs="")
 
MonitorElementp ()
 
MonitorElementphi ()
 
MonitorElementpt ()
 
 ~HTrackVariables ()
 

Private Attributes

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

Constructor & Destructor Documentation

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

Definition at line 28 of file Histograms.h.

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

28  :theName(name.c_str()),where(whereIs.c_str()){
29  ibooker.cd();
30  std::string dirName=dirName_;
31  //dirName+="/";
32  //dirName+=name.c_str();
33 
34  ibooker.setCurrentFolder(dirName.c_str());
35 
36  hEta = ibooker.book1D(theName+"_Eta_"+where,"#eta at "+where,120,-3.,3.);
37  hPhi = ibooker.book1D(theName+"_Phi_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
38  hP = ibooker.book1D(theName+"_P_"+where,"p_{t} at "+where,1000,0,2000);
39  hPt = ibooker.book1D(theName+"_Pt_"+where,"p_{t} at "+where,1000,0,2000);
40  hCharge = ibooker.book1D(theName+"_charge_"+where,"Charge at "+where,4,-2.,2.);
41 
42  hEtaVsGen = ibooker.book1D(theName+"_EtaVsGen_"+where,"#eta at "+where,120,-3.,3.);
43  hPhiVsGen = ibooker.book1D(theName+"_PhiVsGen_"+where,"#phi at "+where,100,-Geom::pi(),Geom::pi());
44  hPtVsGen = ibooker.book1D(theName+"_PtVsGen_"+where,"p_{t} at "+where,1000,0,2000);
45 
46  hDeltaR = ibooker.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:145
MonitorElement * hPt
Definition: Histograms.h:144
void cd(void)
Definition: DQMStore.cc:266
MonitorElement * hPhi
Definition: Histograms.h:142
MonitorElement * hP
Definition: Histograms.h:143
MonitorElement * hPhiVsGen
Definition: Histograms.h:148
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
MonitorElement * hPtVsGen
Definition: Histograms.h:149
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * hEtaVsGen
Definition: Histograms.h:147
double pi()
Definition: Pi.h:31
std::string theName
Definition: Histograms.h:136
MonitorElement * hDeltaR
Definition: Histograms.h:151
MonitorElement * hEta
Definition: Histograms.h:141
std::string where
Definition: Histograms.h:137
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:145
double HTrackVariables::computeEfficiency ( HTrackVariables sim,
DQMStore::IBooker ibooker 
)
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 
92  efficiencyHistos.push_back(computeEfficiency(hEtaVsGen,sim->eta(),ibooker));
93  efficiencyHistos.push_back(computeEfficiency(hPhiVsGen,sim->phi(),ibooker));
94  efficiencyHistos.push_back(computeEfficiency(hPtVsGen,sim->pt(),ibooker));
95 
96  double efficiency = 100*entries()/sim->entries();
97  return efficiency;
98  }
double computeEfficiency(HTrackVariables *sim, DQMStore::IBooker &ibooker)
Definition: Histograms.h:90
MonitorElement * eta()
Definition: Histograms.h:64
std::vector< MonitorElement * > efficiencyHistos
Definition: Histograms.h:153
MonitorElement * hPhiVsGen
Definition: Histograms.h:148
MonitorElement * phi()
Definition: Histograms.h:65
MonitorElement * hPtVsGen
Definition: Histograms.h:149
MonitorElement * pt()
Definition: Histograms.h:67
MonitorElement * hEtaVsGen
Definition: Histograms.h:147
MonitorElement* HTrackVariables::computeEfficiency ( MonitorElement reco,
MonitorElement sim,
DQMStore::IBooker ibooker 
)
inline

Definition at line 100 of file Histograms.h.

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

100  {
101 
102  TH1F* hReco = reco->getTH1F();
103  TH1F* hSim = sim->getTH1F();
104 
105  std::string name = hReco->GetName();
106  std::string title = hReco->GetTitle();
107 
108  MonitorElement * me = ibooker.book1D(
109  "Eff_"+name,
110  "Efficiecny as a function of "+title,
111  hSim->GetNbinsX(),
112  hSim->GetXaxis()->GetXmin(),
113  hSim->GetXaxis()->GetXmax()
114  );
115 
116  me->getTH1F()->Divide(hReco,hSim,1.,1.,"b");
117 
118  // Set the error accordingly to binomial statistics
119  int nBinsEta = me->getTH1F()->GetNbinsX();
120  for(int bin = 1; bin <= nBinsEta; bin++) {
121  float nSimHit = hSim->GetBinContent(bin);
122  float eff = me->getTH1F()->GetBinContent(bin);
123  float error = 0;
124  if(nSimHit != 0 && eff <= 1) {
125  error = sqrt(eff*(1-eff)/nSimHit);
126  }
127  me->getTH1F()->SetBinError(bin, error);
128  }
129 
130  return me;
131  }
T sqrt(T t)
Definition: SSEVec.h:48
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:113
TH1F * getTH1F(void) const
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:141
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:145
MonitorElement * hPt
Definition: Histograms.h:144
MonitorElement * hPhi
Definition: Histograms.h:142
MonitorElement * p()
Definition: Histograms.h:66
MonitorElement * eta()
Definition: Histograms.h:64
MonitorElement * hP
Definition: Histograms.h:143
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:141
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:148
MonitorElement * phi()
Definition: Histograms.h:65
MonitorElement * hPtVsGen
Definition: Histograms.h:149
MonitorElement * pt()
Definition: Histograms.h:67
MonitorElement * hEtaVsGen
Definition: Histograms.h:147
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:151
MonitorElement* HTrackVariables::p ( )
inline

Definition at line 66 of file Histograms.h.

References hP.

66 {return hP;}
MonitorElement * hP
Definition: Histograms.h:143
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:142
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:144

Member Data Documentation

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

Definition at line 153 of file Histograms.h.

Referenced by computeEfficiency().

MonitorElement* HTrackVariables::hCharge
private

Definition at line 145 of file Histograms.h.

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

MonitorElement* HTrackVariables::hDeltaR
private

Definition at line 151 of file Histograms.h.

Referenced by FillDeltaR(), and HTrackVariables().

MonitorElement* HTrackVariables::hEta
private

Definition at line 141 of file Histograms.h.

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

MonitorElement* HTrackVariables::hEtaVsGen
private

Definition at line 147 of file Histograms.h.

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

MonitorElement* HTrackVariables::hP
private

Definition at line 143 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPhi
private

Definition at line 142 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPhiVsGen
private

Definition at line 148 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPt
private

Definition at line 144 of file Histograms.h.

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

MonitorElement* HTrackVariables::hPtVsGen
private

Definition at line 149 of file Histograms.h.

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

int HTrackVariables::theEntries
private

Definition at line 139 of file Histograms.h.

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

std::string HTrackVariables::theName
private

Definition at line 136 of file Histograms.h.

Referenced by HTrackVariables().

std::string HTrackVariables::where
private

Definition at line 137 of file Histograms.h.

Referenced by HTrackVariables().