ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTruthHitPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace Muon{
11
12MuonTruthHitPlots::MuonTruthHitPlots(PlotBase* pParent, const std::string& sDir):
13PlotBase(pParent, sDir)
14
15{
16 precMatchedHitsSummed=Book1D("precMatchedHitsSummed","summed precision hits matched to truth (all chambers)",21,-0.5,20.5);
17 precMatchedHitsBIS=Book1D("precMatchedHitsBIS","BIS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
18 precMatchedHitsBIL=Book1D("precMatchedHitsBIL","BIL precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
19 precMatchedHitsBMS=Book1D("precMatchedHitsBMS","BMS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
20 precMatchedHitsBML=Book1D("precMatchedHitsBML","BML precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
21 precMatchedHitsBOS=Book1D("precMatchedHitsBOS","BOS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
22 precMatchedHitsBOL=Book1D("precMatchedHitsBOL","BOL precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
23 precMatchedHitsBEE=Book1D("precMatchedHitsBEE","BEE precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
24 precMatchedHitsEIS=Book1D("precMatchedHitsEIS","EIS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
25 precMatchedHitsEIL=Book1D("precMatchedHitsEIL","EIL precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
26 precMatchedHitsEMS=Book1D("precMatchedHitsEMS","EMS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
27 precMatchedHitsEML=Book1D("precMatchedHitsEML","EML precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
28 precMatchedHitsEOS=Book1D("precMatchedHitsEOS","EOS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
29 precMatchedHitsEOL=Book1D("precMatchedHitsEOL","EOL precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
30 precMatchedHitsEES=Book1D("precMatchedHitsEES","EES precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
31 precMatchedHitsEEL=Book1D("precMatchedHitsEEL","EEL precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
32 precMatchedHitsCSS=Book1D("precMatchedHitsCSS","CSS precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
33 precMatchedHitsCSL=Book1D("precMatchedHitsCSL","CSL precision hits matched to truth;matched hits;entries",21,-0.5,20.5);
34
35 phiMatchedHitsSummed=Book1D("phiMatchedHitsSummed","summed phi hits matched to truth (all chambers)",21,-0.5,20.5 );
36 phiMatchedHitsBM1=Book1D("phiMatchedHitsBM1","BM1 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
37 phiMatchedHitsBM2=Book1D("phiMatchedHitsBM2","BM2 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
38 phiMatchedHitsBO1=Book1D("phiMatchedHitsBO1","BO1 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
39 phiMatchedHitsBO2=Book1D("phiMatchedHitsBO2","BO2 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
40 phiMatchedHitsT1=Book1D("phiMatchedHitsT1","T1 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
41 phiMatchedHitsT2=Book1D("phiMatchedHitsT2","T2 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
42 phiMatchedHitsT3=Book1D("phiMatchedHitsT3","T3 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
43 phiMatchedHitsT4=Book1D("phiMatchedHitsT4","T4 phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
44 phiMatchedHitsCSC=Book1D("phiMatchedHitsCSC","CSC phi hits matched to truth;matched hits;entries",21,-0.5,20.5 );
45
46 trigEtaMatchedHitsSummed=Book1D("trigEtaMatchedHitsSummed","summed trigEta hits matched to truth (all chambers)",21,-0.5,20.5 );
47 trigEtaMatchedHitsBM1=Book1D("trigEtaMatchedHitsBM1","BM1 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
48 trigEtaMatchedHitsBM2=Book1D("trigEtaMatchedHitsBM2","BM2 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
49 trigEtaMatchedHitsBO1=Book1D("trigEtaMatchedHitsBO1","BO1 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
50 trigEtaMatchedHitsBO2=Book1D("trigEtaMatchedHitsBO2","BO2 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
51 trigEtaMatchedHitsT1=Book1D("trigEtaMatchedHitsT1","T1 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
52 trigEtaMatchedHitsT2=Book1D("trigEtaMatchedHitsT2","T2 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
53 trigEtaMatchedHitsT3=Book1D("trigEtaMatchedHitsT3","T3 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
54 trigEtaMatchedHitsT4=Book1D("trigEtaMatchedHitsT4","T4 trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
55 // trigEtaMatchedHitsCSC=Book1D("trigEtaMatchedHitsCSC","CSC trigEta hits matched to truth;matched hits;entries",21,-0.5,20.5 );
56
57 }
58
59 void MuonTruthHitPlots::fill(const xAOD::Muon& muon, float weight){
60
61 fillPlot(precMatchedHitsSummed,"nprecMatchedHitsPerChamberLayer", muon, weight);
62 fillPlot(precMatchedHitsBIS,"nprecMatchedHitsPerChamberLayer", ChIdx::BIS, muon, weight);
63 fillPlot(precMatchedHitsBIL,"nprecMatchedHitsPerChamberLayer", ChIdx::BIL, muon, weight);
64 fillPlot(precMatchedHitsBMS,"nprecMatchedHitsPerChamberLayer", ChIdx::BMS, muon, weight);
65 fillPlot(precMatchedHitsBML,"nprecMatchedHitsPerChamberLayer", ChIdx::BML, muon, weight);
66 fillPlot(precMatchedHitsBOS,"nprecMatchedHitsPerChamberLayer", ChIdx::BOS, muon, weight);
67 fillPlot(precMatchedHitsBOL,"nprecMatchedHitsPerChamberLayer", ChIdx::BOL, muon, weight);
68 fillPlot(precMatchedHitsBEE,"nprecMatchedHitsPerChamberLayer", ChIdx::BEE, muon, weight);
69 fillPlot(precMatchedHitsEIS,"nprecMatchedHitsPerChamberLayer", ChIdx::EIS, muon, weight);
70 fillPlot(precMatchedHitsEIL,"nprecMatchedHitsPerChamberLayer", ChIdx::EIL, muon, weight);
71 fillPlot(precMatchedHitsEMS,"nprecMatchedHitsPerChamberLayer", ChIdx::EMS, muon, weight);
72 fillPlot(precMatchedHitsEML,"nprecMatchedHitsPerChamberLayer", ChIdx::EML, muon, weight);
73 fillPlot(precMatchedHitsEOS,"nprecMatchedHitsPerChamberLayer", ChIdx::EOS, muon, weight);
74 fillPlot(precMatchedHitsEOL,"nprecMatchedHitsPerChamberLayer", ChIdx::EOL, muon, weight);
75 fillPlot(precMatchedHitsEES,"nprecMatchedHitsPerChamberLayer", ChIdx::EES, muon, weight);
76 fillPlot(precMatchedHitsEEL,"nprecMatchedHitsPerChamberLayer", ChIdx::EEL, muon, weight);
77 fillPlot(precMatchedHitsCSS,"nprecMatchedHitsPerChamberLayer", ChIdx::CSS, muon, weight);
78 fillPlot(precMatchedHitsCSL,"nprecMatchedHitsPerChamberLayer", ChIdx::CSL, muon, weight);
79
80 fillPlot(phiMatchedHitsSummed,"nphiMatchedHitsPerChamberLayer", muon, weight);
81 fillPlot(phiMatchedHitsBM1, "nphiMatchedHitsPerChamberLayer", PhiIdx::BM1, muon,weight);
82 fillPlot(phiMatchedHitsBM2, "nphiMatchedHitsPerChamberLayer", PhiIdx::BM2, muon, weight);
83 fillPlot(phiMatchedHitsBO1, "nphiMatchedHitsPerChamberLayer", PhiIdx::BO1, muon, weight);
84 fillPlot(phiMatchedHitsBO2, "nphiMatchedHitsPerChamberLayer", PhiIdx::BO2, muon, weight);
85 fillPlot(phiMatchedHitsT1, "nphiMatchedHitsPerChamberLayer", PhiIdx::T1, muon, weight);
86 fillPlot(phiMatchedHitsT2, "nphiMatchedHitsPerChamberLayer", PhiIdx::T2, muon, weight);
87 fillPlot(phiMatchedHitsT3, "nphiMatchedHitsPerChamberLayer", PhiIdx::T3, muon, weight);
88 fillPlot(phiMatchedHitsT4, "nphiMatchedHitsPerChamberLayer", PhiIdx::T4, muon, weight);
89 fillPlot(phiMatchedHitsCSC, "nphiMatchedHitsPerChamberLayer", PhiIdx::CSC, muon, weight);
90
91 fillPlot(trigEtaMatchedHitsSummed,"ntrigEtaMatchedHitsPerChamberLayer", muon, weight);
92 fillPlot(trigEtaMatchedHitsBM1, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::BM1, muon, weight);
93 fillPlot(trigEtaMatchedHitsBM2, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::BM2, muon, weight);
94 fillPlot(trigEtaMatchedHitsBO1, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::BO1, muon, weight);
95 fillPlot(trigEtaMatchedHitsBO2, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::BO2, muon, weight);
96 fillPlot(trigEtaMatchedHitsT1, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::T1, muon, weight);
97 fillPlot(trigEtaMatchedHitsT2, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::T2, muon, weight);
98 fillPlot(trigEtaMatchedHitsT3, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::T3, muon, weight);
99 fillPlot(trigEtaMatchedHitsT4, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::T4, muon, weight);
100 // fillPlot(trigEtaMatchedHitsCSC, "ntrigEtaMatchedHitsPerChamberLayer", PhiIdx::CSC, muon);
101
102}
103
104 void MuonTruthHitPlots::fillPlot(TH1* hitPlots, const std::string& sInfo,const xAOD::Muon& muon, float weight){
105 //protection
106 if (muon.author()!=xAOD::Muon::MuidCo && muon.author()!=xAOD::Muon::MuidSA && muon.author()!=xAOD::Muon::MuGirl) return;
107
109 if (!acc.isAvailable(muon)) return;
110 std::vector<unsigned int> vec=acc(muon);
111 for (unsigned int i=0;i<vec.size();i++) {
112 hitPlots->Fill(vec[i], weight);
113 }
114}
115
116 void MuonTruthHitPlots::fillPlot(TH1* hitPlots, const std::string& sInfo, const Muon::MuonStationIndex::ChIndex& index, const xAOD::Muon& muon, float weight){
117 //protection
118 if (muon.author()!=xAOD::Muon::MuidCo && muon.author()!=xAOD::Muon::MuidSA && muon.author()!=xAOD::Muon::MuGirl) return;
119 using namespace Muon::MuonStationIndex;
121 if (!acc.isAvailable(muon)) return;
122 const std::vector<unsigned int>& vec=acc(muon);
123 if (vec.size()) hitPlots->Fill(vec[toInt(index)], weight);
124}
125 void MuonTruthHitPlots::fillPlot(TH1* hitPlots, const std::string& sInfo, const Muon::MuonStationIndex::PhiIndex& index, const xAOD::Muon& muon, float weight){
126 //protection
127 if (muon.author()!=xAOD::Muon::MuidCo && muon.author()!=xAOD::Muon::MuidSA && muon.author()!=xAOD::Muon::MuGirl) return;
128 using namespace Muon::MuonStationIndex;
130 if (!acc.isAvailable(muon)) return;
131 const std::vector<unsigned int>& vec=acc(muon);
132 if (vec.size()) hitPlots->Fill(vec[toInt(index)], weight);
133
134}
135
136
137}
std::vector< size_t > vec
Helper class to provide constant type-safe access to aux data.
MuonTruthHitPlots(PlotBase *pParent, const std::string &sDir)
void fill(const xAOD::Muon &muon, float weight=1.0)
void fillPlot(TH1 *hitPlots, const std::string &sInfo, const Muon::MuonStationIndex::ChIndex &index, const xAOD::Muon &muon, float weight=1.0)
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
Helper class to provide constant type-safe access to aux data.
PhiIndex
enum to classify the different phi layers in the muon spectrometer
constexpr int toInt(const EnumType enumVal)
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.
MuonStationIndex::PhiIndex PhiIdx
MuonStationIndex::ChIndex ChIdx
Definition index.py:1
Muon_v1 Muon
Reference the current persistent version: