File indexing completed on 2025-08-03 08:20:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "HadronPrinter.h"
0017 #include "JetScapeSignalManager.h"
0018 namespace Jetscape {
0019
0020
0021 RegisterJetScapeModule<HadronPrinter> HadronPrinter::reg("HadronPrinter");
0022
0023 HadronPrinter::HadronPrinter()
0024 {
0025 }
0026
0027 HadronPrinter::~HadronPrinter()
0028 {
0029 }
0030
0031 void HadronPrinter::Init()
0032 {
0033 this->SetId("Printer");
0034 fHadronOutfile.open("finalStateHadrons.dat");
0035 JetScapeSignalManager::Instance()->ConnectGetFinalHadronListSignal(
0036 shared_from_this());
0037
0038
0039 }
0040
0041 void HadronPrinter::Exec()
0042 {
0043 VERBOSE(2) <<"Run HadronPrinter: ";
0044 GetFinalHadronList(finalHadrons);
0045 PrintFinalHadron();
0046 }
0047
0048 void HadronPrinter::Clear()
0049 {this->finalHadrons.clear();}
0050
0051 void HadronPrinter::WriteTask(weak_ptr<JetScapeWriter> w)
0052 {
0053 VERBOSE(8);
0054 JetScapeTask::WriteTasks(w);
0055 }
0056
0057 void HadronPrinter::PrintFinalHadron(){
0058 char buffer [33];
0059
0060 JSINFO << "HadronPrinter : starting to print hadrons";
0061 int i=0;
0062 fHadronOutfile << "# PID pstat E Px Py Pz eta phi" << endl;
0063 for(auto it : finalHadrons){
0064 Hadron h = *it.get();
0065 fHadronOutfile << i <<" "<< h.pid() <<" "<< h.pstat() <<" "<< h.e() <<" "<< h.px() <<" "<< h.py() <<" "<< h.pz() <<" "<< h.eta() <<" "<< h.phi() << endl;
0066 ++i;
0067 }
0068
0069 }
0070 }
0071
0072