19 #include "fastjet/PseudoJet.hh"
20 #include "fastjet/ClusterSequence.hh"
21 #include "fastjet/JetDefinition.hh"
22 #include "fastjet/contrib/SoftDrop.hh"
23 #include "fastjet/tools/Filter.hh"
24 #include "fastjet/contrib/Nsubjettiness.hh"
32 base_class(
t,
n,
p) {}
42 if (m_jetKey.key().empty()) {
43 ATH_MSG_FATAL(
"No jet collection provided for augmentation.");
44 return StatusCode::FAILURE;
49 if (!m_selectionString.empty()) {
50 ATH_CHECK( initializeParser( m_selectionString ));
57 m_trimmer = std::make_unique<fastjet::Filter>(fastjet::JetDefinition(
fastjet::kt_algorithm, m_rclus), fastjet::SelectorPtFractionMin(m_ptfrac));
58 m_softdropper = std::make_unique<fastjet::contrib::SoftDrop>(m_beta, m_zcut, m_R0);
60 return StatusCode::SUCCESS;
67 return StatusCode::SUCCESS;
72 const EventContext& ctx = Gaudi::Hive::currentContext();
75 if (!
jets.isValid()) {
76 ATH_MSG_ERROR(
"No jet collection with name " << m_jetKey.key() <<
" found in StoreGate!");
77 return StatusCode::FAILURE;
79 unsigned int nJets(
jets->size());
80 std::vector<const xAOD::Jet*> jetToCheck; jetToCheck.clear();
83 if (!m_selectionString.empty()) {
84 std::vector<int>
entries = m_parser->evaluateAsVector();
88 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used jets??");
89 return StatusCode::FAILURE;
92 for (
unsigned int i=0;
i<nJets; ++
i)
if (
entries[
i]==1) jetToCheck.push_back((*
jets)[
i]);
95 for (
unsigned int i=0;
i<nJets; ++
i) jetToCheck.push_back((*
jets)[
i]);
98 std::vector<const xAOD::IParticle*> mergedGhostConstits;
99 std::vector<const xAOD::IParticle*> ghosts;
100 std::vector<fastjet::PseudoJet> constituents;
105 mergedGhostConstits.clear();
106 for (std::string ghostName: m_ghostNames) {
108 ATH_CHECK(
jet->getAssociatedObjects(ghostName, ghosts));
109 mergedGhostConstits.insert(mergedGhostConstits.end(), ghosts.begin(), ghosts.end());
113 constituents.clear();
116 for (
auto constit : mergedGhostConstits){
117 if (constit==
nullptr) {
122 if (constit->e()<0) {
ATH_MSG_INFO(
"################## Negative energy cluster");
continue;}
123 constituents.push_back( fastjet::PseudoJet(constit->p4()) );
128 double eConstit = caloConstit->
e()* caloConstit->e();
129 time += caloConstit->time()* eConstit;
136 m_moments->dec_timing(*
jet) = 0;
138 m_moments->dec_timing(*
jet) = time/
eTot;
142 int nConstits = constituents.size();
145 fastjet::PseudoJet groomed_jet;
149 fastjet::PseudoJet recluster_jet = cs.inclusive_jets(0.0).front();
152 if (m_grooming==
"Trimming"){
153 groomed_jet = m_trimmer->result(recluster_jet);
154 }
else if (m_grooming==
"SoftDrop"){
155 groomed_jet = m_softdropper->result(recluster_jet);
157 ATH_MSG_DEBUG(
" No grooming requested or wrong one, will not apply grooming");
158 groomed_jet = recluster_jet;
162 nConstits = groomed_jet.constituents().size();
167 m_moments->dec_Qw(*
jet) = -999;
169 m_moments->dec_Tau1(*
jet) = -999;
170 m_moments->dec_Tau2(*
jet) = -999;
171 m_moments->dec_Tau3(*
jet) = -999;
172 m_moments->dec_Tau4(*
jet) = -999;
174 m_moments->dec_Tau21(*
jet) = -999;
175 m_moments->dec_Tau32(*
jet) = -999;
177 m_moments->dec_Split12(*
jet) = -999;
178 m_moments->dec_Split23(*
jet) = -999;
179 m_moments->dec_Split34(*
jet) = -999;
181 m_moments->dec_ECF1(*
jet) = -999;
182 m_moments->dec_ECF2(*
jet) = -999;
183 m_moments->dec_ECF3(*
jet) = -999;
184 m_moments->dec_ECF4(*
jet) = -999;
186 m_moments->dec_C2(*
jet) = -999;
187 m_moments->dec_D2(*
jet) = -999;
189 m_moments->dec_pT(*
jet) = 0;
190 m_moments->dec_m(*
jet) = 0;
191 m_moments->dec_NConstits(*
jet) = 0;
192 m_moments->dec_eta(*
jet) = -999;
193 m_moments->dec_phi(*
jet) = -999;
195 return StatusCode::SUCCESS;
199 m_moments->dec_pT(*
jet) = groomed_jet.pt();
200 m_moments->dec_m(*
jet) = groomed_jet.m();
201 m_moments->dec_NConstits(*
jet) = nConstits;
202 m_moments->dec_eta(*
jet) = groomed_jet.eta();
203 m_moments->dec_phi(*
jet) = groomed_jet.phi() -
M_PI;
207 m_moments->dec_Qw(*
jet) =
qw.result(groomed_jet);
210 fastjet::contrib::WTA_KT_Axes wta_kt_axes;
211 fastjet::contrib::NormalizedCutoffMeasure normalized_measure(1.0, 1.0, 1000000);
216 float tau1_wta = Tau1_wta.
result(groomed_jet);
217 float tau2_wta = Tau2_wta.
result(groomed_jet);
218 float tau3_wta = Tau3_wta.
result(groomed_jet);
219 float tau4_wta = Tau4_wta.
result(groomed_jet);
220 float tau21_wta = -999;
221 float tau32_wta = -999;
223 if( tau1_wta > 1
e-8 ) {
224 tau21_wta = tau2_wta / tau1_wta;
226 if( tau2_wta > 1
e-8 ) {
227 tau32_wta = tau3_wta / tau2_wta;
230 m_moments->dec_Tau1(*
jet) = tau1_wta;
231 m_moments->dec_Tau2(*
jet) = tau2_wta;
232 m_moments->dec_Tau3(*
jet) = tau3_wta;
233 m_moments->dec_Tau4(*
jet) = tau4_wta;
234 m_moments->dec_Tau21(*
jet) = tau21_wta;
235 m_moments->dec_Tau32(*
jet) = tau32_wta;
241 float split12 = Split12.
result(groomed_jet);
242 float split23 = Split23.
result(groomed_jet);
243 float split34 = Split34.
result(groomed_jet);
245 m_moments->dec_Split12(*
jet) = split12;
246 m_moments->dec_Split23(*
jet) = split23;
247 m_moments->dec_Split34(*
jet) = split34;
254 float ecf1 = ECF1.
result(groomed_jet);
255 float ecf2 = ECF2.
result(groomed_jet);
256 float ecf3 = ECF3.
result(groomed_jet);
257 float ecf4 = ECF4.
result(groomed_jet);
262 c2 = ecf3 * ecf1 /
pow( ecf2, 2.0 );
263 d2 = ecf3 *
pow( ecf1, 3.0 ) /
pow( ecf2, 3.0 );
266 m_moments->dec_ECF1(*
jet) = ecf1;
267 m_moments->dec_ECF2(*
jet) = ecf2;
268 m_moments->dec_ECF3(*
jet) = ecf3;
269 m_moments->dec_ECF4(*
jet) = ecf4;
270 m_moments->dec_C2(*
jet) =
c2;
271 m_moments->dec_D2(*
jet) =
d2;
275 return StatusCode::SUCCESS;