20 #include "fastjet/PseudoJet.hh"
21 #include "fastjet/ClusterSequence.hh"
22 #include "fastjet/JetDefinition.hh"
23 #include "fastjet/contrib/SoftDrop.hh"
24 #include "fastjet/tools/Filter.hh"
25 #include "fastjet/contrib/Nsubjettiness.hh"
33 base_class(
t,
n,
p) {}
43 if (m_jetKey.key().empty()) {
44 ATH_MSG_FATAL(
"No jet collection provided for augmentation.");
45 return StatusCode::FAILURE;
49 auto init_dec = [&] (
WDHK&
k ) {
50 k =
k.key() + m_suffix;
51 return k.initialize();
77 if (!m_selectionString.empty()) {
78 ATH_CHECK( initializeParser( m_selectionString ));
82 m_trimmer.emplace(fastjet::JetDefinition(
fastjet::kt_algorithm, m_rclus), fastjet::SelectorPtFractionMin(m_ptfrac));
83 m_softdropper.emplace(m_beta, m_zcut, m_R0);
85 return StatusCode::SUCCESS;
90 const EventContext& ctx = Gaudi::Hive::currentContext();
93 if (!
jets.isValid()) {
94 ATH_MSG_ERROR(
"No jet collection with name " << m_jetKey.key() <<
" found in StoreGate!");
95 return StatusCode::FAILURE;
97 unsigned int nJets(
jets->size());
98 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
101 if (!m_selectionString.empty()) {
102 std::vector<int>
entries = m_parser->evaluateAsVector();
106 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
107 return StatusCode::FAILURE;
110 for (
unsigned int i=0;
i<nJets; ++
i)
if (
entries[
i]==1) jetToCheck.push_back((*
jets)[
i]);
113 for (
unsigned int i=0;
i<nJets; ++
i) jetToCheck.push_back((*
jets)[
i]);
117 WDH dec_Qw (m_dec_Qw, ctx);
118 WDH dec_Tau1 (m_dec_Tau1, ctx);
119 WDH dec_Tau2 (m_dec_Tau2, ctx);
120 WDH dec_Tau3 (m_dec_Tau3, ctx);
121 WDH dec_Tau4 (m_dec_Tau4, ctx);
122 WDH dec_Tau21 (m_dec_Tau21, ctx);
123 WDH dec_Tau32 (m_dec_Tau32, ctx);
124 WDH dec_Split12 (m_dec_Split12, ctx);
125 WDH dec_Split23 (m_dec_Split23, ctx);
126 WDH dec_Split34 (m_dec_Split34, ctx);
127 WDH dec_ECF1 (m_dec_ECF1, ctx);
128 WDH dec_ECF2 (m_dec_ECF2, ctx);
129 WDH dec_ECF3 (m_dec_ECF3, ctx);
130 WDH dec_ECF4 (m_dec_ECF4, ctx);
131 WDH dec_C2 (m_dec_C2, ctx);
132 WDH dec_D2 (m_dec_D2, ctx);
133 WDH dec_pT (m_dec_pT, ctx);
134 WDH dec_m (m_dec_m, ctx);
135 WDH dec_NConstits (m_dec_NConstits, ctx);
136 WDH dec_eta (m_dec_eta, ctx);
137 WDH dec_phi (m_dec_phi, ctx);
138 WDH dec_timing (m_dec_timing, ctx);
140 std::vector<const xAOD::IParticle*> mergedGhostConstits;
141 std::vector<const xAOD::IParticle*> ghosts;
142 std::vector<fastjet::PseudoJet> constituents;
147 mergedGhostConstits.clear();
148 for (std::string ghostName: m_ghostNames) {
150 ATH_CHECK(
jet->getAssociatedObjects(ghostName, ghosts));
151 mergedGhostConstits.insert(mergedGhostConstits.end(), ghosts.begin(), ghosts.end());
155 constituents.clear();
158 for (
auto constit : mergedGhostConstits){
159 if (constit==
nullptr) {
164 if (constit->e()<0) {
ATH_MSG_INFO(
"################## Negative energy cluster");
continue;}
165 constituents.push_back( fastjet::PseudoJet(constit->p4()) );
170 double eConstit = caloConstit->
e()* caloConstit->e();
171 time += caloConstit->time()* eConstit;
178 dec_timing(*
jet) = 0;
184 int nConstits = constituents.size();
187 fastjet::PseudoJet groomed_jet;
191 fastjet::PseudoJet recluster_jet = cs.inclusive_jets(0.0).front();
194 if (m_grooming==
"Trimming"){
195 groomed_jet = m_trimmer->result(recluster_jet);
196 }
else if (m_grooming==
"SoftDrop"){
197 groomed_jet = m_softdropper->result(recluster_jet);
199 ATH_MSG_DEBUG(
" No grooming requested or wrong one, will not apply grooming");
200 groomed_jet = recluster_jet;
204 nConstits = groomed_jet.constituents().size();
211 dec_Tau1(*
jet) = -999;
212 dec_Tau2(*
jet) = -999;
213 dec_Tau3(*
jet) = -999;
214 dec_Tau4(*
jet) = -999;
216 dec_Tau21(*
jet) = -999;
217 dec_Tau32(*
jet) = -999;
219 dec_Split12(*
jet) = -999;
220 dec_Split23(*
jet) = -999;
221 dec_Split34(*
jet) = -999;
223 dec_ECF1(*
jet) = -999;
224 dec_ECF2(*
jet) = -999;
225 dec_ECF3(*
jet) = -999;
226 dec_ECF4(*
jet) = -999;
233 dec_NConstits(*
jet) = 0;
234 dec_eta(*
jet) = -999;
235 dec_phi(*
jet) = -999;
237 return StatusCode::SUCCESS;
241 dec_pT(*
jet) = groomed_jet.pt();
242 dec_m(*
jet) = groomed_jet.m();
243 dec_NConstits(*
jet) = nConstits;
244 dec_eta(*
jet) = groomed_jet.eta();
245 dec_phi(*
jet) = groomed_jet.phi() -
M_PI;
249 dec_Qw(*
jet) =
qw.result(groomed_jet);
252 fastjet::contrib::WTA_KT_Axes wta_kt_axes;
253 fastjet::contrib::NormalizedCutoffMeasure normalized_measure(1.0, 1.0, 1000000);
258 float tau1_wta = Tau1_wta.
result(groomed_jet);
259 float tau2_wta = Tau2_wta.
result(groomed_jet);
260 float tau3_wta = Tau3_wta.
result(groomed_jet);
261 float tau4_wta = Tau4_wta.
result(groomed_jet);
262 float tau21_wta = -999;
263 float tau32_wta = -999;
265 if( tau1_wta > 1
e-8 ) {
266 tau21_wta = tau2_wta / tau1_wta;
268 if( tau2_wta > 1
e-8 ) {
269 tau32_wta = tau3_wta / tau2_wta;
272 dec_Tau1(*
jet) = tau1_wta;
273 dec_Tau2(*
jet) = tau2_wta;
274 dec_Tau3(*
jet) = tau3_wta;
275 dec_Tau4(*
jet) = tau4_wta;
276 dec_Tau21(*
jet) = tau21_wta;
277 dec_Tau32(*
jet) = tau32_wta;
283 float split12 = Split12.
result(groomed_jet);
284 float split23 = Split23.
result(groomed_jet);
285 float split34 = Split34.
result(groomed_jet);
287 dec_Split12(*
jet) = split12;
288 dec_Split23(*
jet) = split23;
289 dec_Split34(*
jet) = split34;
296 float ecf1 = ECF1.
result(groomed_jet);
297 float ecf2 = ECF2.
result(groomed_jet);
298 float ecf3 = ECF3.
result(groomed_jet);
299 float ecf4 = ECF4.
result(groomed_jet);
304 c2 = ecf3 * ecf1 /
pow( ecf2, 2.0 );
305 d2 = ecf3 *
pow( ecf1, 3.0 ) /
pow( ecf2, 3.0 );
308 dec_ECF1(*
jet) = ecf1;
309 dec_ECF2(*
jet) = ecf2;
310 dec_ECF3(*
jet) = ecf3;
311 dec_ECF4(*
jet) = ecf4;
317 return StatusCode::SUCCESS;