30 #include "fastjet/ClusterSequence.hh"
31 #include <fastjet/contrib/EnergyCorrelator.hh>
32 #include <fastjet/contrib/Nsubjettiness.hh>
45 m_inputJetEtaMax(999.),
51 m_useAdditionalJSS(false),
56 m_InJetContainerBase(
"AntiKt4EMTopoJets_RC"),
57 m_OutJetContainerBase(
"AntiKtRCJets"),
58 m_InputJetContainer(
"AntiKt4EMTopoJets_RC"),
59 m_OutputJetContainer(
"AntiKtRCJets"),
61 m_jet_def_rebuild(nullptr),
62 m_nSub1_beta1(nullptr),
63 m_nSub2_beta1(nullptr),
64 m_nSub3_beta1(nullptr),
80 m_unique_syst(false) {
99 m_ptcut = std::stof(configSettings->
value(
"VarRCJetPt"));
101 m_trim = std::stof(configSettings->
value(
"VarRCJetTrim"));
102 m_radius = std::stof(configSettings->
value(
"VarRCJetMaxRadius"));
105 std::replace(original_rho.begin(), original_rho.end(),
'_',
'.');
106 float rho = std::stof(original_rho);
115 m_trim = std::stof(configSettings->
value(
"RCJetTrim"));
137 m_nSub1_beta1 = std::make_shared<fastjet::contrib::Nsubjettiness>(1,
138 fastjet::contrib::OnePass_WTA_KT_Axes(),
139 fastjet::contrib::UnnormalizedMeasure(1.0));
140 m_nSub2_beta1 = std::make_shared<fastjet::contrib::Nsubjettiness>(2,
141 fastjet::contrib::OnePass_WTA_KT_Axes(),
142 fastjet::contrib::UnnormalizedMeasure(1.0));
143 m_nSub3_beta1 = std::make_shared<fastjet::contrib::Nsubjettiness>(3,
144 fastjet::contrib::OnePass_WTA_KT_Axes(),
145 fastjet::contrib::UnnormalizedMeasure(1.0));
148 m_split12 = std::make_shared<JetSubStructureUtils::KtSplittingScale>(1);
149 m_split23 = std::make_shared<JetSubStructureUtils::KtSplittingScale>(2);
151 m_qw = std::make_shared<JetSubStructureUtils::Qw>();
153 m_ECF1 = std::make_shared<fastjet::contrib::EnergyCorrelator>(1, 1.0, fastjet::contrib::EnergyCorrelator::pt_R);
154 m_ECF2 = std::make_shared<fastjet::contrib::EnergyCorrelator>(2, 1.0, fastjet::contrib::EnergyCorrelator::pt_R);
155 m_ECF3 = std::make_shared<fastjet::contrib::EnergyCorrelator>(3, 1.0, fastjet::contrib::EnergyCorrelator::pt_R);
160 m_gECF332 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(3, 3, 2,
161 JetSubStructureUtils::EnergyCorrelator::pt_R);
162 m_gECF461 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(6, 4, 1,
163 JetSubStructureUtils::EnergyCorrelator::pt_R);
164 m_gECF322 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(2, 3, 2,
165 JetSubStructureUtils::EnergyCorrelator::pt_R);
166 m_gECF331 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(3, 3, 1,
167 JetSubStructureUtils::EnergyCorrelator::pt_R);
168 m_gECF422 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(2, 4, 2,
169 JetSubStructureUtils::EnergyCorrelator::pt_R);
170 m_gECF441 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(4, 4, 1,
171 JetSubStructureUtils::EnergyCorrelator::pt_R);
172 m_gECF212 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(1, 2, 2,
173 JetSubStructureUtils::EnergyCorrelator::pt_R);
174 m_gECF321 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(2, 3, 1,
175 JetSubStructureUtils::EnergyCorrelator::pt_R);
176 m_gECF311 = std::make_shared<JetSubStructureUtils::EnergyCorrelatorGeneralized>(1, 3, 1,
177 JetSubStructureUtils::EnergyCorrelator::pt_R);
184 std::string hash_name(
"");
201 m_radius),
"Failed re-clustering radius initialize reclustering tool");
202 top::check(
tool->setProperty(
"RCJetPtMin",
m_ptcut * 1
e-3),
"Failed ptmin [GeV] initialize reclustering tool");
204 top::check(
tool->setProperty(
"TrimPtFrac",
m_trim),
"Failed pT fraction initialize reclustering tool");
206 m_minradius),
"Failed VarRC min radius initialize reclustering tool");
208 m_massscale),
"Failed VarRC mass scale initialize reclustering tool");
209 top::check(
tool->initialize(),
"Failed to initialize reclustering tool");
222 top::check(tool_loose->setProperty(
"InputJetContainer",
224 "Failed inputjetcontainer reclustering tool");
225 top::check(tool_loose->setProperty(
"OutputJetContainer",
227 "Failed outputjetcontainer loose initialize reclustering tool");
228 top::check(tool_loose->setProperty(
"ReclusterRadius",
229 m_radius),
"Failed re-clustering radius initialize reclustering tool");
230 top::check(tool_loose->setProperty(
"RCJetPtMin",
m_ptcut * 1
e-3),
"Failed ptmin [GeV] reclustering tool");
232 top::check(tool_loose->setProperty(
"TrimPtFrac",
m_trim),
"Failed pT fraction initialize reclustering tool");
233 top::check(tool_loose->setProperty(
"VariableRMinRadius",
234 m_minradius),
"Failed VarRC min radius initialize reclustering tool");
235 top::check(tool_loose->setProperty(
"VariableRMassScale",
236 m_massscale),
"Failed VarRC mass scale initialize reclustering tool");
264 return StatusCode::SUCCESS;
284 auto rcJetInputs = std::make_unique< ConstDataVector< xAOD::JetContainer >>(
SG::VIEW_ELEMENTS);
287 rcJetInputs->push_back(
jet);
290 "Failed to put jets in TStore for re-clustering");
308 for (
auto rcjet : *myJets) {
309 rcjet->auxdecor<
bool>(
"PassedSelection") =
passSelection(*rcjet);
315 for (
auto rcjet : *myJets) {
316 if (!passedSelection(*rcjet))
continue;
320 std::vector<fastjet::PseudoJet>
clusters;
324 false).find(
"AntiKt4EMTopoJets") != std::string::npos) {
328 false).find(
"AntiKt4EMPFlowJets") != std::string::npos) {
334 false).find(
"AntiKt4EMPFlowJets") == std::string::npos) {
338 "RCJet::execute(const top::Event& event): Failed to get vector of clusters! Unable to calculate RC jets substructure variables!\n Aborting!");
344 std::vector<fastjet::PseudoJet> my_pjets = fastjet::sorted_by_pt(clust_seq_rebuild.inclusive_jets(0.0));
347 fastjet::PseudoJet correctedJet;
348 correctedJet = my_pjets[0];
350 if (my_pjets.size() > 1) correctedJet += my_pjets[1];
354 double tau32 = -1, tau21 = -1;
360 if (std::abs(tau1) > 1
e-8) tau21 = tau2 / tau1;
362 if (std::abs(tau2) > 1
e-8) tau32 = tau3 / tau2;
367 double split12 =
m_split12->result(correctedJet);
368 double split23 =
m_split23->result(correctedJet);
369 double qw =
m_qw->result(correctedJet);
373 double vECF1 =
m_ECF1->result(correctedJet);
374 double vECF2 =
m_ECF2->result(correctedJet);
375 double vECF3 =
m_ECF3->result(correctedJet);
376 if (std::abs(vECF2) > 1
e-8) D2 = vECF3 * vECF1* vECF1* vECF1 / (vECF2 * vECF2 * vECF2);
381 rcjet->auxdecor<
float>(
"Tau32_clstr") = tau32;
382 rcjet->auxdecor<
float>(
"Tau21_clstr") = tau21;
385 rcjet->auxdecor<
float>(
"Tau3_clstr") = tau3;
386 rcjet->auxdecor<
float>(
"Tau2_clstr") = tau2;
387 rcjet->auxdecor<
float>(
"Tau1_clstr") = tau1;
389 rcjet->auxdecor<
float>(
"d12_clstr") = split12;
390 rcjet->auxdecor<
float>(
"d23_clstr") = split23;
391 rcjet->auxdecor<
float>(
"Qw_clstr") =
qw;
393 rcjet->auxdecor<
float>(
"nconstituent_clstr") =
clusters.size();
395 rcjet->auxdecor<
float>(
"ECF1_clstr") = vECF1;
396 rcjet->auxdecor<
float>(
"ECF2_clstr") = vECF2;
397 rcjet->auxdecor<
float>(
"ECF3_clstr") = vECF3;
398 rcjet->auxdecor<
float>(
"D2_clstr") = D2;
407 double gECF332 =
m_gECF332->result(correctedJet);
408 double gECF461 =
m_gECF461->result(correctedJet);
409 double gECF322 =
m_gECF322->result(correctedJet);
410 double gECF331 =
m_gECF331->result(correctedJet);
411 double gECF422 =
m_gECF422->result(correctedJet);
412 double gECF441 =
m_gECF441->result(correctedJet);
413 double gECF212 =
m_gECF212->result(correctedJet);
414 double gECF321 =
m_gECF321->result(correctedJet);
415 double gECF311 =
m_gECF311->result(correctedJet);
417 double L1 = -999.0,
L2 = -999.0,
L3 = -999.0, L4 = -999.0, L5 = -999.0;
418 if (std::abs(gECF212) > 1
e-12) {
419 L1 = gECF321 / gECF212;
420 L2 = gECF331 / sqrt(gECF212*gECF212*gECF212);
422 if (std::abs(gECF331) > 1
e-12) {
423 L3 = gECF311 /
pow(gECF331,1./3.);
424 L4 = gECF322 /
pow(gECF331,4./3.);
426 if (std::abs(gECF441) > 1
e-12) {
427 L5 = gECF422/gECF441;
430 rcjet->auxdecor<
float>(
"gECF332_clstr") = gECF332;
431 rcjet->auxdecor<
float>(
"gECF461_clstr") = gECF461;
432 rcjet->auxdecor<
float>(
"gECF322_clstr") = gECF322;
433 rcjet->auxdecor<
float>(
"gECF331_clstr") = gECF331;
434 rcjet->auxdecor<
float>(
"gECF422_clstr") = gECF422;
435 rcjet->auxdecor<
float>(
"gECF441_clstr") = gECF441;
436 rcjet->auxdecor<
float>(
"gECF212_clstr") = gECF212;
437 rcjet->auxdecor<
float>(
"gECF321_clstr") = gECF321;
438 rcjet->auxdecor<
float>(
"gECF311_clstr") = gECF311;
439 rcjet->auxdecor<
float>(
"L1_clstr") =
L1;
440 rcjet->auxdecor<
float>(
"L2_clstr") =
L2;
441 rcjet->auxdecor<
float>(
"L3_clstr") =
L3;
442 rcjet->auxdecor<
float>(
"L4_clstr") = L4;
443 rcjet->auxdecor<
float>(
"L5_clstr") = L5;
445 rcjet->auxdecor<
float>(
"RRCJet_pt") = correctedJet.pt();
446 rcjet->auxdecor<
float>(
"RRCJet_eta") = correctedJet.eta();
447 rcjet->auxdecor<
float>(
"RRCJet_phi") = correctedJet.phi();
448 rcjet->auxdecor<
float>(
"RRCJet_e") = correctedJet.e();
463 return StatusCode::SUCCESS;
469 return StatusCode::SUCCESS;
479 bool isSmallRJetSys = (syst_name.find(
m_jetsyst) != std::string::npos);
483 if ((syst_name.find(
"_R10_") != std::string::npos) ||
484 (syst_name.find(
"_CombMass_") != std::string::npos) ||
485 (syst_name.find(
"_LargeR_") != std::string::npos) ||
486 (syst_name.find(
"_MassRes_") != std::string::npos) ||
487 (syst_name.find(
"_SigSF_") != std::string::npos) ||
488 (syst_name.find(
"_BGSF_") != std::string::npos) ) isSmallRJetSys =
false;
494 syst_name.compare(
"nominal") == 0);
501 std::string this_container_name(
"");
510 return this_container_name;
515 std::string this_container_name(
"");
523 return this_container_name;
552 bool hasConstituents =
true;
554 for (
auto link :
links) {
555 if (!link.isValid()) {
557 "Some of the RC Jet Constituents have been thinned - will not be included in RCJet JSS calculation");
558 hasConstituents =
false;
562 if (!hasConstituents) {
567 if (clus_itr->e() > 0) {
568 TLorentzVector temp_p4;
571 temp_p4.SetPtEtaPhiM(clus_itr->pt() *
sf, clus_itr->eta(), clus_itr->phi(), clus_itr->m());
573 clusters.push_back(fastjet::PseudoJet(temp_p4.Px(), temp_p4.Py(), temp_p4.Pz(), temp_p4.E()));
589 for (
auto cluster : *myClusters) {
593 float dR = subjet_raw->
p4().DeltaR(cluster->p4());
595 TLorentzVector temp_p4;
600 clusters.push_back(fastjet::PseudoJet(temp_p4.Px(), temp_p4.Py(), temp_p4.Pz(), temp_p4.E()));
617 std::vector<const xAOD::TrackParticle*> jetTracks;
629 bool haveJetTracks = jetTracks.size() != 0;
634 TLorentzVector temp_p4;
636 if (
jet !=
nullptr) {
639 if(
jet->auxdataConst<
char >(
"passPreORSelection") != 1){
643 temp_p4.SetPtEtaPhiE(
jet->pt(),
jet->eta(),
jet->phi(),
jet->e());
644 clusters.emplace_back(fastjet::PseudoJet(temp_p4.Px(), temp_p4.Py(), temp_p4.Pz(), temp_p4.E()));
650 "RCJET::No remaining tracks associated to the PFlow jet");