ATLAS Offline Software
Loading...
Searching...
No Matches
MuonParamPlots.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
9
10namespace Muon {
11
12MuonParamPlots::MuonParamPlots(PlotBase* pParent, const std::string& sDir)
13 : PlotBase(pParent, sDir)
14
15{}
16
18 msInnerMatchChi2 = Book1D("msInnerMatchChi2",
19 "inner match #chi^{2};inner match #chi^{2};;Entries", 100, 0., 100.);
20
21 ELoss = Book1D("ELoss", "ELoss;ELoss [GeV];Entries", 100, 0, 20);
22 ELossSigma = Book1D("ELossSigma", "ELossSigma;ELossSgima [GeV];Entries", 50, 0, 5);
23
24 paramELoss = Book1D("paramELoss", "paramELoss;paramELoss [GeV];Entries", 50, 0, 10);
25 measELoss = Book1D("measELoss", "measELoss;measELoss [GeV];Entries", 100, 0, 20);
26}
27
28void MuonParamPlots::fill(const xAOD::Muon& mu, float weight) {
29 FillPlot(msInnerMatchChi2, mu, xAOD::Muon::ParamDef::msInnerMatchChi2, weight);
30 FillPlot(ELoss, mu, xAOD::Muon::ParamDef::EnergyLoss, 0.001, weight);
31 FillPlot(measELoss, mu, xAOD::Muon::ParamDef::MeasEnergyLoss, 0.001, weight);
32 FillPlot(ELossSigma, mu, xAOD::Muon::ParamDef::EnergyLossSigma, 0.001, weight);
33 FillPlot(paramELoss, mu, xAOD::Muon::ParamDef::ParamEnergyLoss, 0.001, weight);
34}
35
36void MuonParamPlots::FillPlot(TH1* hist, const xAOD::Muon& mu,
37 const xAOD::Muon::ParamDef paramDef, float scale,
38 float weight) {
39 if (mu.muonType() == xAOD::Muon::MuonType::CaloTagged) {
40 return; // protection
41 }
42 float fpar = 0;
43 static const SG::ConstAccessor<float> elossAcc("EnergyLoss");
44 if (elossAcc.isAvailable(mu)) {
45 if (mu.parameter(fpar, paramDef)) {
46 hist->Fill(scale * fpar, weight); // scale to GeV, if needed
47 }
48 }
49 return;
50}
51
52} // namespace Muon
Helper class to provide constant type-safe access to aux data.
MuonParamPlots(PlotBase *pParent, const std::string &sDir)
void fill(const xAOD::Muon &mu, float weight=1.0)
void FillPlot(TH1 *hist, const xAOD::Muon &mu, const xAOD::Muon::ParamDef paramDef, float scale=1, 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
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Muon_v1 Muon
Reference the current persistent version: