ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FinalStatePartons.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FinalStatePartons.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 #include <fstream>
18 #include <memory>
19 #include <chrono>
20 #include <thread>
21 
22 #include "gzstream.h"
23 #include "PartonShower.h"
24 #include "JetScapeLogger.h"
25 #include "JetScapeReader.h"
26 #include "JetScapeBanner.h"
27 #include "fjcore.hh"
28 
29 #include <GTL/dfs.h>
30 
31 using namespace std;
32 using namespace fjcore;
33 
34 using namespace Jetscape;
35 
36 // You could overload here and then simply use ofstream << p;
37 // ostream & operator<<(ostream & ostr, const fjcore::PseudoJet & jet);
38 
39 
40 // -------------------------------------
41 
42 int main(int argc, char** argv)
43 {
44 
45  // JetScapeLogger::Instance()->SetInfo(false);
46  JetScapeLogger::Instance()->SetDebug(false);
47  JetScapeLogger::Instance()->SetRemark(false);
48  // //SetVerboseLevel (9 a lot of additional debug output ...)
49  // //If you want to suppress it: use SetVerboseLevle(0) or max SetVerboseLevel(9) or 10
50  JetScapeLogger::Instance()->SetVerboseLevel(0);
51 
52  auto reader=make_shared<JetScapeReaderAscii>("test_out.dat");
53  std::ofstream dist_output ("JetscapeFinalStatePartons.txt"); //Format is SN, PID, E, Px, Py, Pz, Eta, Phi
54 
55  while (!reader->Finished())
56  {
57  reader->Next();
58 
59  // cout<<"Analyze current event: "<<reader->GetCurrentEvent()<<endl;
60  auto mShowers=reader->GetPartonShowers();
61 
62  dist_output<<"Event "<< reader->GetCurrentEvent()+1<<endl;
63  for (int i=0;i<mShowers.size();i++)
64  {
65  // cout<<" Analyze parton shower: "<<i<<endl;
66  // Let's create a file
67  for ( int ipart = 0; ipart< mShowers[i]->GetFinalPartons().size(); ++ipart){
68  Parton p = *mShowers[i]->GetFinalPartons().at(ipart);
69  dist_output << ipart << "\t"
70  << p.pid() << "\t"
71  << p.pstat() << "\t"
72  << p.e() << "\t"
73  << p.px() << "\t"
74  << p.py() << "\t"
75  << p.pz() << "\t"
76  << p.eta()<< "\t"<< p.phi() << endl;
77  }
78  }
79 
80  }
81 
82  reader->Close();
83 }