Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EffPlotTool.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EffPlotTool.cpp
1
// This file is part of the Acts project.
2
//
3
// Copyright (C) 2019 CERN for the benefit of the Acts project
4
//
5
// This Source Code Form is subject to the terms of the Mozilla Public
6
// License, v. 2.0. If a copy of the MPL was not distributed with this
7
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
9
#include "
ActsExamples/Validation/EffPlotTool.hpp
"
10
11
#include "
Acts/Utilities/VectorHelpers.hpp
"
12
#include "
ActsFatras/EventData/Particle.hpp
"
13
14
#include <TEfficiency.h>
15
16
using
Acts::VectorHelpers::eta
;
17
using
Acts::VectorHelpers::perp
;
18
using
Acts::VectorHelpers::phi
;
19
20
ActsExamples::EffPlotTool::EffPlotTool
(
21
const
ActsExamples::EffPlotTool::Config
&
cfg
,
Acts::Logging::Level
lvl)
22
:
m_cfg
(cfg),
m_logger
(Acts::
getDefaultLogger
(
"EffPlotTool"
, lvl)) {}
23
24
void
ActsExamples::EffPlotTool::book
(
25
EffPlotTool::EffPlotCache
& effPlotCache)
const
{
26
PlotHelpers::Binning
bPhi =
m_cfg
.varBinning.at(
"Phi"
);
27
PlotHelpers::Binning
bEta =
m_cfg
.varBinning.at(
"Eta"
);
28
PlotHelpers::Binning
bPt =
m_cfg
.varBinning.at(
"Pt"
);
29
ACTS_DEBUG
(
"Initialize the histograms for efficiency plots"
);
30
// efficiency vs pT
31
effPlotCache.
trackEff_vs_pT
=
PlotHelpers::bookEff
(
32
"trackeff_vs_pT"
,
"Tracking efficiency;Truth pT [GeV/c];Efficiency"
, bPt);
33
// efficiency vs eta
34
effPlotCache.
trackEff_vs_eta
=
PlotHelpers::bookEff
(
35
"trackeff_vs_eta"
,
"Tracking efficiency;Truth #eta;Efficiency"
, bEta);
36
// efficiency vs phi
37
effPlotCache.
trackEff_vs_phi
=
PlotHelpers::bookEff
(
38
"trackeff_vs_phi"
,
"Tracking efficiency;Truth #phi;Efficiency"
, bPhi);
39
}
40
41
void
ActsExamples::EffPlotTool::clear
(
EffPlotCache
& effPlotCache)
const
{
42
delete
effPlotCache.
trackEff_vs_pT
;
43
delete
effPlotCache.
trackEff_vs_eta
;
44
delete
effPlotCache.
trackEff_vs_phi
;
45
}
46
47
void
ActsExamples::EffPlotTool::write
(
48
const
EffPlotTool::EffPlotCache
& effPlotCache)
const
{
49
ACTS_DEBUG
(
"Write the plots to output file."
);
50
effPlotCache.
trackEff_vs_pT
->Write();
51
effPlotCache.
trackEff_vs_eta
->Write();
52
effPlotCache.
trackEff_vs_phi
->Write();
53
}
54
55
void
ActsExamples::EffPlotTool::fill
(
EffPlotTool::EffPlotCache
& effPlotCache,
56
const
ActsFatras::Particle
& truthParticle,
57
bool
status
)
const
{
58
const
auto
t_phi =
phi
(truthParticle.
direction
());
59
const
auto
t_eta =
eta
(truthParticle.
direction
());
60
const
auto
t_pT = truthParticle.
transverseMomentum
();
61
62
PlotHelpers::fillEff
(effPlotCache.
trackEff_vs_pT
, t_pT, status);
63
PlotHelpers::fillEff
(effPlotCache.
trackEff_vs_eta
, t_eta, status);
64
PlotHelpers::fillEff
(effPlotCache.
trackEff_vs_phi
, t_phi, status);
65
}
acts
blob
sPHENIX
Examples
Framework
src
Validation
EffPlotTool.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration