Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PartonPrinter.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PartonPrinter.cc
1 /*******************************************************************************
2  * Copyright (c) The JETSCAPE Collaboration, 2018
3  *
4  * Modular, task-based framework for simulating all aspects of heavy-ion collisions
5  *
6  * For the list of contributors see AUTHORS.
7  *
8  * Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9  *
10  * or via email to bugs.jetscape@gmail.com
11  *
12  * Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13  * See COPYING for details.
14  ******************************************************************************/
15 
16 #include <iostream>
17 
18 #include "PartonPrinter.h"
19 #include "GTL/graph.h"
20 #include <GTL/edge_map.h>
21 #include <GTL/node_map.h>
22 #include "JetClass.h"
23 #include "JetScapeLogger.h"
24 #include <string>
25 
26 using namespace std;
27 
28 namespace Jetscape {
29 
30 // Register the module with the base class
31 RegisterJetScapeModule<PartonPrinter> PartonPrinter::reg("PartonPrinter");
32 
33 PartonPrinter::PartonPrinter() {}
34 
35 PartonPrinter::~PartonPrinter() {}
36 
38  this->SetId("PartonPrinter");
39  JSINFO << "Initialize PartonPrinter ...";
40  string filename = GetXMLElementText({"PartonPrinter","FileName"});
41 
42  dist_output.open(filename,std::ios::app);
43 }
44 
45 void PartonPrinter::Exec() {
46  VERBOSE(2) << "Run PartonPrinter: print shower from event # "
47  << GetCurrentEvent() << " ...";
48 }
49 
50 void PartonPrinter::GetFinalPartons(
52  pShower /*, vector<shared_ptr<Parton>>& fPartons*/) {
53  if (pShower) {
54  //vector<shared_ptr<Parton>> vPin;
55  for (unsigned int ipart = 0;
56  ipart < pShower.get()->GetFinalPartons().size(); ++ipart) {
57  //fPartons.push_back( pShower.get()->GetFinalPartons().at(ipart));
58  if (std::abs(pShower.get()->GetFinalPartons().at(ipart)->pid()) == 21) {
59  dist_output << ipart << " "
60  << pShower.get()->GetFinalPartons().at(ipart)->pid() << " "
61  << pShower.get()->GetFinalPartons().at(ipart)->e() << " "
62  << pShower.get()->GetFinalPartons().at(ipart)->px() << " "
63  << pShower.get()->GetFinalPartons().at(ipart)->py() << " "
64  << pShower.get()->GetFinalPartons().at(ipart)->pz() << endl;
65  }
66 
67  //vPin.push_back( pShower.get()->GetFinalPartons().at(ipart));
68  }
69  //this->pFinals.push_back(vPin);
70  }
71 }
72 
73 void PartonPrinter::GetFinalPartons2(shared_ptr<PartonShower> pShower) {
74  if (pShower) {
75  /*
76  for(unsigned int ipart=0; ipart < pShower.get()->GetFinalPartons().size(); ++ipart)
77  {
78  this->pFinals.push_back( pShower.get()->GetFinalPartons());
79  //cout << "############### FINAL PARTON IN THE VECTOR NUMBER : " << ipart << " is " << this->pFinals.at(ipart) << "###################\n";
80  }
81 */
82  //this->pFinals.clear();
83  this->pFinals.push_back(pShower.get()->GetFinalPartons());
84  }
85 }
86 
88  //dist_output << " *********************************** " << endl;
89  //dist_output.close();
90  this->pFinals.clear();
91 }
92 
93 void PartonPrinter::GetPartonsAtTime(shared_ptr<PartonShower> pShower,
94  vector<shared_ptr<Parton>> &fPartons,
95  double time) {}
96 
97 } // end namespace Jetscape