ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSegmentTruthRelatedPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
9
10namespace Muon {
11
13 PlotBase* pParent, const std::string& sDir)
14 : PlotBase(pParent, sDir),
15 nPrecisionHits(this, "diff_nPrecisionHits",
16 "diff(reco-truth) segment precision hits;hits;Entries", -5,
17 5),
18 nPhiLayers(this, "diff_nPhiLayers",
19 "diff(reco-truth) segment phi layers;#phi layers;Entries", -5,
20 5),
21 nTrigEtaLayers(this, "diff_nTrigEtaLayers",
22 "diff(reco-truth) segment eta trigger layers;#eta trigger "
23 "layers;Entries",
24 -5, 5) {
25 // booking histograms
26 dxpos = Book1D("dxpos", "Resolution x-position;#Delta x_{pos};Entries", 400,
27 -14000, 14000);
28 dypos = Book1D("dypos", "Resolution y-position;#Delta y_{pos};Entries", 400,
29 -14000, 14000);
30 dzpos = Book1D("dzpos", "Resolution z-position;#Delta z_{pos};Entries", 500,
31 -22000, 22000);
32
33 detapos =
34 Book1D("detapos", "Resolution eta-position;#Delta#eta_{pos};Entries",
35 64, -3.2, 3.2);
36 dphipos =
37 Book1D("dphipos", "Resolution phi-position;#Delta#phi_{pos};Entries",
38 64, -3.2, 3.2);
39
40 detadir =
41 Book1D("detadir", "Resolution eta-direction;#Delta#eta_{dir};Entries",
42 100, -10., 10.);
43 dphidir =
44 Book1D("dphidir", "Resolution phi-direction;#Delta#phi_{dir};Entries",
45 100, -10., 10.);
46}
47
49
51 const xAOD::MuonSegment& truthMuSeg,
52 float weight) {
53
55
56 float muSegEta = 0;
57 float muSegPhi = 0;
58 Amg::Vector3D globalPos{muSeg.x(), muSeg.y(), muSeg.z()};
59 Amg::Vector3D truthGlobalPos{truthMuSeg.x(), truthMuSeg.y(),
60 truthMuSeg.z()};
61
62 if (globalPos.mag()) {
63 // protect against cases with no hit information!
64 muSegEta = globalPos.eta();
65 muSegPhi = globalPos.phi();
66 }
67
68 nPrecisionHits.fill(truthMuSeg.nPrecisionHits() - muSeg.nPrecisionHits(),
69 muSegEta, muSegPhi);
70 nPhiLayers.fill(truthMuSeg.nPhiLayers() - muSeg.nPhiLayers(), muSegEta,
71 muSegPhi);
72 nTrigEtaLayers.fill(truthMuSeg.nTrigEtaLayers() - muSeg.nTrigEtaLayers(),
73 muSegEta, muSegPhi);
74
76
77 // protect against cases with no hit information!
78 if (globalPos.mag() < DBL_EPSILON || truthGlobalPos.mag() < DBL_EPSILON) {
79 return;
80 }
81
82 dxpos->Fill(muSeg.x() - truthMuSeg.x(), weight);
83 dypos->Fill(muSeg.y() - truthMuSeg.y(), weight);
84 dzpos->Fill(muSeg.z() - truthMuSeg.z(), weight);
85
86 detapos->Fill(globalPos.eta() - truthGlobalPos.eta(), weight);
87 dphipos->Fill(globalPos.deltaPhi(truthGlobalPos), weight);
88
89 Amg::Vector3D globalDir(muSeg.px(), muSeg.py(), muSeg.pz());
90 Amg::Vector3D truthGlobalDir(truthMuSeg.px(), truthMuSeg.py(),
91 truthMuSeg.pz());
92
93 dphidir->Fill(globalDir.deltaPhi(truthGlobalDir), weight);
94 detadir->Fill(globalDir.eta() - truthGlobalDir.eta(), weight);
95}
96
97} // namespace Muon
MuonSegmentTruthRelatedPlots(PlotBase *pParent, const std::string &sDir)
void fill(const xAOD::MuonSegment &muonSeg, const xAOD::MuonSegment &truthMuonSeg, float weight=1.0)
TH1D * Book1D(std::string_view name, std::string_view labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, std::string_view sDir)
Definition PlotBase.cxx:29
float px() const
float y() const
Returns the x position.
std::uint8_t nTrigEtaLayers() const
Returns the number of trigger eta hits.
float pz() const
Returns the pz.
std::uint8_t nPrecisionHits() const
Returns the number of precision hits.
float py() const
Returns the py.
std::uint8_t nPhiLayers() const
Returns the number of trigger phi hits.
float z() const
Returns the y position.
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MuonSegment_v1 MuonSegment
Reference the current persistent version: