ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSegmentSlimPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11namespace Muon {
12
14constexpr int chIdxMax = static_cast<int>(ChIdx::ChIndexMax);
15
17 const std::string& sDir)
18 : PlotBase(pParent, sDir) {
19
20 // booking histograms
22 "segmentfitChi2", "Segment fit #chi^{2};#chi^{2};Entries", 100, 0, 200);
23 segmentfitNdof = Book1D("segmentfitNdof",
24 "Segment fit N_{dof};N_{dof};Entries", 100, 0, 20);
26 "segmentfitChi2oNdof",
27 "Segment fit #chi^{2}/N_{dof};Segment fit #chi^{2}/N_{dof};Entries",
28 100, 0, 20);
29
30 t0 = Book1D("t0", "Segment Refit t_{0};t_{0};Entries", 100, -25, 25);
31 t0_top = Book1D("t0_top", "Segment Refit t_{0} for y>0;t_{0};Entries", 100,
32 -25, 25);
33 t0_bottom = Book1D("t0_bottom", "Segment Refit t_{0} for y<0;t_{0};Entries",
34 100, -25, 25);
35 t0err = Book1D("t0err", "Segment Refit t_{0} error;t_{0} error;Entries",
36 100, 0, 10);
37 t0err_top = Book1D("t0err_top",
38 "Segment Refit t_{0} error for y>0;t_{0} error;Entries",
39 100, 0, 10);
41 "t0err_bottom", "Segment Refit t_{0} error for y<0;t_{0} error;Entries",
42 100, 0, 10);
43
44 nPrecisionHits = Book1D("nPrecisionHits",
45 "Segment precision hits;hits;Entries", 20, 0, 20);
46 nPhiLayers = Book1D("nPhiLayers", "Segment phi layers;#phi layers;Entries",
47 10, 0, 10);
49 "nTrigEtaLayers",
50 "Segment eta trigger layers;#eta trigger layers;Entries", 10, 0, 10);
51
52 etaIndex = Book1D("etaIndex", "Segment #eta Index ;#eta index;Entries", 21,
53 -10.5, 10.5);
54 sector = Book1D("sector", "Segment phi sector;#phi sector;Entries", 16, 0.5,
55 16.5);
56
57 etadir =
58 Book1D("etadir", "Segment pointing direction eta;#eta_{dir};Entries",
59 100, -5, 5);
61 Book1D("etadir_barrel",
62 "Segment pointing direction eta, barrel;#eta_{dir};Entries", 100,
63 -5, 5);
65 Book1D("etadir_endcap",
66 "Segment pointing direction eta, endcap;#eta_{dir};Entries", 100,
67 -5, 5);
68 phidir =
69 Book1D("phidir", "Segment pointing direction phi;#phi_{dir};Entries",
70 64, -3.2, 3.2);
71 etaphidir =
72 Book2D("etaphidir",
73 "Segment pointing direction phi vs eta;#eta_{dir};#phi_{dir}",
74 64, -3.2, 3.2, 64, -3.2, 3.2);
75
76 chamberIndex = Book1D("chamberIndex", "Chamber index; Chamber Index",
77 chIdxMax, 0, chIdxMax);
79 Book2D("chamberIndex_perSector",
80 "Number of Segments per Chamber, normalized by solid angle; "
81 "Sector; Chamber Index ",
82 33, -16.5, 16.5, chIdxMax, 0, chIdxMax);
84 Book2D("eff_chamberIndex_perSector_numerator",
85 "Number of expected hits for Segments per Chamber; Sector; "
86 "Chamber Index ",
87 33, -16.5, 16.5, chIdxMax, 0, chIdxMax);
89 Book2D("eff_chamberIndex_perSector_denominator",
90 "Number of recorded precision hits for Segments per Chamber; "
91 "Sector; Chamber Index ",
92 33, -16.5, 16.5, chIdxMax, 0, chIdxMax);
94 "eff_chamberIndex_perSector",
95 "precision layer hit efficiency per chamber; Sector; Chamber Index ",
96 33, -16.5, 16.5, chIdxMax, 0, chIdxMax);
97 // chamberIndex_dtheta = Book2D("chamberIndex_dtheta","Segment #Delta#theta
98 // between position and momentum; #Delta#theta; Chamber Index ", 180,
99 // -90.0, 90.0, chIdxMax,0,chIdxMax);
100 for (int i = 1; i <= chamberIndex->GetXaxis()->GetNbins(); i++) {
101 const char* temp_chambername =
104 chamberIndex->GetBinLowEdge(i)))
105 .c_str();
106 chamberIndex->GetXaxis()->SetBinLabel(i, temp_chambername);
107 chamberIndex_perSector->GetYaxis()->SetBinLabel(i, temp_chambername);
108 eff_chamberIndex_perSector_numerator->GetYaxis()->SetBinLabel(
109 i, temp_chambername);
110 eff_chamberIndex_perSector_denominator->GetYaxis()->SetBinLabel(
111 i, temp_chambername);
112 eff_chamberIndex_perSector->GetYaxis()->SetBinLabel(i,
113 temp_chambername);
114 }
115}
116
118
119void MuonSegmentSlimPlots::fill(const xAOD::MuonSegment& muSeg, float weight) {
120 float chi2 = muSeg.chiSquared();
121 float ndof = muSeg.numberDoF();
122 segmentfitChi2->Fill(chi2, weight);
123 segmentfitNdof->Fill(ndof, weight);
124 if (ndof > 0) {
125 segmentfitChi2oNdof->Fill(muSeg.chiSquared() / muSeg.numberDoF(),
126 weight);
127 }
128
129 float y = muSeg.y();
130
131 float segt0 = muSeg.t0();
132 float segt0err = muSeg.t0error();
133
134 t0->Fill(segt0, weight);
135 t0err->Fill(segt0err, weight);
136 if (y > 0) {
137 t0_top->Fill(segt0, weight);
138 t0err_top->Fill(segt0err, weight);
139 } else {
140 t0_bottom->Fill(segt0, weight);
141 t0err_bottom->Fill(segt0err, weight);
142 }
143
144 sector->Fill(muSeg.sector(), weight);
145
146 nPrecisionHits->Fill(muSeg.nPrecisionHits(), weight);
147 nPhiLayers->Fill(muSeg.nPhiLayers(), weight);
148 nTrigEtaLayers->Fill(muSeg.nTrigEtaLayers(), weight);
149
150 int chIndex = static_cast<int>(muSeg.chamberIndex());
151 float chambernorm =
152 1 / Chamberarea[chIndex]; // weight of the segment using the chamber
153 // eta-phi area
154 chamberIndex->Fill(chIndex, weight);
155 int sectorIndex = muSeg.sector();
156 // fill the count of segments; switch the sign here to make the plots
157 if (muSeg.z() < 0) {
158 sectorIndex = -sectorIndex;
159 }
160 chamberIndex_perSector->Fill(sectorIndex, chIndex, chambernorm);
162 sectorIndex, chIndex,
165 : muSeg.nPrecisionHits());
168 // update sector eta index plots; switch the sign back here to make the
169 // plots
170 sectorIndex = muSeg.sector();
171
172 // position and direction plots
173 // protect against cases with no hit information!
174 Amg::Vector3D globalDir{muSeg.px(), muSeg.py(), muSeg.pz()};
175
176 if (globalDir.mag() < DBL_EPSILON) {
177 return;
178 }
179
180 float eta = globalDir.eta();
181 float phi = globalDir.phi();
182 etadir->Fill(eta, weight);
183 phidir->Fill(phi, weight);
184 etaphidir->Fill(eta, phi);
185}
186
187} // namespace Muon
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define y
static constexpr std::array< float, 17 > Chamberexpectedhits
void fill(const xAOD::MuonSegment &muonSeg, float weight=1.0)
static constexpr std::array< float, 17 > Chamberarea
MuonSegmentSlimPlots(PlotBase *pParent, const std::string &sDir)
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
TH2F * Book2D(std::string_view name, std::string_view labels, int nBinsX, float startX, float endX, int nBinsY, float startY, float endY, bool prependDir=true)
Book a TH2F histogram.
Definition PlotBase.cxx:123
float px() const
float y() const
Returns the x position.
float pz() const
Returns the pz.
float t0() const
int nTrigEtaLayers() const
Returns the number of trigger eta layers.
float numberDoF() const
Returns the numberDoF.
int nPrecisionHits() const
float chiSquared() const
float py() const
Returns the py.
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
int nPhiLayers() const
Returns the number of phi layers.
float t0error() const
Returns the time error.
float z() const
Returns the y position.
double chi2(TH1 *h0, TH1 *h1)
Eigen::Matrix< double, 3, 1 > Vector3D
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
const std::string & chName(ChIndex index)
convert ChIndex into a string
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
constexpr int chIdxMax
MuonStationIndex::ChIndex ChIdx
MuonSegment_v1 MuonSegment
Reference the current persistent version: