CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
HTrackVariables Class Reference

#include <Histograms.h>

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 

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

Member Typedef Documentation

◆ DQMStore

Definition at line 25 of file Histograms.h.

◆ MonitorElement

Definition at line 26 of file Histograms.h.

Constructor & Destructor Documentation

◆ HTrackVariables()

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

Definition at line 28 of file Histograms.h.

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

29  : theName(name), where(whereIs) {
30  ibooker.cd();
31  const std::string &dirName = dirName_;
32  //dirName+="/";
33  //dirName+=name.c_str();
34 
35  ibooker.setCurrentFolder(dirName);
36 
37  hEta = ibooker.book1D(theName + "_Eta_" + where, "#eta at " + where, 120, -3., 3.);
38  hPhi = ibooker.book1D(theName + "_Phi_" + where, "#phi at " + where, 100, -Geom::pi(), Geom::pi());
39  hP = ibooker.book1D(theName + "_P_" + where, "p_{t} at " + where, 1000, 0, 2000);
40  hPt = ibooker.book1D(theName + "_Pt_" + where, "p_{t} at " + where, 1000, 0, 2000);
41  hCharge = ibooker.book1D(theName + "_charge_" + where, "Charge at " + where, 4, -2., 2.);
42 
43  hEtaVsGen = ibooker.book1D(theName + "_EtaVsGen_" + where, "#eta at " + where, 120, -3., 3.);
44  hPhiVsGen = ibooker.book1D(theName + "_PhiVsGen_" + where, "#phi at " + where, 100, -Geom::pi(), Geom::pi());
45  hPtVsGen = ibooker.book1D(theName + "_PtVsGen_" + where, "p_{t} at " + where, 1000, 0, 2000);
46 
47  hDeltaR = ibooker.book1D(theName + "_DeltaR_" + where, "Delta R w.r.t. sim track for " + where, 1000, 0, 20);
48 
49  theEntries = 0;
50  }
MonitorElement * hCharge
Definition: Histograms.h:138
MonitorElement * hPt
Definition: Histograms.h:137
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * hPhi
Definition: Histograms.h:135
MonitorElement * hP
Definition: Histograms.h:136
MonitorElement * hPhiVsGen
Definition: Histograms.h:141
MonitorElement * hPtVsGen
Definition: Histograms.h:142
MonitorElement * hEtaVsGen
Definition: Histograms.h:140
std::string theName
Definition: Histograms.h:129
constexpr double pi()
Definition: Pi.h:31
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * hEta
Definition: Histograms.h:134
std::string where
Definition: Histograms.h:130

◆ ~HTrackVariables()

HTrackVariables::~HTrackVariables ( )
inline

Definition at line 63 of file Histograms.h.

63 {}

Member Function Documentation

◆ charge()

MonitorElement* HTrackVariables::charge ( void  )
inline

Definition at line 69 of file Histograms.h.

References hCharge.

Referenced by Fill().

69 { return hCharge; }
MonitorElement * hCharge
Definition: Histograms.h:138

◆ computeEfficiency() [1/2]

double HTrackVariables::computeEfficiency ( HTrackVariables sim,
DQMStore::IBooker ibooker 
)
inline

Definition at line 89 of file Histograms.h.

References L1TObjectsTimingClient_cff::efficiency, efficiencyHistos, entries(), hEtaVsGen, hPhiVsGen, and hPtVsGen.

Referenced by HTrack::computeEfficiency().

89  {
90  efficiencyHistos.push_back(computeEfficiency(hEtaVsGen, sim->eta(), ibooker));
91  efficiencyHistos.push_back(computeEfficiency(hPhiVsGen, sim->phi(), ibooker));
92  efficiencyHistos.push_back(computeEfficiency(hPtVsGen, sim->pt(), ibooker));
93 
94  double efficiency = 100 * entries() / sim->entries();
95  return efficiency;
96  }
double computeEfficiency(HTrackVariables *sim, DQMStore::IBooker &ibooker)
Definition: Histograms.h:89
MonitorElement * hPhiVsGen
Definition: Histograms.h:141
MonitorElement * hPtVsGen
Definition: Histograms.h:142
MonitorElement * hEtaVsGen
Definition: Histograms.h:140
std::vector< MonitorElement * > efficiencyHistos
Definition: Histograms.h:146

