Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PartonShowerGenerator.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PartonShowerGenerator.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 "PartonShowerGenerator.h"
17 #include "PartonShower.h"
18 #include "JetEnergyLoss.h"
19 #include "JetScapeLogger.h"
20 
21 #include <iostream>
22 
23 using namespace std;
24 
25 namespace Jetscape {
26 
27 void PartonShowerGenerator::DoShower(JetEnergyLoss &j) {
28  double tStart = 0;
29  double currentTime = 0;
30 
31  VERBOSESHOWER(8) << "Hard Parton from Initial Hard Process ...";
33 
34  // consider pointers for speed up ...
35  vector<Parton> pIn;
36  vector<Parton> pOut;
37  vector<Parton> pInTemp;
38  vector<Parton> pOutTemp;
39  vector<Parton> pInTempModule;
40 
41  vector<node> vStartVec;
42  vector<node> vStartVecOut;
43  vector<node> vStartVecTemp;
44 
45  node vStart;
46  node vEnd;
47 
48  pIn.push_back(*j.GetShowerInitiatingParton());
49 
50  // Add here the Hard Shower emitting parton ...
51  vStart = j.GetShower()->new_vertex(make_shared<Vertex>());
52  vEnd = j.GetShower()->new_vertex(make_shared<Vertex>());
53  j.GetShower()->new_parton(
54  vStart, vEnd, make_shared<Parton>(*j.GetShowerInitiatingParton()));
55 
56  // start then the recursive shower ...
57  vStartVec.push_back(vEnd);
58  //vStartVecTemp.push_back(vEnd);
59 
60  // ISSUE: Probably not yet 100% wrt to time step evolution ...
61  // Logic mistake to remove the original ones when no split occured !!??? Follow up!!!!
62  REMARK << "DoShower() Splitting including time evolution (allowing "
63  "non-splits at later times) implemeted correctly (should be made "
64  "nicer/pointers). To be checked!!!";
65 
66  // --------------------------------------------
67 
68  do {
69  VERBOSESHOWER(7) << "Current time = " << currentTime << " with #Input "
70  << pIn.size();
71  currentTime += j.GetDeltaT();
72 
73  // --------------------------------------------
74 
75  for (int i = 0; i < pIn.size(); i++) {
76  //DEBUG:
77  //cout<<currentTime<<" pIn size = "<<pIn.size()<<" "<<i<<" "<<pIn[i].pt()<<endl;
78 
79  pInTemp.push_back(pIn[i]);
80  pInTempModule.push_back(pIn[i]);
81 
82  j.SentInPartons(j.GetDeltaT(), currentTime, pIn[i].pt(), pInTempModule,
83  pOutTemp);
84 
85  vStart = vStartVec[i];
86  vStartVecTemp.push_back(vStart);
87 
88  //DEBUG:
89  //cout<<vStart<<endl;
90  // --------------------------------------------
91  for (int k = 0; k < pOutTemp.size(); k++) {
92  vEnd = j.GetShower()->new_vertex(
93  make_shared<Vertex>(0, 0, 0, currentTime));
94  j.GetShower()->new_parton(vStart, vEnd,
95  make_shared<Parton>(pOutTemp[k]));
96 
97  //DEBUG:
98  //cout<<vStart<<"-->"<<vEnd<<endl;
99  //cout<<pOutTemp[k];
100  //cout<<vStartVec.size()<<endl;
101  //cout<<pInTempModule.size()<<endl;
102 
103  vStartVecOut.push_back(vEnd);
104  pOut.push_back(pOutTemp[k]);
105 
106  // --------------------------------------------
107  // Add new roots from ElossModules ...
108  // (maybe add for clarity a new vector in the signal!???)
109  // Otherwise keep track of input size (so far always 1
110  // and check if size > 1 and create additional root nodes to that vertex ...
111  // Simple Test here below:
112  // DEBUG:
113  //cout<<"In JetEnergyloss : "<<pInTempModule.size()<<endl;
114 
115  if (pInTempModule.size() > 1) {
116  VERBOSESHOWER(7) << pInTempModule.size() - 1
117  << " new root node(s) to be added ...";
118  //cout<<pInTempModule.size()-1<<" new root node(s) to be added ..."<<endl;
119 
120  for (int l = 1; l < pInTempModule.size(); l++) {
121  node vNewRootNode = j.GetShower()->new_vertex(
122  make_shared<Vertex>(0, 0, 0, currentTime - j.GetDeltaT()));
123  j.GetShower()->new_parton(vNewRootNode, vEnd,
124  make_shared<Parton>(pInTempModule[l]));
125  }
126  }
127  // --------------------------------------------
128 
129  if (k == 0) {
130  pInTemp.pop_back();
131  vStartVecTemp.pop_back();
132  }
133  }
134  // --------------------------------------------
135 
136  pOutTemp.clear();
137  pInTempModule.clear();
138  }
139 
140  // --------------------------------------------
141 
142  pIn.clear();
143 
144  pIn.insert(pIn.end(), pInTemp.begin(), pInTemp.end());
145  pIn.insert(pIn.end(), pOut.begin(), pOut.end());
146 
147  pOut.clear();
148  pInTemp.clear();
149 
150  vStartVec.clear();
151 
152  vStartVec.insert(vStartVec.end(), vStartVecTemp.begin(),
153  vStartVecTemp.end());
154  vStartVec.insert(vStartVec.end(), vStartVecOut.begin(), vStartVecOut.end());
155 
156  vStartVecOut.clear();
157  vStartVecTemp.clear();
158  } while (currentTime < j.GetMaxT()); //other criteria (how to include; TBD)
159 
160  // --------------------------------------------
161 
162  // real ceck using mom. consveration at vertex ...!!!!
163  //pShower->save(&(cout<<BOLDCYAN));
164 
165  pIn.clear();
166  pOut.clear();
167  pInTemp.clear();
168  pOutTemp.clear();
169  vStartVec.clear();
170 }
171 
172 } // end namespace Jetscape