40 #define BOLDCYAN "\033[1m\033[36m"
46 JetEnergyLoss::JetEnergyLoss() {
48 SetId(
"JetEnergyLoss");
49 jetSignalConnected =
false;
50 edensitySignalConnected =
false;
51 GetHydroCellSignalConnected =
false;
52 GetHydroTau0SignalConnected =
false;
53 SentInPartonsConnected =
false;
64 JetEnergyLoss::~JetEnergyLoss() {
75 SetJetSignalConnected(
false);
76 SetEdensitySignalConnected(
false);
77 SetGetHydroCellSignalConnected(
false);
78 SetGetHydroTau0SignalConnected(
false);
79 SetSentInPartonsConnected(
false);
101 this->final_Partons.clear();
109 JSINFO <<
"Initialize JetEnergyLoss ...";
111 deltaT = GetXMLElementDouble({
"Eloss",
"deltaT"});
113 maxT = GetXMLElementDouble({
"Eloss",
"maxT"});
114 JSINFO <<
"Eloss shower with deltaT = " << deltaT <<
" and maxT = " << maxT;
116 std::string mutexOnString = GetXMLElementText({
"Eloss",
"mutex"},
false);
117 if (!mutexOnString.compare(
"ON"))
120 if (GetNumberOfTasks() > 1) {
121 for (
auto elossModule : GetTaskList()) {
124 if (!(mutex_ptr->CheckMutex(GetTaskList()))) {
125 JSWARN <<
"Mutually exclusive Energy-Loss modules attached together!";
126 throw std::runtime_error(
"Fix it by attaching one of them.");
133 if (GetNumberOfTasks() < 1) {
134 JSWARN <<
" : No valid Energy Loss modules found ...";
141 JSINFO <<
"Found " << GetNumberOfTasks()
142 <<
" Eloss Tasks/Modules Initialize them ... ";
144 JetScapeTask::InitTasks();
147 void JetEnergyLoss::DoShower() {
149 double currentTime = 0;
151 VERBOSESHOWER(8) <<
"Hard Parton from Initial Hard Process ...";
157 pIn.push_back(*GetShowerInitiatingParton());
159 vector<node> vStartVec;
161 vStart = pShower->new_vertex(make_shared<Vertex>());
162 vEnd = pShower->new_vertex(make_shared<Vertex>());
167 vStartVec.push_back(vEnd);
172 bool foundchangedorig =
false;
173 int droplet_stat = -11;
177 droplet_stat = liquefier_ptr.lock()->get_drop_stat();
178 miss_stat = liquefier_ptr.lock()->get_miss_stat();
179 neg_stat = liquefier_ptr.lock()->get_neg_stat();
183 vector<Parton> pInTemp;
185 vector<node> vStartVecOut;
186 vector<node> vStartVecTemp;
188 VERBOSESHOWER(7) <<
"Current time = " << currentTime <<
" with #Input "
190 currentTime += deltaT;
192 for (
int i = 0;
i < pIn.size();
i++) {
193 vector<Parton> pInTempModule;
194 vector<Parton> pOutTemp;
196 pInTempModule.push_back(pIn[
i]);
197 SentInPartons(deltaT, currentTime, pIn[i].
pt(), pInTempModule, pOutTemp);
201 liquefier_ptr.lock()->add_hydro_sources(pInTempModule, pOutTemp);
205 if (!foundchangedorig) {
210 pShower->new_parton(vStart, vEnd,
211 make_shared<Parton>(pInTempModule.at(0)));
212 foundchangedorig =
true;
215 vStart = vStartVec[
i];
216 if (pOutTemp.size() == 0) {
219 if (pInTempModule[0].pstat() != droplet_stat &&
220 pInTempModule[0].pstat() != miss_stat &&
221 pInTempModule[0].pstat() != neg_stat &&
222 !pInTempModule[0].isPhoton(pInTempModule[0].
pid())) {
223 vStartVecTemp.push_back(vStart);
225 }
else if (pOutTemp.size() == 1) {
228 if (pOutTemp[0].pstat() != droplet_stat &&
229 pOutTemp[0].pstat() != miss_stat &&
230 pOutTemp[0].pstat() != neg_stat &&
231 !pOutTemp[0].isPhoton(pOutTemp[0].
pid())) {
232 vStartVecTemp.push_back(vStart);
235 for (
int k = 0;
k < pOutTemp.size();
k++) {
237 if (pOutTemp[
k].pstat() == neg_stat) {
238 node vNewRootNode = pShower->new_vertex(
239 make_shared<Vertex>(0, 0, 0, currentTime - deltaT));
240 edgeid = pShower->new_parton(vNewRootNode, vStart,
241 make_shared<Parton>(pOutTemp[
k]));
244 pShower->new_vertex(make_shared<Vertex>(0, 0, 0, currentTime));
245 edgeid = pShower->new_parton(vStart, vEnd,
246 make_shared<Parton>(pOutTemp[
k]));
248 pOutTemp[
k].set_shower(pShower);
249 pOutTemp[
k].set_edgeid(edgeid);
253 if (pOutTemp[
k].pstat() != droplet_stat &&
254 pOutTemp[
k].pstat() != miss_stat &&
255 pOutTemp[
k].pstat() != neg_stat &&
256 !pOutTemp[
k].isPhoton(pOutTemp[
k].
pid())) {
257 vStartVecOut.push_back(vEnd);
268 if (pInTempModule.size() > 1) {
269 VERBOSE(7) << pInTempModule.size() - 1
270 <<
" new root node(s) to be added ...";
274 for (
int l = 1; l < pInTempModule.size(); l++) {
275 node vNewRootNode = pShower->new_vertex(
276 make_shared<Vertex>(0, 0, 0, currentTime - deltaT));
277 pShower->new_parton(vNewRootNode, vEnd,
278 make_shared<Parton>(pInTempModule[l]));
285 if (pOutTemp.size() == 0) {
289 if (pInTempModule[0].pstat() == droplet_stat)
291 if (pInTempModule[0].pstat() == miss_stat)
293 if (pInTempModule[0].pstat() == neg_stat)
297 if (pInTempModule[0].isPhoton(pInTempModule[0].
pid()))
299 pInTemp.push_back(pInTempModule[0]);
300 }
else if (pOutTemp.size() == 1) {
304 if (pOutTemp[0].pstat() == droplet_stat)
306 if (pOutTemp[0].pstat() == miss_stat)
308 if (pOutTemp[0].pstat() == neg_stat)
312 if (pOutTemp[0].isPhoton(pOutTemp[0].
pid()))
314 pInTemp.push_back(pOutTemp[0]);
316 for (
int k = 0;
k < pOutTemp.size();
k++) {
319 if (pOutTemp[
k].pstat() == droplet_stat)
321 if (pOutTemp[
k].pstat() == miss_stat)
323 if (pOutTemp[
k].pstat() == neg_stat)
327 if (pOutTemp[
k].pstat() == miss_stat)
330 if (pOutTemp[
k].isPhoton(pOutTemp[
k].
pid()))
333 pOut.push_back(pOutTemp[
k]);
340 pIn.insert(pIn.end(), pInTemp.begin(), pInTemp.end());
341 pIn.insert(pIn.end(), pOut.begin(), pOut.end());
345 vStartVec.insert(vStartVec.end(), vStartVecTemp.begin(),
346 vStartVecTemp.end());
347 vStartVec.insert(vStartVec.end(), vStartVecOut.begin(), vStartVecOut.end());
348 }
while (currentTime < maxT);
354 void JetEnergyLoss::Exec() {
355 VERBOSE(1) <<
"Run JetEnergyLoss ...";
356 VERBOSE(1) <<
"Found " << GetNumberOfTasks()
357 <<
" Eloss Tasks/Modules Execute them ... ";
361 if (GetShowerInitiatingParton()) {
362 pShower = make_shared<PartonShower>();
380 pShower->PrintNodes();
381 pShower->PrintEdges();
383 weak_ptr<HardProcess> hproc =
384 JetScapeSignalManager::Instance()->GetHardProcessPointer();
386 for (
unsigned int ipart = 0; ipart < pShower->GetNumberOfPartons();
393 shared_ptr<PartonPrinter> pPrinter =
394 JetScapeSignalManager::Instance()->GetPartonPrinterPointer().lock();
396 pPrinter->GetFinalPartons(pShower);
399 shared_ptr<JetEnergyLoss> pEloss =
400 JetScapeSignalManager::Instance()->GetEnergyLossPointer().lock();
402 pEloss->GetFinalPartonsForEachShower(pShower);
405 JSWARN <<
"NO Initial Hard Parton for Parton shower received ...";
412 void JetEnergyLoss::WriteTask(weak_ptr<JetScapeWriter> w) {
414 VERBOSE(4) <<
"In JetEnergyLoss::WriteTask";
419 f->WriteComment(
"Energy loss Shower Initating Parton: " + GetId());
422 VERBOSE(4) <<
" writing partons... found " << pShower->GetNumberOfPartons();
426 void JetEnergyLoss::PrintShowerInitiatingParton() {
430 void JetEnergyLoss::GetFinalPartonsForEachShower(
433 this->final_Partons.push_back(shower.get()->GetFinalPartons());