18{
19
20
21
22
23 TauAntiTauJetOverlapTool::TauAntiTauJetOverlapTool(const std::string& name)
25 m_bJetLabel(""),
26 m_tauLabel(""),
27 m_antiTauLabel(""),
28 m_dR(0.2),
29 m_useRapidity(true),
30 m_dRMatcher(nullptr),
31 m_antiTauDecHelper(nullptr)
32 {
33 declareProperty("BJetLabel", m_bJetLabel,
34 "Input b-jet flag. Disabled by default.");
35 declareProperty("TauLabel", m_tauLabel,
36 "Decoration which labels ID-ed taus");
37 declareProperty("AntiTauLabel", m_antiTauLabel,
38 "Decoration which labels anti-taus");
39 declareProperty("antiTauEventCategory", m_antiTauEventCategoryDecorName="antiTauEventCategory",
40 "Decoration which labels event type");
41 declareProperty("DR", m_dR, "Maximum dR for overlap match");
42 declareProperty("UseRapidity", m_useRapidity,
43 "Calculate delta-R using rapidity");
44 }
45
46
47
48
49 StatusCode TauAntiTauJetOverlapTool::initializeDerived()
50 {
51
52 if(!m_bJetLabel.empty()) {
53 ATH_MSG_DEBUG(
"Configuring btag-aware OR with btag label: " << m_bJetLabel);
54 resetAccessor (m_accessors->m_bJetAcc, *m_accessors, m_bJetLabel);
55 }
56
57
58 m_dRMatcher = std::make_unique<DeltaRMatcher>(m_dR, m_useRapidity);
60 addSubtool(*m_dRMatcher);
61
62
63 if(!m_tauLabel.empty()) {
64 ATH_MSG_DEBUG(
"Configuring tau OR with label: " << m_tauLabel);
65 m_tauDecHelper =
66 std::make_unique<OverlapDecorationHelper<columnar::Particle2Def>>
67 (m_tauLabel, m_outputLabel, m_outputPassValue);
68 addSubtool(*m_tauDecHelper);
69 }
70
71
72 if(!m_antiTauLabel.empty()) {
73 ATH_MSG_DEBUG(
"Configuring anti-tau OR with label: " << m_antiTauLabel);
74 m_antiTauDecHelper =
75 std::make_unique<OverlapDecorationHelper<columnar::Particle2Def>>
76 (m_antiTauLabel, m_outputLabel, m_outputPassValue);
77 addSubtool(*m_antiTauDecHelper);
78 }
79
80 resetAccessor (m_accessors->m_evtAcc, *m_accessors, m_evtKeyName, {.addMTDependency = true});
81 resetAccessor (m_accessors->m_categoryAcc, *m_accessors, m_antiTauEventCategoryDecorName);
82 return StatusCode::SUCCESS;
83 }
84
85
86
87
92 {
93
94 ATH_CHECK( checkForXAODContainer<xAOD::JetContainer>(cont1,
"First container arg is not of type JetContainer!") );
95 ATH_CHECK( checkForXAODContainer<xAOD::TauJetContainer>(cont2,
"Second container arg is not of type TauJetContainer!") );
96
97 ATH_CHECK( internalFindOverlaps(cont1, cont2, eventContext) );
98 return StatusCode::SUCCESS;
99 }
100
101
102
103
108 {
110 auto&
acc = *m_accessors;
111
112
113 initializeDecorations(
taus);
114 initializeDecorations(jets);
115
116
117 for(
const auto tau :
taus) {
118 if(!isSurvivingObject(tau)) continue;
119 if(isSurvivingTau(tau)) continue;
120 if(isSurvivingAntiTau(tau)) continue;
121
123 }
124
125
126 int ntaus = 0;
127 for(
const auto tau :
taus) {
128 if(!isSurvivingObject(tau)) continue;
129
130 if(!isSurvivingTau(tau)) continue;
131 ntaus++;
132 for(const auto jet : jets) {
133 if(!isSurvivingObject(jet)) continue;
134 if(m_dRMatcher->objectsMatch(tau, jet)){
136 }
137 }
138 }
139
140
141 for(const auto jet : jets) {
142 if(!isSurvivingObject(jet)) continue;
143 if(!isBJet(jet)) continue;
144 for(
const auto tau :
taus) {
145 if(!isSurvivingObject(tau)) continue;
146 if(!isSurvivingAntiTau(tau)) continue;
147 if(m_dRMatcher->objectsMatch(tau, jet)) {
149 }
150 }
151 }
152
153 int nantitaus = 0;
154 int antiTauCategory = 0;
155 for(
const auto tau :
taus) {
156 if(!isSurvivingObject(tau)) continue;
157 if(!isSurvivingAntiTau(tau)) continue;
158 nantitaus++;
159 antiTauCategory =
acc.m_categoryAcc(tau);
160 }
161
162 int nAntiTauMax =
int(ntaus<antiTauCategory);
163
164
165
166 auto eventInfo =
acc.m_evtAcc(eventContext);
168 if (nantitaus > 0) {
170
171 int nSelectedAntitaus = 0;
173 for(
const auto tau :
taus) {
174 if(!isSurvivingObject(tau)) continue;
175 if(!isSurvivingAntiTau(tau) ) continue;
176 if (idx == selIndex && nSelectedAntitaus < nAntiTauMax) nSelectedAntitaus++;
177 else {
178
180 }
182 }
183 }
184
185
186 for(
const auto tau :
taus) {
187 if(!isSurvivingObject(tau)) continue;
188 if(!isSurvivingAntiTau(tau)) continue;
189
190 for(const auto jet : jets) {
191 if(!isSurvivingObject(jet)) continue;
192
193 if(isBJet(jet)) continue;
194 if(m_dRMatcher->objectsMatch(tau, jet)){
196 }
197 }
198 }
199
200 return StatusCode::SUCCESS;
201 }
202
203
204
205
207 {
208 if(!m_bJetLabel.empty() && m_accessors->m_bJetAcc(jet)) return true;
209 return false;
210 }
211
212
213
214
216 {
217 if(m_tauDecHelper && m_tauDecHelper->isSurvivingObject(tau)) return true;
218 return false;
219 }
220
221
222
223
225 {
226 if(m_antiTauDecHelper && m_antiTauDecHelper->isSurvivingObject(tau))
227 return true;
228 return false;
229 }
230
231
232}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
::StatusCode StatusCode
StatusCode definition for legacy code.
event_number_t eventIndex
ObjectId< Particle1Def > Particle1Id
ObjectId< EventContextDef > EventContextId
ObjectRange< Particle2Def > Particle2Range
ObjectRange< Particle1Def > Particle1Range
ObjectId< Particle2Def > Particle2Id
void resetAccessor(AccessorTemplate< CI, CT, CAM, CM > &accessor, ColumnarTool< CM > &columnBase, const std::string &name, ColumnAccessorOptions &&options={})
reset a column accessor to point to a new column
@ Jet
The object is a jet.
@ Tau
The object is a tau (jet).