◆ computeEfficiency() [2/2]

MonitorElement* HTrackVariables::computeEfficiency ( MonitorElement reco,
MonitorElement sim,
DQMStore::IBooker ibooker 
)
inline

Definition at line 98 of file Histograms.h.

References newFWLiteAna::bin, dqm::implementation::IBooker::book1D(), relativeConstraints::error, hlt_dqm_clientPB-live_cfg::me, Skims_PA_cff::name, l1tHGCalTowerMapProducer_cfi::nBinsEta, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

98  {
99  TH1F *hReco = reco->getTH1F();
100  TH1F *hSim = sim->getTH1F();
101 
102  std::string name = hReco->GetName();
103  std::string title = hReco->GetTitle();
104 
105  MonitorElement *me = ibooker.book1D("Eff_" + name,
106  "Efficiecny as a function of " + title,
107  hSim->GetNbinsX(),
108  hSim->GetXaxis()->GetXmin(),
109  hSim->GetXaxis()->GetXmax());
110 
111  me->getTH1F()->Divide(hReco, hSim, 1., 1., "b");
112 
113  // Set the error accordingly to binomial statistics
114  int nBinsEta = me->getTH1F()->GetNbinsX();
115  for (int bin = 1; bin <= nBinsEta; bin++) {
116  float nSimHit = hSim->GetBinContent(bin);
117  float eff = me->getTH1F()->GetBinContent(bin);
118  float error = 0;
119  if (nSimHit != 0 && eff <= 1) {
120  error = sqrt(eff * (1 - eff) / nSimHit);
121  }
122  me->getTH1F()->SetBinError(bin, error);
123  }
124 
125  return me;
126  }
T sqrt(T t)
Definition: SSEVec.h:23
fixed size matrix
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98

◆ entries()

int HTrackVariables::entries ( )
inline

Definition at line 70 of file Histograms.h.

References theEntries.

Referenced by computeEfficiency().

70 { return theEntries; }

◆ eta()

MonitorElement* HTrackVariables::eta ( void  )
inline

Definition at line 65 of file Histograms.h.

References hEta.

Referenced by Particle.Particle::__str__(), datamodel.Object::DeltaR(), Fill(), Jet.Jet::jetID(), datamodel.Object::p4(), and Jet.Jet::puJetId().

65 { return hEta; }
MonitorElement * hEta
Definition: Histograms.h:134

◆ Fill() [1/2]

void HTrackVariables::Fill ( double  p,
double  pt,
double  eta,
double  phi,
double  charge 
)
inline

Definition at line 72 of file Histograms.h.

References charge(), eta(), dqm::impl::MonitorElement::Fill(), hCharge, hEta, hP, hPhi, hPt, p(), phi(), pt(), and theEntries.

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

72  {
73  hEta->Fill(eta);
74  hPhi->Fill(phi);
75  hP->Fill(p);
76  hPt->Fill(pt);
78  ++theEntries;
79  }
MonitorElement * hCharge
Definition: Histograms.h:138
MonitorElement * hPt
Definition: Histograms.h:137
MonitorElement * hPhi
Definition: Histograms.h:135
MonitorElement * p()
Definition: Histograms.h:67
MonitorElement * eta()
Definition: Histograms.h:65
MonitorElement * hP
Definition: Histograms.h:136
void Fill(long long x)
MonitorElement * phi()
Definition: Histograms.h:66
MonitorElement * charge()
Definition: Histograms.h:69
MonitorElement * pt()
Definition: Histograms.h:68
MonitorElement * hEta
Definition: Histograms.h:134

