ATLAS Offline Software
Loading...
Searching...
No Matches
TriggerMuonValidationPlots.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
7#include <utility>
8#include <format>
9
11TriggerMuonValidationPlots::TriggerMuonValidationPlots(PlotBase* pParent, const std::string& sDir, std::set<int> authors,
12 bool /*isData*/, bool doTrigMuonL1Validation, bool doTrigMuonL2Validation,
13 bool doTrigMuonEFValidation, std::vector<std::vector<std::string>> ChainSeed,
14 std::vector<std::string> L1MuonItems) :
15 PlotBase(pParent, sDir),
16 m_selectedAuthors(authors.begin(), authors.end()),
17 m_doTrigMuonL1Validation(doTrigMuonL1Validation),
18 m_doTrigMuonL2Validation(doTrigMuonL2Validation),
19 m_doTrigMuonEFValidation(doTrigMuonEFValidation),
20 m_ChainSeed(std::move(ChainSeed)),
21 m_L1MuonItems(std::move(L1MuonItems)) {
22 for (unsigned int i = 0; i < m_ChainSeed.size(); i++) {
23 m_chains.push_back(m_ChainSeed[i][0]);
24 m_seeds.push_back(m_ChainSeed[i][1]);
25 }
26
27 if (m_doTrigMuonL1Validation) m_oL1TriggerMuonPlots = std::make_unique<L1TriggerMuonPlots>(this, "trigger/L1");
29 m_oL2TriggerMuonPlots.push_back(std::make_unique<HLTriggerMuonPlots>(this, "trigger/L2/StandAlone"));
30 m_oL2TriggerMuonPlots.push_back(std::make_unique<HLTriggerMuonPlots>(this, "trigger/L2/Combined"));
32 std::make_unique<ResoTriggerMuonPlots>(this, "trigger/L2/StandAlone/Resolution/BARREL/", ""));
33 m_oL2TriggerMuonBarrelResolutionPlots.push_back(std::make_unique<ResoTriggerMuonPlots>(this, "trigger/L2/Combined/Resolution/BARREL/", ""));
35 std::make_unique<ResoTriggerMuonPlots>(this, "trigger/L2/StandAlone/Resolution/ENDCAPS/", ""));
37 std::make_unique<ResoTriggerMuonPlots>(this, "trigger/L2/Combined/Resolution/ENDCAPS/", ""));
39 std::make_unique<ResoTriggerMuonPlots>(this, "trigger/L2/StandAlone/Resolution/WHOLE_DETECT/", ""));
40 m_oL2TriggerMuonResolutionPlots.push_back(std::make_unique<ResoTriggerMuonPlots>(this, "trigger/L2/Combined/Resolution/WHOLE_DETECT/", ""));
41 }
42
43 // define a histogram class for each of the selected muon authors
44 for (unsigned int i = 0; i < m_selectedAuthors.size(); i++) {
45 auto sAuthor = xAOD::Muon::toString(static_cast<xAOD::Muon::Author>(m_selectedAuthors[i]));
46 if (m_doTrigMuonEFValidation) m_oEFTriggerMuonPlots.push_back(std::make_unique<HLTriggerMuonPlots>(this, std::format("trigger/EF/{:}", sAuthor)));
49 std::make_unique<ResoTriggerMuonPlots>(this, std::format("trigger/EF/{:}/Resolution/BARREL/", sAuthor ), ""));
52 std::make_unique<ResoTriggerMuonPlots>(this, std::format("trigger/EF/{:}/Resolution/ENDCAPS/", sAuthor), ""));
55 std::make_unique<ResoTriggerMuonPlots>(this, std::format("trigger/EF/{:}/Resolution/WHOLE_DETECT/", sAuthor), ""));
56 }
57
58 for (unsigned int i = 0; i < m_L1MuonItems.size(); i++) {
61 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_L1MuonItems[i] + "_Efficiency/BARREL/"));
64 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_L1MuonItems[i] + "_Efficiency/ENDCAPS/"));
67 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_L1MuonItems[i] + "_Efficiency/WHOLE_DETECT/"));
68 }
69 for (unsigned int i = 0; i < m_chains.size(); i++) {
72 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_chains[i] + "_Efficiency/BARREL/"));
75 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_chains[i] + "_Efficiency/ENDCAPS/"));
78 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_chains[i] + "_Efficiency/WHOLE_DETECT/"));
79 }
80 for (unsigned int i = 0; i < m_chains.size(); i++) {
83 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_chains[i] + "_wrt_" + m_seeds[i] + "_Efficiency/BARREL/"));
86 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_chains[i] + "_wrt_" + m_seeds[i] + "_Efficiency/ENDCAPS/"));
89 std::make_unique<TriggerEfficiencyPlots>(this, "trigger/" + m_chains[i] + "_wrt_" + m_seeds[i] + "_Efficiency/WHOLE_DETECT/"));
90 }
91 PlateauTreshold = 0.;
92}
93
95
97
99
101
103 for (unsigned int i = 0; i < m_selectedAuthors.size(); i++) {
104 if (Trigmu.isAuthor(static_cast<xAOD::Muon::Author>(m_selectedAuthors[i]))) {
105 // if (Trigmu.isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] ) || m_selectedAuthors[i]==xAOD::Muon::NumberOfMuonAuthors) {
106 m_oEFTriggerMuonPlots[i]->fill(Trigmu);
107 }
108 }
109}
110
112 for (unsigned int i = 0; i < m_selectedAuthors.size(); i++) {
113 if (Trigmu.isAuthor((xAOD::Muon::Author)m_selectedAuthors[i])) {
114 // if (Trigmu.isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] ) || m_selectedAuthors[i]==xAOD::Muon::NumberOfMuonAuthors) {
115 m_oEFTriggerMuonResolutionPlots[i]->fill(Trigmu, Recomu);
116 if (std::abs(Recomu.eta()) < 1.05) m_oEFTriggerMuonBarrelResolutionPlots[i]->fill(Trigmu, Recomu);
117 if (std::abs(Recomu.eta()) > 1.05) m_oEFTriggerMuonEndcapsResolutionPlots[i]->fill(Trigmu, Recomu);
118 }
119 }
120}
121
123 m_oL2TriggerMuonResolutionPlots[0]->fill(L2SAmu, Recomu);
124 if (std::abs(Recomu.eta()) < 1.05) m_oL2TriggerMuonBarrelResolutionPlots[0]->fill(L2SAmu, Recomu);
125 if (std::abs(Recomu.eta()) > 1.05) m_oL2TriggerMuonEndcapsResolutionPlots[0]->fill(L2SAmu, Recomu);
126}
127
129 m_oL2TriggerMuonResolutionPlots[1]->fill(L2CBmu, Recomu);
130 if (std::abs(Recomu.eta()) < 1.05) m_oL2TriggerMuonBarrelResolutionPlots[1]->fill(L2CBmu, Recomu);
131 if (std::abs(Recomu.eta()) > 1.05) m_oL2TriggerMuonEndcapsResolutionPlots[1]->fill(L2CBmu, Recomu);
132}
133
135
136void TriggerMuonValidationPlots::fill(const xAOD::Muon& Trigmu, const xAOD::Muon& Recomu) { fillTriggerMuonPlots(Trigmu, Recomu); }
137
139 fillTriggerMuonPlots(L2SAmu, Recomu);
140}
141
143 fillTriggerMuonPlots(L2CBmu, Recomu);
144}
145
147
149
151
152void TriggerMuonValidationPlots::fillNumEff(const xAOD::Muon& mu, const std::string& selectedChain) {
153 float PlateauTreshold = findTrigTreshold(selectedChain);
154 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
155 for (unsigned int i = 0; i < m_chains.size(); i++) {
156 if (m_chains[i] == selectedChain) {
158 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05)) m_oEFTriggerChainBarrelEfficiencyPlots[i]->fillNumerator(mu, PlateauTreshold);
159 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05)) m_oEFTriggerChainEndcapsEfficiencyPlots[i]->fillNumerator(mu, PlateauTreshold);
160 }
161 }
162}
163
164void TriggerMuonValidationPlots::fillDenEff(const xAOD::Muon& mu, const std::string& selectedChain) {
165 float PlateauTreshold = findTrigTreshold(selectedChain);
166 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
167 for (unsigned int i = 0; i < m_chains.size(); i++) {
168 if (m_chains[i] == selectedChain) {
169 m_oEFTriggerChainEfficiencyPlots[i]->fillDenominator(mu, PlateauTreshold);
170 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05))
172 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05))
174 }
175 }
176}
177
178void TriggerMuonValidationPlots::fillFeatPlots(const xAOD::Muon& mu, const std::string& selectedChain) {
179 float PlateauTreshold = findTrigTreshold(selectedChain);
180 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
181 for (unsigned int i = 0; i < m_chains.size(); i++) {
182 if (m_chains[i] == selectedChain) {
184 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05)) m_oEFTriggerChainBarrelEfficiencyPlots[i]->fillFeatures(mu, PlateauTreshold);
185 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05)) m_oEFTriggerChainEndcapsEfficiencyPlots[i]->fillFeatures(mu, PlateauTreshold);
186 }
187 }
188}
189
190void TriggerMuonValidationPlots::fillNumL1Eff(const xAOD::Muon& mu, const std::string& selectedL1MuonItem) {
191 float PlateauTreshold = findTrigTreshold(selectedL1MuonItem);
192 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
193 for (unsigned int i = 0; i < m_L1MuonItems.size(); i++) {
194 if (m_L1MuonItems[i] == selectedL1MuonItem) {
196 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05)) m_oL1TriggerChainBarrelEfficiencyPlots[i]->fillNumerator(mu, PlateauTreshold);
197 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05)) m_oL1TriggerChainEndcapsEfficiencyPlots[i]->fillNumerator(mu, PlateauTreshold);
198 }
199 }
200}
201
202void TriggerMuonValidationPlots::fillDenL1Eff(const xAOD::Muon& mu, const std::string& selectedL1MuonItem) {
203 float PlateauTreshold = findTrigTreshold(selectedL1MuonItem);
204 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
205 for (unsigned int i = 0; i < m_L1MuonItems.size(); i++) {
206 if (m_L1MuonItems[i] == selectedL1MuonItem) {
207 m_oL1TriggerChainEfficiencyPlots[i]->fillDenominator(mu, PlateauTreshold);
208 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05))
210 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05))
212 }
213 }
214}
215void TriggerMuonValidationPlots::fillFeatPlots(const xAOD::MuonRoI& TrigL1mu, const std::string& selectedL1MuonItem) {
216 float PlateauTreshold = findTrigTreshold(selectedL1MuonItem);
217 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
220 ROIinMuons->setStore(ROIinMuonsAux);
221 xAOD::Muon* myROI = new xAOD::Muon();
222 ROIinMuons->push_back(myROI);
223 myROI->setP4(TrigL1mu.thrValue(), TrigL1mu.eta(), TrigL1mu.phi());
224
225 for (unsigned int i = 0; i < m_L1MuonItems.size(); i++) {
226 if (m_L1MuonItems[i] == selectedL1MuonItem) {
227 m_oL1TriggerChainEfficiencyPlots[i]->fillFeatures(*myROI, PlateauTreshold);
228 if (((TrigL1mu.eta()) > -1.05) && ((TrigL1mu.eta()) < 1.05))
230 if (((TrigL1mu.eta()) < -1.05) || ((TrigL1mu.eta()) > 1.05))
232 }
233 }
234 delete ROIinMuons;
235 delete ROIinMuonsAux;
236}
237
238void TriggerMuonValidationPlots::fillDenRELEff(const xAOD::Muon& mu, const std::string& selectedChain) {
239 float PlateauTreshold = findTrigTreshold(selectedChain);
240 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
241 for (unsigned int i = 0; i < m_chains.size(); i++) {
242 if (m_chains[i] == selectedChain) {
244 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05))
246 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05))
248 }
249 }
250}
251
252void TriggerMuonValidationPlots::fillNumRELEff(const xAOD::Muon& mu, const std::string& selectedChain) {
253 float PlateauTreshold = findTrigTreshold(selectedChain);
254 PlateauTreshold = PlateauTreshold * 1000. * 1.05;
255 for (unsigned int i = 0; i < m_chains.size(); i++) {
256 if (m_chains[i] == selectedChain) {
258 if (((mu.eta()) > -1.05) && ((mu.eta()) < 1.05))
260 if (((mu.eta()) < -1.05) || ((mu.eta()) > 1.05))
262 }
263 }
264}
265
267 float PlateauTreshold;
268 std::string str(chain);
269 TString temp;
270 if (str.find("HLT_") != std::string::npos) {
271 for (unsigned int l = 0; l < str.size(); l++) {
272 if (isdigit(str[l])) {
273 for (unsigned int a = l; a < str.size(); a++) {
274 // if (str[a]=='_') break;
275 if ((isdigit(str[a])) == 0) break;
276 temp += str[a];
277 }
278 break;
279 }
280 }
281 }
282 if (str.find("L1_MU") != std::string::npos) {
283 for (unsigned int l = 0; l < str.size(); l++) {
284 if ((str[l]) == 'U') {
285 for (unsigned int a = l + 1; a < str.size(); a++) {
286 // if (str[a]=='_') break;
287 temp += str[a];
288 }
289 break;
290 }
291 }
292 }
293 PlateauTreshold = temp.Atof();
294 return PlateauTreshold;
295}
static Double_t a
value_type push_back(value_type pElem)
Add an element to the end of the collection.
PlotBase(PlotBase *parent, std::string_view sDir)
Definition PlotBase.cxx:29
void fillNumEff(const xAOD::Muon &Trigmu, const std::string &selectedChain)
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oL1TriggerChainBarrelEfficiencyPlots
std::vector< std::unique_ptr< ResoTriggerMuonPlots > > m_oL2TriggerMuonBarrelResolutionPlots
std::vector< std::unique_ptr< ResoTriggerMuonPlots > > m_oEFTriggerMuonBarrelResolutionPlots
TriggerMuonValidationPlots(PlotBase *pParent, const std::string &sDir, std::set< int > authors, bool isData, bool doTrigMuonL1Validation, bool doTrigMuonL2Validation, bool doTrigMuonEFValidation, std::vector< std::vector< std::string > > ChainSeed, std::vector< std::string > L1MuonItems)
std::vector< std::unique_ptr< ResoTriggerMuonPlots > > m_oEFTriggerMuonResolutionPlots
std::vector< std::unique_ptr< ResoTriggerMuonPlots > > m_oL2TriggerMuonEndcapsResolutionPlots
std::vector< std::unique_ptr< HLTriggerMuonPlots > > m_oL2TriggerMuonPlots
void fillDenRELEff(const xAOD::Muon &Trigmu, const std::string &selectedChain)
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oEFTriggerChainRELEfficiencyPlots
void fillNumL1Eff(const xAOD::Muon &Trigmu, const std::string &selectedChain)
void fillTriggerMuonPlots(const xAOD::Muon &Trigmu)
virtual ~TriggerMuonValidationPlots()
std::vector< std::unique_ptr< HLTriggerMuonPlots > > m_oEFTriggerMuonPlots
std::vector< std::string > m_seeds
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oEFTriggerChainBarrelEfficiencyPlots
void fillDenEff(const xAOD::Muon &Trigmu, const std::string &selectedChain)
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oEFTriggerChainEfficiencyPlots
void fillFeatPlots(const xAOD::Muon &Trigmu, const std::string &selectedChain)
std::vector< unsigned int > m_selectedAuthors
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oEFTriggerChainEndcapsEfficiencyPlots
std::vector< std::string > m_chains
std::vector< std::vector< std::string > > m_ChainSeed
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oL1TriggerChainEndcapsEfficiencyPlots
void fillDenL1Eff(const xAOD::Muon &Trigmu, const std::string &selectedChain)
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oEFTriggerChainEndcapsRELEfficiencyPlots
float findTrigTreshold(const TString &chain)
std::vector< std::unique_ptr< ResoTriggerMuonPlots > > m_oEFTriggerMuonEndcapsResolutionPlots
std::vector< std::string > m_L1MuonItems
void fill(const xAOD::MuonRoI &TrigL1mu)
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oL1TriggerChainEfficiencyPlots
std::unique_ptr< L1TriggerMuonPlots > m_oL1TriggerMuonPlots
std::vector< std::unique_ptr< ResoTriggerMuonPlots > > m_oL2TriggerMuonResolutionPlots
std::vector< std::unique_ptr< TriggerEfficiencyPlots > > m_oEFTriggerChainBarrelRELEfficiencyPlots
void fillNumRELEff(const xAOD::Muon &Trigmu, const std::string &selectedChain)
float eta() const
The pseudorapidity ( ) of the muon candidate.
float thrValue() const
The highest threshold value (in MeV) passed by the muon candidate.
float phi() const
The azimuthal angle ( ) of the muon candidate.
bool isAuthor(const Author author) const
Returns 'true' if 'author' is the an author of this muon.
Definition Muon_v1.cxx:97
virtual double eta() const override
The pseudorapidity ( ) of the particle.
void setP4(double pt, double eta, double phi)
Set method for IParticle values.
Definition Muon_v1.cxx:58
STL namespace.
L2CombinedMuon_v1 L2CombinedMuon
Define the latest version of the muon CB class.
MuonAuxContainer_v5 MuonAuxContainer
Definition of the current Muon auxiliary container.
Muon_v1 Muon
Reference the current persistent version:
L2StandAloneMuon_v2 L2StandAloneMuon
Define the latest version of the muon SA class.
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
MuonRoI_v1 MuonRoI
Definition MuonRoI.h:15