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
DuplicationPlotTool.cpp
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file DuplicationPlotTool.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/DuplicationPlotTool.hpp
"
10
11
#include "
Acts/Definitions/Algebra.hpp
"
12
#include "
Acts/Utilities/VectorHelpers.hpp
"
13
#include "
ActsFatras/EventData/Particle.hpp
"
14
15
#include <TEfficiency.h>
16
#include <TProfile.h>
17
18
using
Acts::VectorHelpers::eta
;
19
using
Acts::VectorHelpers::perp
;
20
using
Acts::VectorHelpers::phi
;
21
using
Acts::VectorHelpers::theta
;
22
23
ActsExamples::DuplicationPlotTool::DuplicationPlotTool
(
24
const
ActsExamples::DuplicationPlotTool::Config
&
cfg
,
25
Acts::Logging::Level
lvl)
26
:
m_cfg
(cfg),
27
m_logger
(Acts::
getDefaultLogger
(
"DuplicationPlotTool"
, lvl)) {}
28
29
void
ActsExamples::DuplicationPlotTool::book
(
30
DuplicationPlotTool::DuplicationPlotCache
& duplicationPlotCache)
const
{
31
PlotHelpers::Binning
bPt =
m_cfg
.varBinning.at(
"Pt"
);
32
PlotHelpers::Binning
bEta =
m_cfg
.varBinning.at(
"Eta"
);
33
PlotHelpers::Binning
bPhi =
m_cfg
.varBinning.at(
"Phi"
);
34
PlotHelpers::Binning
bNum =
m_cfg
.varBinning.at(
"Num"
);
35
ACTS_DEBUG
(
"Initialize the histograms for duplication rate plots"
);
36
37
// duplication rate vs pT
38
duplicationPlotCache.
duplicationRate_vs_pT
=
39
PlotHelpers::bookEff
(
"duplicationRate_vs_pT"
,
40
"Duplication rate;pT [GeV/c];Duplication rate"
, bPt);
41
// duplication rate vs eta
42
duplicationPlotCache.
duplicationRate_vs_eta
=
PlotHelpers::bookEff
(
43
"duplicationRate_vs_eta"
,
"Duplication rate;#eta;Duplication rate"
, bEta);
44
// duplication rate vs phi
45
duplicationPlotCache.
duplicationRate_vs_phi
=
PlotHelpers::bookEff
(
46
"duplicationRate_vs_phi"
,
"Duplication rate;#phi;Duplication rate"
, bPhi);
47
48
// duplication number vs pT
49
duplicationPlotCache.
nDuplicated_vs_pT
=
PlotHelpers::bookProf
(
50
"nDuplicated_vs_pT"
,
"Number of duplicated track candidates"
, bPt, bNum);
51
// duplication number vs eta
52
duplicationPlotCache.
nDuplicated_vs_eta
=
PlotHelpers::bookProf
(
53
"nDuplicated_vs_eta"
,
"Number of duplicated track candidates"
, bEta,
54
bNum);
55
// duplication number vs phi
56
duplicationPlotCache.
nDuplicated_vs_phi
=
PlotHelpers::bookProf
(
57
"nDuplicated_vs_phi"
,
"Number of duplicated track candidates"
, bPhi,
58
bNum);
59
}
60
61
void
ActsExamples::DuplicationPlotTool::clear
(
62
DuplicationPlotCache
& duplicationPlotCache)
const
{
63
delete
duplicationPlotCache.
duplicationRate_vs_pT
;
64
delete
duplicationPlotCache.
duplicationRate_vs_eta
;
65
delete
duplicationPlotCache.
duplicationRate_vs_phi
;
66
delete
duplicationPlotCache.
nDuplicated_vs_pT
;
67
delete
duplicationPlotCache.
nDuplicated_vs_eta
;
68
delete
duplicationPlotCache.
nDuplicated_vs_phi
;
69
}
70
71
void
ActsExamples::DuplicationPlotTool::write
(
72
const
DuplicationPlotTool::DuplicationPlotCache
& duplicationPlotCache)
73
const
{
74
ACTS_DEBUG
(
"Write the plots to output file."
);
75
duplicationPlotCache.
duplicationRate_vs_pT
->Write();
76
duplicationPlotCache.
duplicationRate_vs_eta
->Write();
77
duplicationPlotCache.
duplicationRate_vs_phi
->Write();
78
duplicationPlotCache.
nDuplicated_vs_pT
->Write();
79
duplicationPlotCache.
nDuplicated_vs_eta
->Write();
80
duplicationPlotCache.
nDuplicated_vs_phi
->Write();
81
}
82
83
void
ActsExamples::DuplicationPlotTool::fill
(
84
DuplicationPlotTool::DuplicationPlotCache
& duplicationPlotCache,
85
const
Acts::BoundTrackParameters
& fittedParameters,
bool
status
)
const
{
86
const
auto
momentum
= fittedParameters.
momentum
();
87
const
double
fit_phi =
phi
(
momentum
);
88
const
double
fit_eta =
eta
(
momentum
);
89
const
double
fit_pT =
perp
(
momentum
);
90
91
PlotHelpers::fillEff
(duplicationPlotCache.
duplicationRate_vs_pT
, fit_pT,
92
status);
93
PlotHelpers::fillEff
(duplicationPlotCache.
duplicationRate_vs_eta
, fit_eta,
94
status);
95
PlotHelpers::fillEff
(duplicationPlotCache.
duplicationRate_vs_phi
, fit_phi,
96
status);
97
}
98
99
void
ActsExamples::DuplicationPlotTool::fill
(
100
DuplicationPlotTool::DuplicationPlotCache
& duplicationPlotCache,
101
const
ActsFatras::Particle
& truthParticle,
size_t
nDuplicatedTracks)
const
{
102
const
auto
t_phi =
phi
(truthParticle.
direction
());
103
const
auto
t_eta =
eta
(truthParticle.
direction
());
104
const
auto
t_pT = truthParticle.
transverseMomentum
();
105
106
PlotHelpers::fillProf
(duplicationPlotCache.
nDuplicated_vs_pT
, t_pT,
107
nDuplicatedTracks);
108
PlotHelpers::fillProf
(duplicationPlotCache.
nDuplicated_vs_eta
, t_eta,
109
nDuplicatedTracks);
110
PlotHelpers::fillProf
(duplicationPlotCache.
nDuplicated_vs_phi
, t_phi,
111
nDuplicatedTracks);
112
}
acts
blob
sPHENIX
Examples
Framework
src
Validation
DuplicationPlotTool.cpp
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:38
using
1.8.2 with
sPHENIX GitHub integration