25 JetReclusteringAlgo :: JetReclusteringAlgo () :
26 m_jetReclusteringTool(
"JetReclusteringTool/"+m_name)
35 if(!m_outputXAODName.empty()){
38 job.outputAdd(output_xAOD);
41 return EL::StatusCode::SUCCESS;
44 EL::StatusCode JetReclusteringAlgo :: histInitialize () {
return EL::StatusCode::SUCCESS; }
45 EL::StatusCode JetReclusteringAlgo :: fileExecute () {
return EL::StatusCode::SUCCESS; }
46 EL::StatusCode JetReclusteringAlgo :: changeInput (
bool ) {
return EL::StatusCode::SUCCESS; }
51 Info(
"initialize()",
"JetReclusteringAlgo_%s", m_inputJetContainer.c_str() );
52 m_event = wk()->xaodEvent();
53 m_store = wk()->xaodStore();
56 Info(
"setupJob()",
"m_rc_alg is empty. Setting to `AntiKt` by default.");
60 if(!m_outputXAODName.empty()){
61 TFile *
file = wk()->getOutputFile(m_outputXAODName);
62 if(!m_event->writeTo(
file).isSuccess()){
63 Error(
"initialize()",
"Could not set up an output file to write xAODs to.");
64 return EL::StatusCode::FAILURE;
70 Error(
"initialize()",
"m_name needs to be set and unique.");
71 return EL::StatusCode::FAILURE;
75 ANA_CHECK(m_jetReclusteringTool.setProperty(
"InputJetContainer", m_inputJetContainer));
76 ANA_CHECK(m_jetReclusteringTool.setProperty(
"OutputJetContainer", m_outputJetContainer));
77 ANA_CHECK(m_jetReclusteringTool.setProperty(
"ReclusterRadius", m_radius));
78 ANA_CHECK(m_jetReclusteringTool.setProperty(
"ReclusterAlgorithm", m_rc_alg));
79 ANA_CHECK(m_jetReclusteringTool.setProperty(
"VariableRMinRadius", m_varR_minR));
80 ANA_CHECK(m_jetReclusteringTool.setProperty(
"VariableRMassScale", m_varR_mass));
81 ANA_CHECK(m_jetReclusteringTool.setProperty(
"InputJetPtMin", m_ptMin_input));
82 ANA_CHECK(m_jetReclusteringTool.setProperty(
"RCJetPtMin", m_ptMin_rc));
83 ANA_CHECK(m_jetReclusteringTool.setProperty(
"RCJetPtFrac", m_ptFrac));
84 ANA_CHECK(m_jetReclusteringTool.setProperty(
"RCJetSubjetRadius", m_subjet_radius));
85 ANA_CHECK(m_jetReclusteringTool.setProperty(
"DoArea", m_doArea));
86 ANA_CHECK(m_jetReclusteringTool.setProperty(
"AreaAttributes", m_areaAttributes));
87 ANA_CHECK(m_jetReclusteringTool.retrieve());
89 if(m_debug) m_jetReclusteringTool->print();
91 return EL::StatusCode::SUCCESS;
98 m_jetReclusteringTool->execute();
106 if(m_store->contains<jet_t>(m_inputJetContainer)){
107 if(!m_store->retrieve( smallRjets, m_inputJetContainer ).isSuccess())
return EL::StatusCode::FAILURE;
108 }
else if(m_event->contains<jet_t>(m_inputJetContainer)){
109 if(!m_event->retrieve( smallRjets, m_inputJetContainer ).isSuccess())
return EL::StatusCode::FAILURE;
111 Error(
"execute()",
"Could not find the input jet container. That's weird.");
112 return EL::StatusCode::FAILURE;
116 if(m_store->contains<jet_t>(m_outputJetContainer)){
117 if(!m_store->retrieve( reclusteredJets, m_outputJetContainer ).isSuccess())
return EL::StatusCode::FAILURE;
118 }
else if(m_event->contains<jet_t>(m_outputJetContainer)){
119 if(!m_event->retrieve( reclusteredJets, m_outputJetContainer ).isSuccess())
return EL::StatusCode::FAILURE;
121 Error(
"execute()",
"Could not find the output jet container. Did the tool execute properly? Maybe it was misconfigured.");
122 return EL::StatusCode::FAILURE;
125 std::string printStr =
"\tPt: %0.2f\tMass: %0.2f\tEta: %0.2f\tPhi: %0.2f\tNum Subjets: %zu";
126 Info(
"execute()",
"%zu small-R jets", smallRjets->size());
127 for(
const auto jet: *smallRjets)
128 Info(
"execute()", printStr.c_str(),
jet->pt()/1000.,
jet->m()/1000.,
jet->eta(),
jet->phi(),
jet->numConstituents());
130 Info(
"execute()",
"%zu reclustered jets", reclusteredJets->size());
131 for(
const auto jet: *reclusteredJets)
132 Info(
"execute()", printStr.c_str(),
jet->pt()/1000.,
jet->m()/1000.,
jet->eta(),
jet->phi(),
jet->numConstituents());
145 return EL::StatusCode::SUCCESS;
148 EL::StatusCode JetReclusteringAlgo :: postExecute () {
return EL::StatusCode::SUCCESS; }
151 if(!m_outputXAODName.empty()){
152 TFile *
file = wk()->getOutputFile(m_outputXAODName);
153 if(!m_event->finishWritingTo(
file).isSuccess()){
154 Error(
"finalize()",
"Could not finish writing to file... oh bother");
155 return EL::StatusCode::FAILURE;
159 return EL::StatusCode::SUCCESS;
162 EL::StatusCode JetReclusteringAlgo :: histFinalize () {
return EL::StatusCode::SUCCESS; }