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
9
10
11namespace Muon{
12
14constexpr int chIdxMax = static_cast<int>(ChIdx::ChIndexMax);
15
16MuonSegmentSlimPlots::MuonSegmentSlimPlots(PlotBase* pParent, const std::string& sDir): PlotBase(pParent, sDir) {
17
18 //booking histograms
19 segmentfitChi2 = Book1D("segmentfitChi2", "Segment fit #chi^{2};#chi^{2};Entries", 100,0,200);
20 segmentfitNdof = Book1D("segmentfitNdof", "Segment fit N_{dof};N_{dof};Entries", 100,0,20);
21 segmentfitChi2oNdof = Book1D("segmentfitChi2oNdof", "Segment fit #chi^{2}/N_{dof};Segment fit #chi^{2}/N_{dof};Entries", 100,0,20);
22
23 t0 = Book1D("t0","Segment Refit t_{0};t_{0};Entries",100,-25,25);
24 t0_top = Book1D("t0_top","Segment Refit t_{0} for y>0;t_{0};Entries",100,-25,25);
25 t0_bottom = Book1D("t0_bottom","Segment Refit t_{0} for y<0;t_{0};Entries",100,-25,25);
26 t0err = Book1D("t0err","Segment Refit t_{0} error;t_{0} error;Entries",100,0,10);
27 t0err_top = Book1D("t0err_top","Segment Refit t_{0} error for y>0;t_{0} error;Entries",100,0,10);
28 t0err_bottom = Book1D("t0err_bottom","Segment Refit t_{0} error for y<0;t_{0} error;Entries",100,0,10);
29
30 nPrecisionHits = Book1D("nPrecisionHits","Segment precision hits;hits;Entries",20,0,20);
31 nPhiLayers = Book1D("nPhiLayers","Segment phi layers;#phi layers;Entries",10,0,10);
32 nTrigEtaLayers = Book1D("nTrigEtaLayers","Segment eta trigger layers;#eta trigger layers;Entries",10,0,10);
33
34 etaIndex = Book1D("etaIndex","Segment #eta Index ;#eta index;Entries",21,-10.5,10.5);
35 sector = Book1D("sector","Segment phi sector;#phi sector;Entries",16,0.5,16.5);
36
37 etadir = Book1D("etadir","Segment pointing direction eta;#eta_{dir};Entries",100,-5,5);
38 etadir_barrel = Book1D("etadir_barrel","Segment pointing direction eta, barrel;#eta_{dir};Entries",100,-5,5);
39 etadir_endcap = Book1D("etadir_endcap","Segment pointing direction eta, endcap;#eta_{dir};Entries",100,-5,5);
40 phidir = Book1D("phidir","Segment pointing direction phi;#phi_{dir};Entries",64,-3.2,3.2);
41 etaphidir = Book2D("etaphidir","Segment pointing direction phi vs eta;#eta_{dir};#phi_{dir}",64,-3.2,3.2,64,-3.2,3.2);
42
43 chamberIndex = Book1D("chamberIndex","Chamber index; Chamber Index",chIdxMax,0, chIdxMax);
44 chamberIndex_perSector = Book2D("chamberIndex_perSector","Number of Segments per Chamber, normalized by solid angle; Sector; Chamber Index ", 33, -16.5, 16.5, chIdxMax,0,chIdxMax);
45 eff_chamberIndex_perSector_numerator = Book2D("eff_chamberIndex_perSector_numerator","Number of expected hits for Segments per Chamber; Sector; Chamber Index ", 33, -16.5, 16.5, chIdxMax,0,chIdxMax);
46 eff_chamberIndex_perSector_denominator = Book2D("eff_chamberIndex_perSector_denominator","Number of recorded precision hits for Segments per Chamber; Sector; Chamber Index ", 33, -16.5, 16.5, chIdxMax,0,chIdxMax);
47 eff_chamberIndex_perSector = Book2D("eff_chamberIndex_perSector","precision layer hit efficiency per chamber; Sector; Chamber Index ", 33, -16.5, 16.5, chIdxMax,0,chIdxMax);
48 //chamberIndex_dtheta = Book2D("chamberIndex_dtheta","Segment #Delta#theta between position and momentum; #Delta#theta; Chamber Index ", 180, -90.0, 90.0, chIdxMax,0,chIdxMax);
49 for (int i=1; i<=chamberIndex->GetXaxis()->GetNbins(); i++){
50 const char *temp_chambername = MuonStationIndex::chName(static_cast<Muon::MuonStationIndex::ChIndex>(chamberIndex->GetBinLowEdge(i))).c_str();
51 chamberIndex->GetXaxis()->SetBinLabel(i, temp_chambername);
52 chamberIndex_perSector->GetYaxis()->SetBinLabel(i, temp_chambername);
53 eff_chamberIndex_perSector_numerator->GetYaxis()->SetBinLabel(i, temp_chambername);
54 eff_chamberIndex_perSector_denominator->GetYaxis()->SetBinLabel(i, temp_chambername);
55 eff_chamberIndex_perSector->GetYaxis()->SetBinLabel(i, temp_chambername);
56 }
57}
58
62
63 void MuonSegmentSlimPlots::fill(const xAOD::MuonSegment& muSeg, float weight)
64{
65 float chi2 = muSeg.chiSquared();
66 float ndof = muSeg.numberDoF();
67 segmentfitChi2->Fill(chi2, weight);
68 segmentfitNdof->Fill(ndof, weight);
69 if (ndof>0) segmentfitChi2oNdof->Fill(muSeg.chiSquared()/muSeg.numberDoF(), weight);
70
71 float y=muSeg.y();
72
73 float segt0 = muSeg.t0();
74 float segt0err = muSeg.t0error();
75
76 t0->Fill(segt0, weight);
77 t0err->Fill(segt0err, weight);
78 if (y>0) {
79 t0_top->Fill(segt0, weight);
80 t0err_top->Fill(segt0err,weight);
81 } else {
82 t0_bottom->Fill(segt0, weight);
83 t0err_bottom->Fill(segt0err, weight);
84 }
85
86 sector->Fill(muSeg.sector(), weight);
87
88 nPrecisionHits->Fill(muSeg.nPrecisionHits(), weight);
89 nPhiLayers->Fill(muSeg.nPhiLayers(), weight);
90 nTrigEtaLayers->Fill(muSeg.nTrigEtaLayers(), weight);
91
92 int chIndex = static_cast<int>(muSeg.chamberIndex());
93 float chambernorm = 1/Chamberarea[chIndex];//weight of the segment using the chamber eta-phi area
94 chamberIndex->Fill(chIndex, weight);
95 int sectorIndex = muSeg.sector();
96 //fill the count of segments; switch the sign here to make the plots
97 if (muSeg.z() < 0) { sectorIndex = - sectorIndex;}
98 chamberIndex_perSector->Fill(sectorIndex, chIndex, chambernorm);
101 //update sector eta index plots; switch the sign back here to make the plots
102 sectorIndex = muSeg.sector();
103
104 //position and direction plots
105 //protect against cases with no hit information!
106 Amg::Vector3D globalDir{muSeg.px(),muSeg.py(),muSeg.pz()};
107
108 if ( globalDir.mag() < DBL_EPSILON ) return;
109
110 float eta = globalDir.eta();
111 float phi = globalDir.phi();
112 etadir->Fill(eta, weight);
113 phidir->Fill(phi, weight);
114 etaphidir->Fill(eta,phi);
115
116}
117
118
119} // closing namespace Muon
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define y
void fill(const xAOD::MuonSegment &muonSeg, float weight=1.0)
static constexpr std::array< float, 17 > Chamberexpectedhits
static constexpr std::array< float, 17 > Chamberarea
MuonSegmentSlimPlots(PlotBase *pParent, const std::string &sDir)
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, const std::string &sDir)
Definition PlotBase.cxx:29
TH2F * Book2D(const std::string &name, const std::string &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: