27{
28
29
30
31 SG::ReadHandle<xAOD::JetContainer> inputJets(
m_jetsKey, ctx);
32 if (!inputJets.isValid()) {
34 return StatusCode::FAILURE;
35 }
36
37 SG::WriteDecorHandle<xAOD::JetContainer,int> output_decorator(
m_decOutput, ctx);
38 static const SG::ConstAccessor<int> PartonTruthLabelIDAcc("PartonTruthLabelID");
39 static const SG::ConstAccessor<int> HadronConeExclTruthLabelIDAcc("HadronConeExclTruthLabelID");
40
41 for (const auto *ajet : *inputJets){
42 if (!PartonTruthLabelIDAcc.isAvailable(*ajet) ){
43 ATH_MSG_ERROR(
"Did not have input PartonTruthLabelID decorations available");
44 return StatusCode::FAILURE;
45 }
46 else if (!HadronConeExclTruthLabelIDAcc.isAvailable(*ajet) ){
47 ATH_MSG_ERROR(
"Did not have input HadronConeExclTruthLabelID decorations available");
48 return StatusCode::FAILURE;
49 }
50
51
52
53
54
55
56 if (HadronConeExclTruthLabelIDAcc(*ajet)!=0){
57 output_decorator(*ajet) = HadronConeExclTruthLabelIDAcc(*ajet);
58 } else {
59 int labelid = PartonTruthLabelIDAcc(*ajet);
60 if (std::abs(labelid)!=5 &&
61 std::abs(labelid)!=4 &&
62 std::abs(labelid)!=15){
63 output_decorator(*ajet) = labelid;
64 } else {
65 output_decorator(*ajet) = labelid*100;
66 }
67 }
68 }
69
70 return StatusCode::SUCCESS;
71}