Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:04

0001 /*******************************************************************************
0002  * Copyright (c) The JETSCAPE Collaboration, 2020
0003  *
0004  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
0005  * 
0006  * For the list of contributors see AUTHORS.
0007  *
0008  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
0009  *
0010  * or via email to bugs.jetscape@gmail.com
0011  *
0012  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
0013  * See COPYING for details.
0014  ******************************************************************************/
0015 
0016 #include "HadronPrinter.h"
0017 #include "JetScapeSignalManager.h"
0018 namespace Jetscape {
0019 
0020 // Register the module with the base class
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   //hadronPrinter->GetFinalHadronList.connect(hadro.get(), &Hadronization::GetHadrons);
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