◆ Fill() [2/2]

void HTrackVariables::Fill ( double  pt,
double  eta,
double  phi 
)
inline

Definition at line 81 of file Histograms.h.

References eta(), dqm::impl::MonitorElement::Fill(), hEtaVsGen, hPhiVsGen, hPtVsGen, phi(), and pt().

81  {
82  hEtaVsGen->Fill(eta);
83  hPhiVsGen->Fill(phi);
84  hPtVsGen->Fill(pt);
85  }
MonitorElement * eta()
Definition: Histograms.h:65
void Fill(long long x)
MonitorElement * hPhiVsGen
Definition: Histograms.h:141
MonitorElement * phi()
Definition: Histograms.h:66
MonitorElement * hPtVsGen
Definition: Histograms.h:142
MonitorElement * pt()
Definition: Histograms.h:68
MonitorElement * hEtaVsGen
Definition: Histograms.h:140

◆ FillDeltaR()

void HTrackVariables::FillDeltaR ( double  deltaR)
inline

Definition at line 87 of file Histograms.h.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, and hDeltaR::Fill().

Referenced by HTrack::FillDeltaR().

87 { hDeltaR->Fill(deltaR); }
void Fill(double xEntry, double yEntry, double zEntry, double path, double path_x, double SM, double pAbs, double En, int type)
Definition: Histograms.h:464

◆ p()

MonitorElement* HTrackVariables::p ( )
inline

Definition at line 67 of file Histograms.h.

References hP.

Referenced by Fill(), and Electron.Electron::ptErr().

67 { return hP; }
MonitorElement * hP
Definition: Histograms.h:136

◆ phi()

MonitorElement* HTrackVariables::phi ( void  )
inline

Definition at line 66 of file Histograms.h.

References hPhi.

Referenced by Particle.Particle::__str__(), datamodel.Object::DeltaR(), Fill(), datamodel.Object::p4(), and ntupleDataFormat.Track::phiPull().

66 { return hPhi; }
MonitorElement * hPhi
Definition: Histograms.h:135

◆ pt()

MonitorElement* HTrackVariables::pt ( )
inline

Member Data Documentation

◆ efficiencyHistos

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

Definition at line 146 of file Histograms.h.

Referenced by computeEfficiency().

◆ hCharge

MonitorElement* HTrackVariables::hCharge
private

Definition at line 138 of file Histograms.h.

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

◆ hDeltaR

MonitorElement* HTrackVariables::hDeltaR
private

Definition at line 144 of file Histograms.h.

◆ hEta

MonitorElement* HTrackVariables::hEta
private

Definition at line 134 of file Histograms.h.

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

◆ hEtaVsGen

MonitorElement* HTrackVariables::hEtaVsGen
private

Definition at line 140 of file Histograms.h.

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

◆ hP

MonitorElement* HTrackVariables::hP
private

Definition at line 136 of file Histograms.h.

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

◆ hPhi

MonitorElement* HTrackVariables::hPhi
private

Definition at line 135 of file Histograms.h.

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

◆ hPhiVsGen

MonitorElement* HTrackVariables::hPhiVsGen
private

Definition at line 141 of file Histograms.h.

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

◆ hPt

MonitorElement* HTrackVariables::hPt
private

Definition at line 137 of file Histograms.h.

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

◆ hPtVsGen

MonitorElement* HTrackVariables::hPtVsGen
private

Definition at line 142 of file Histograms.h.

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

◆ theEntries

int HTrackVariables::theEntries
private

Definition at line 132 of file Histograms.h.

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

◆ theName

std::string HTrackVariables::theName
private

Definition at line 129 of file Histograms.h.

Referenced by HTrackVariables().

◆ where

std::string HTrackVariables::where
private

Definition at line 130 of file Histograms.h.

Referenced by HTrackVariables().