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.

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  }

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

◆ ~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.

69 { return hCharge; }

References hCharge.

Referenced by Fill().

◆ computeEfficiency() [1/2]

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

Definition at line 89 of file Histograms.h.

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  }

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

Referenced by HTrack::computeEfficiency().

◆ computeEfficiency() [2/2]

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

Definition at line 98 of file Histograms.h.

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  }

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

◆ entries()

int HTrackVariables::entries ( )
inline

Definition at line 70 of file Histograms.h.

70 { return theEntries; }

References theEntries.

Referenced by computeEfficiency().

◆ eta()

MonitorElement* HTrackVariables::eta ( void  )
inline

Definition at line 65 of file Histograms.h.

65 { return hEta; }

References hEta.

Referenced by Particle.Particle::__str__(), Fill(), Jet.Jet::jetID(), and Jet.Jet::puJetId().

◆ 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.

72  {
73  hEta->Fill(eta);
74  hPhi->Fill(phi);
75  hP->Fill(p);
76  hPt->Fill(pt);
78  ++theEntries;
79  }

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

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

◆ Fill() [2/2]

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

Definition at line 81 of file Histograms.h.

81  {
82  hEtaVsGen->Fill(eta);
83  hPhiVsGen->Fill(phi);
84  hPtVsGen->Fill(pt);
85  }

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

◆ FillDeltaR()

void HTrackVariables::FillDeltaR ( double  deltaR)
inline

Definition at line 87 of file Histograms.h.

87 { hDeltaR->Fill(deltaR); }

References PbPb_ZMuSkimMuonDPG_cff::deltaR, dqm::impl::MonitorElement::Fill(), and hDeltaR.

Referenced by HTrack::FillDeltaR().

◆ p()

MonitorElement* HTrackVariables::p ( )
inline

Definition at line 67 of file Histograms.h.

67 { return hP; }

References hP.

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

◆ phi()

MonitorElement* HTrackVariables::phi ( void  )
inline

Definition at line 66 of file Histograms.h.

66 { return hPhi; }

References hPhi.

Referenced by Particle.Particle::__str__(), Fill(), and ntupleDataFormat.Track::phiPull().

◆ 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.

Referenced by FillDeltaR(), and HTrackVariables().

◆ 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().

HTrackVariables::theName
std::string theName
Definition: Histograms.h:129
HTrackVariables::hPt
MonitorElement * hPt
Definition: Histograms.h:137
HTrackVariables::p
MonitorElement * p()
Definition: Histograms.h:67
HTrackVariables::where
std::string where
Definition: Histograms.h:130
HTrackVariables::hP
MonitorElement * hP
Definition: Histograms.h:136
HTrackVariables::hPhiVsGen
MonitorElement * hPhiVsGen
Definition: Histograms.h:141
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
L1TObjectsTimingClient_cff.efficiency
efficiency
Definition: L1TObjectsTimingClient_cff.py:10
relativeConstraints.error
error
Definition: relativeConstraints.py:53
HTrackVariables::efficiencyHistos
std::vector< MonitorElement * > efficiencyHistos
Definition: Histograms.h:146
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
hgcalTowerMapProducer_cfi.nBinsEta
nBinsEta
Definition: hgcalTowerMapProducer_cfi.py:9
HTrackVariables::entries
int entries()
Definition: Histograms.h:70
Geom::pi
constexpr double pi()
Definition: Pi.h:31
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
HTrackVariables::hEta
MonitorElement * hEta
Definition: Histograms.h:134
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HTrackVariables::hPtVsGen
MonitorElement * hPtVsGen
Definition: Histograms.h:142
HTrackVariables::computeEfficiency
double computeEfficiency(HTrackVariables *sim, DQMStore::IBooker &ibooker)
Definition: Histograms.h:89
HTrackVariables::hEtaVsGen
MonitorElement * hEtaVsGen
Definition: Histograms.h:140
HTrackVariables::charge
MonitorElement * charge()
Definition: Histograms.h:69
HTrackVariables::hPhi
MonitorElement * hPhi
Definition: Histograms.h:135
sim
Definition: GeometryProducer.h:20
HTrackVariables::pt
MonitorElement * pt()
Definition: Histograms.h:68
HTrackVariables::phi
MonitorElement * phi()
Definition: Histograms.h:66
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
HTrackVariables::hDeltaR
MonitorElement * hDeltaR
Definition: Histograms.h:144
HTrackVariables::eta
MonitorElement * eta()
Definition: Histograms.h:65
TrackerOfflineValidation_Dqm_cff.dirName
dirName
Definition: TrackerOfflineValidation_Dqm_cff.py:55
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
HTrackVariables::theEntries
int theEntries
Definition: Histograms.h:132
HTrackVariables::hCharge
MonitorElement * hCharge
Definition: Histograms.h:138