Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ElossValidation.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ElossValidation.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 "ElossValidation.h"
17 #include "JetScapeLogger.h"
18 #include "JetScapeXML.h"
19 #include <string>
20 
21 #include "tinyxml2.h"
22 #include <iostream>
23 
24 #include "FluidDynamics.h"
25 
26 #define MAGENTA "\033[35m"
27 
28 using namespace Jetscape;
29 using namespace std;
30 
31 const double QS = 1.0;
32 
34  SetId("ElossValidate");
35  VERBOSE(8);
36 }
37 
39 
41  JSINFO << "Initialize ElossValidate ...";
42 
43  std::string s = GetXMLElementText({"Eloss", "ElossValidate", "name"});
44  JSINFO << s << " to be initializied ...";
45 }
46 
47 void ElossValidate::WriteTask(weak_ptr<JetScapeWriter> w) {
48  VERBOSE(8);
49  auto f = w.lock();
50  if (!f)
51  return;
52  f->WriteComment("ElossModule Parton List: " + GetId());
53 }
54 
55 void ElossValidate::DoEnergyLoss(double deltaT, double time, double Q2,
56  vector<Parton> &pIn, vector<Parton> &pOut) {
57 
58  VERBOSESHOWER(8) << MAGENTA << "SentInPartons Signal received : " << deltaT
59  << " " << Q2 << " " << &pIn;
60 
61  // Check hydro communication
62  std::unique_ptr<FluidCellInfo> check_fluid_info_ptr;
63  GetHydroCellSignal(1, 1.0, 1.0, 0.0, check_fluid_info_ptr);
64 
65  double delT = deltaT;
66  double Time = time * fmToGeVinv;
67  double deltaTime = delT * fmToGeVinv;
68 
69  JSINFO << " the time in fm is " << time << " The time in GeV-1 is " << Time;
70  JSINFO << " pid = " << pIn[0].pid() << " E = " << pIn[0].e()
71  << " px = " << pIn[0].p(1) << " py = " << pIn[0].p(2)
72  << " pz = " << pIn[0].p(3) << " virtuality = " << pIn[0].t()
73  << " form_time in fm = " << pIn[0].form_time() / fmToGeVinv;
74  JSINFO << " color = " << pIn[0].color()
75  << " anti-color = " << pIn[0].anti_color();
76 
77  for (int i = 0; i < pIn.size(); i++) {
78  TakeResponsibilityFor(
79  pIn[i]); // Generate error if another module already has responsibility.
80  JSINFO << " Parton Q2= " << pIn[i].t();
81  JSINFO << " Parton Id= " << pIn[i].pid()
82  << " and mass= " << pIn[i].restmass();
83 
84  double velocity[4];
85  velocity[0] = 1.0;
86  for (int j = 1; j <= 3; j++) {
87  velocity[j] = pIn[i].p(j) / pIn[i].e();
88  }
89 
90  if (pIn[i].form_time() <
91  0.0) {
92  pIn[i].set_jet_v(velocity);
93  pIn[i].set_t(QS * 2.);
94  pIn[i].set_mean_form_time();
95  JSINFO << " UPDATED Parton Q2= " << pIn[i].t();
96  }
97 
98  if (pIn[i].t() >= QS) {
99  JSINFO << " ************ ";
100  JSINFO << " DOING ELOSS ";
101  JSINFO << " ************ ";
102 
103  // Split once
104  // ----------
105 
106  // daughter virtualities
107  double tQd1 = QS - 0.00001;
108  double tQd2 = QS - 0.00001;
109 
110  // Always just radiate a gluon
111  int d1_pid = pIn[i].pid();
112  int d2_pid = gid;
113 
114  double newp[4];
115  double newx[4];
116 
117  double z1 = 0.6;
118  double z2 = 1.0 - z1;
119 
120  newx[0] = Time + deltaTime;
121  for (int j = 1; j <= 3; j++) {
122  newx[j] =
123  pIn[i].x_in().comp(j) + (Time + deltaTime - pIn[i].x_in().comp(0));
124  }
125 
126  // First daughter
127  newp[0] = z1 * pIn[i].e();
128  newp[1] = z1 * pIn[i].px() * (1.1);
129  newp[2] = z1 * pIn[i].py() * (0.9);
130  newp[3] = z1 * pIn[i].pz() * (1.1);
131  pOut.push_back(Parton(0, d1_pid, 0, newp, newx));
132  pOut.back().set_jet_v(pIn[i].jet_v());
133  pOut.back().set_t(tQd1);
134  pOut.back().set_mean_form_time();
135  pOut.back().set_form_time(10);
136 
137  // Second daughter
138  newp[0] = z2 * pIn[i].e();
139  newp[1] = z2 * pIn[i].px() * (0.9);
140  newp[2] = z2 * pIn[i].py() * (1.1);
141  newp[3] = z2 * pIn[i].pz() * (0.8);
142  pOut.push_back(Parton(0, d2_pid, 0, newp, newx));
143  pOut.back().set_jet_v(pIn[i].jet_v());
144  pOut.back().set_t(tQd2);
145  pOut.back().set_mean_form_time();
146  pOut.back().set_form_time(10);
147  }
148  }
149 }