ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthPartonLevelAnalysisAlgorithms
Root
CalcTopPartonHistory.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
7
8
#include <array>
9
#include <utility>
10
11
#include "
PartonHistory/CalcPartonHistory.h
"
12
#include "
VectorHelpers/DecoratorHelpers.h
"
13
14
namespace
CP
{
15
using
ROOT::Math::PtEtaPhiMVector;
16
17
void
CalcPartonHistory::FillXPartonHistory
(
const
std::string& parent,
18
const
std::string& symbolX) {
19
PtEtaPhiMVector v;
20
int
pdgId = 0;
21
const
std::array<std::string, 2> fsrStates{
"beforeFSR"
,
"afterFSR"
};
22
const
std::array<std::pair<std::string, std::string>, 3> particleTags{{
23
{
""
,
"X"
},
24
{
"Decay1"
,
"Xdecay1"
},
25
{
"Decay2"
,
"Xdecay2"
},
26
}};
27
28
for
(
const
auto
& fsrState : fsrStates) {
29
for
(
const
auto
& [sourceSuffix, outputSuffix] : particleTags) {
30
const
auto
outputTag =
"MC_"
+ outputSuffix +
"_"
+ fsrState +
"_from_"
+ parent;
31
const
auto
sourcePrefix =
"MC_"
+ parent +
"_"
;
32
33
if
(
RetrieveParticleInfo
(
m_prefix
+
"_"
+ sourcePrefix +
"W"
+ sourceSuffix +
"_"
+ fsrState, v, pdgId))
34
m_dec
.decorateParticle(outputTag, v, pdgId);
35
else
if
(
RetrieveParticleInfo
(
m_prefix
+
"_"
+ sourcePrefix + symbolX + sourceSuffix +
"_"
+ fsrState, v, pdgId))
36
m_dec
.decorateParticle(outputTag, v, pdgId);
37
else
38
m_dec
.decorateDefault(outputTag);
39
}
40
}
41
}
42
43
void
CalcPartonHistory::FillTopPartonHistory
(
bool
fcnc) {
44
FillGenericPartonHistory
(
"MC_t_beforeFSR"
,
"MC_t_beforeFSR"
, 0);
45
FillGenericPartonHistory
(
"MC_t_afterFSR"
,
"MC_t_afterFSR"
, 0);
46
if
(fcnc) {
47
PtEtaPhiMVector v;
48
int
pdgId = 0;
49
const
std::array<std::string, 2> fsrStates{
"beforeFSR"
,
"afterFSR"
};
50
const
std::array<std::string, 3> flavors{
"b"
,
"c"
,
"u"
};
// The u-quark is currently not stored in the DAOD_PHYS
51
// truth record, but it's kept here for future-proofing.
52
for
(
const
auto
& fsrState : fsrStates) {
53
const
auto
outputTag =
"MC_q_"
+ fsrState +
"_from_t"
;
54
bool
found =
false
;
55
for
(
const
auto
& flavor : flavors) {
56
const
auto
key =
m_prefix
+
"_"
+ (
"MC_t_"
+ flavor +
"_"
+ fsrState);
57
if
(
RetrieveParticleInfo
(key, v, pdgId)) {
58
m_dec
.decorateParticle(outputTag, v, pdgId);
59
found =
true
;
60
break
;
61
}
62
}
63
if
(!found)
m_dec
.decorateDefault(outputTag);
64
}
65
FillXPartonHistory
(
"t"
);
66
}
else
{
67
FillGenericPartonHistory
(
"MC_t_b_beforeFSR"
,
"MC_b_beforeFSR_from_t"
, 0);
68
FillGenericPartonHistory
(
"MC_t_b_afterFSR"
,
"MC_b_afterFSR_from_t"
, 0);
69
FillWPartonHistory
(
"t"
);
70
}
71
}
72
73
void
CalcPartonHistory::FillAntiTopPartonHistory
(
bool
fcnc) {
74
FillGenericPartonHistory
(
"MC_tbar_beforeFSR"
,
"MC_tbar_beforeFSR"
, 0);
75
FillGenericPartonHistory
(
"MC_tbar_afterFSR"
,
"MC_tbar_afterFSR"
, 0);
76
if
(fcnc) {
77
PtEtaPhiMVector v;
78
int
pdgId = 0;
79
const
std::array<std::string, 2> fsrStates{
"beforeFSR"
,
"afterFSR"
};
80
const
std::array<std::string, 3> flavors{
"bbar"
,
"cbar"
,
"ubar"
};
// "ubar" kept for future-proofing
81
82
for
(
const
auto
& fsrState : fsrStates) {
83
const
auto
outputTag =
"MC_qbar_"
+ fsrState +
"_from_tbar"
;
84
bool
found =
false
;
85
for
(
const
auto
& flavor : flavors) {
86
const
auto
key =
m_prefix
+
"_"
+ (
"MC_tbar_"
+ flavor +
"_"
+ fsrState);
87
if
(
RetrieveParticleInfo
(key, v, pdgId)) {
88
m_dec
.decorateParticle(outputTag, v, pdgId);
89
found =
true
;
90
break
;
91
}
92
}
93
if
(!found)
m_dec
.decorateDefault(outputTag);
94
}
95
FillXPartonHistory
(
"tbar"
);
96
}
else
{
97
FillGenericPartonHistory
(
"MC_tbar_bbar_beforeFSR"
,
98
"MC_bbar_beforeFSR_from_tbar"
, 0);
99
FillGenericPartonHistory
(
"MC_tbar_bbar_afterFSR"
,
100
"MC_bbar_afterFSR_from_tbar"
, 0);
101
FillWPartonHistory
(
"tbar"
);
102
}
103
}
104
105
void
CalcPartonHistory::FillTtbarPartonHistory
(
bool
fcnc) {
106
std:: string qSymbol = fcnc ?
"q"
:
"b"
;
107
std:: string qbarSymbol = fcnc ?
"qbar"
:
"bbar"
;
108
std::string bosonSymbol = fcnc ?
"X"
:
"W"
;
109
// Assumes FillTopPartonHistory and FillAntiTopPartonHistory have already run.
110
PtEtaPhiMVector ttbar;
111
PtEtaPhiMVector t_beforeFSR, tbar_beforeFSR, t_afterFSR, tbar_afterFSR;
112
PtEtaPhiMVector WpDecay1, WpDecay2, WmDecay1, WmDecay2, b, bbar;
113
114
// m_dec.decorate* takes bare names; Retrievep4 takes full m_particleMap keys.
115
m_dec
.decorateDefaultNoPdgId(
"MC_ttbar_beforeFSR"
);
116
m_dec
.decorateDefaultNoPdgId(
"MC_ttbar_afterFSR"
);
117
m_dec
.decorateDefaultNoPdgId(
"MC_ttbar_fromDecay_beforeFSR"
);
118
m_dec
.decorateDefaultNoPdgId(
"MC_ttbar_fromDecay_afterFSR"
);
119
120
if
(
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_beforeFSR"
, t_beforeFSR) &&
121
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_beforeFSR"
, tbar_beforeFSR)) {
122
ttbar = t_beforeFSR + tbar_beforeFSR;
123
m_dec
.decorateParticle(
"MC_ttbar_beforeFSR"
, ttbar);
124
}
125
126
if
(
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_afterFSR"
, t_afterFSR) &&
127
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_afterFSR"
, tbar_afterFSR)) {
128
ttbar = t_afterFSR + tbar_afterFSR;
129
m_dec
.decorateParticle(
"MC_ttbar_afterFSR"
, ttbar);
130
}
131
132
if
(
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_"
+ bosonSymbol +
"Decay1_beforeFSR"
, WpDecay1) &&
133
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_"
+ bosonSymbol +
"Decay2_beforeFSR"
, WpDecay2) &&
134
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_"
+ bosonSymbol +
"Decay1_beforeFSR"
, WmDecay1) &&
135
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_"
+ bosonSymbol +
"Decay2_beforeFSR"
, WmDecay2) &&
136
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_"
+ qSymbol +
"_beforeFSR"
, b) &&
137
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_"
+ qbarSymbol +
"_beforeFSR"
, bbar)) {
138
ttbar = WpDecay1 + WpDecay2 + WmDecay1 + WmDecay2 + b + bbar;
139
m_dec
.decorateParticle(
"MC_ttbar_fromDecay_beforeFSR"
, ttbar);
140
}
141
142
if
(
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_"
+ bosonSymbol +
"Decay1_afterFSR"
, WpDecay1) &&
143
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_"
+ bosonSymbol +
"Decay2_afterFSR"
, WpDecay2) &&
144
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_"
+ bosonSymbol +
"Decay1_afterFSR"
, WmDecay1) &&
145
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_"
+ bosonSymbol +
"Decay2_afterFSR"
, WmDecay2) &&
146
Retrievep4
(
m_prefix
+
"_"
+
"MC_t_"
+ qSymbol +
"_afterFSR"
, b) &&
147
Retrievep4
(
m_prefix
+
"_"
+
"MC_tbar_"
+ qbarSymbol +
"_afterFSR"
, bbar)) {
148
ttbar = WpDecay1 + WpDecay2 + WmDecay1 + WmDecay2 + b + bbar;
149
m_dec
.decorateParticle(
"MC_ttbar_fromDecay_afterFSR"
, ttbar);
150
}
151
}
152
}
// namespace CP
CalcPartonHistory.h
DecoratorHelpers.h
CP::CalcPartonHistory::RetrieveParticleInfo
bool RetrieveParticleInfo(const std::string &prefix, std::vector< const xAOD::TruthParticle * > &particles)
Definition
CalcPartonHistory.cxx:124
CP::CalcPartonHistory::FillWPartonHistory
void FillWPartonHistory(const std::string &parent, int nWs=1, const std::string &mode="resonant")
Definition
CalcWPartonHistory.cxx:113
CP::CalcPartonHistory::Retrievep4
bool Retrievep4(const std::string &key, PtEtaPhiMVector &p4)
Definition
CalcPartonHistory.cxx:57
CP::CalcPartonHistory::m_prefix
std::string m_prefix
prefix applied to all decorator and m_particleMap names
Definition
CalcPartonHistory.h:163
CP::CalcPartonHistory::FillTopPartonHistory
void FillTopPartonHistory(bool fcnc=false)
Definition
CalcTopPartonHistory.cxx:43
CP::CalcPartonHistory::m_dec
PartonDecorator m_dec
Definition
CalcPartonHistory.h:159
CP::CalcPartonHistory::FillXPartonHistory
void FillXPartonHistory(const std::string &parent, const std::string &symbolX="H")
Definition
CalcTopPartonHistory.cxx:17
CP::CalcPartonHistory::FillGenericPartonHistory
void FillGenericPartonHistory(const std::string &retrievalstring, const std::string &decorationstring, const int idx)
Definition
CalcGenericPartonHistory.cxx:14
CP::CalcPartonHistory::FillTtbarPartonHistory
void FillTtbarPartonHistory(bool fcnc=false)
Definition
CalcTopPartonHistory.cxx:105
CP::CalcPartonHistory::FillAntiTopPartonHistory
void FillAntiTopPartonHistory(bool fcnc=false)
Definition
CalcTopPartonHistory.cxx:73
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
Generated on
for ATLAS Offline Software by
1.17.0