Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /*******************************************************************************
0002  * Copyright (c) The JETSCAPE Collaboration, 2018
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 <iostream>
0017 
0018 #include "PartonPrinter.h"
0019 #include "GTL/graph.h"
0020 #include <GTL/edge_map.h>
0021 #include <GTL/node_map.h>
0022 #include "JetClass.h"
0023 #include "JetScapeLogger.h"
0024 #include <string>
0025 
0026 using namespace std;
0027 
0028 namespace Jetscape {
0029 
0030 // Register the module with the base class
0031 RegisterJetScapeModule<PartonPrinter> PartonPrinter::reg("PartonPrinter");
0032 
0033 PartonPrinter::PartonPrinter() {}
0034 
0035 PartonPrinter::~PartonPrinter() {}
0036 
0037 void PartonPrinter::Init() {
0038   this->SetId("PartonPrinter");
0039     JSINFO << "Initialize PartonPrinter ...";
0040     string filename = GetXMLElementText({"PartonPrinter","FileName"});
0041     
0042   dist_output.open(filename,std::ios::app);
0043 }
0044 
0045 void PartonPrinter::Exec() {
0046   VERBOSE(2) << "Run PartonPrinter: print shower from event # "
0047              << GetCurrentEvent() << " ...";
0048 }
0049 
0050 void PartonPrinter::GetFinalPartons(
0051     shared_ptr<PartonShower>
0052         pShower /*, vector<shared_ptr<Parton>>& fPartons*/) {
0053   if (pShower) {
0054     //vector<shared_ptr<Parton>> vPin;
0055     for (unsigned int ipart = 0;
0056          ipart < pShower.get()->GetFinalPartons().size(); ++ipart) {
0057       //fPartons.push_back( pShower.get()->GetFinalPartons().at(ipart));
0058       if (std::abs(pShower.get()->GetFinalPartons().at(ipart)->pid()) == 21) {
0059         dist_output << ipart << " "
0060                     << pShower.get()->GetFinalPartons().at(ipart)->pid() << " "
0061                     << pShower.get()->GetFinalPartons().at(ipart)->e() << " "
0062                     << pShower.get()->GetFinalPartons().at(ipart)->px() << " "
0063                     << pShower.get()->GetFinalPartons().at(ipart)->py() << " "
0064                     << pShower.get()->GetFinalPartons().at(ipart)->pz() << endl;
0065       }
0066 
0067       //vPin.push_back( pShower.get()->GetFinalPartons().at(ipart));
0068     }
0069     //this->pFinals.push_back(vPin);
0070   }
0071 }
0072 
0073 void PartonPrinter::GetFinalPartons2(shared_ptr<PartonShower> pShower) {
0074   if (pShower) {
0075     /*
0076     for(unsigned int ipart=0; ipart <  pShower.get()->GetFinalPartons().size(); ++ipart)
0077     {
0078       this->pFinals.push_back( pShower.get()->GetFinalPartons());
0079       //cout << "############### FINAL PARTON IN THE VECTOR NUMBER : " << ipart << " is " << this->pFinals.at(ipart) << "###################\n";
0080     }
0081 */
0082     //this->pFinals.clear();
0083     this->pFinals.push_back(pShower.get()->GetFinalPartons());
0084   }
0085 }
0086 
0087 void PartonPrinter::Clear() {
0088   //dist_output << " *********************************** " << endl;
0089   //dist_output.close();
0090   this->pFinals.clear();
0091 }
0092 
0093 void PartonPrinter::GetPartonsAtTime(shared_ptr<PartonShower> pShower,
0094                                      vector<shared_ptr<Parton>> &fPartons,
0095                                      double time) {}
0096 
0097 } // end namespace Jetscape