Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetScapeTask.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetScapeTask.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 "JetScapeTask.h"
17 #include "JetScapeTaskSupport.h"
18 #include "JetScapeLogger.h"
19 
20 #include "JetEnergyLoss.h"
21 
22 #include <iostream>
23 
24 using namespace std;
25 
26 namespace Jetscape {
27 
28 JetScapeTask::JetScapeTask() {
29  active_exec = true;
30  id = "";
31  my_task_number_ = JetScapeTaskSupport::Instance()->RegisterTask();
32  VERBOSE(9);
33 }
34 
35 JetScapeTask::~JetScapeTask() {
36  VERBOSE(9);
37  JSDEBUG << "Deleting task with id=" << GetId()
38  << " and TaskNumber= " << GetMyTaskNumber();
39 }
40 
42 
45 void JetScapeTask::InitTasks() {
46  VERBOSE(7) << " : # Subtasks = " << tasks.size();
47 
48  //In short ...
49  for (auto it : tasks)
50  it->Init();
51 }
52 
53 void JetScapeTask::Exec() { VERBOSE(7); }
54 
55 void JetScapeTask::ExecuteTasks() {
56  VERBOSE(7) << " : # Subtasks = " << tasks.size();
57  for (auto it : tasks) {
58  if (it->active_exec) {
59  JSDEBUG << "Executing " << it->GetId();
60  it->Exec();
61  }
62  }
63 }
64 
65 void JetScapeTask::ClearTasks() {
66  VERBOSE(7) << " : # Subtasks = " << tasks.size();
67  for (auto it : tasks)
68  if (it->active_exec)
69  it->Clear();
70 }
71 
72 void JetScapeTask::WriteTasks(weak_ptr<JetScapeWriter> w) {
73  //VERBOSE(10);
74  if (active_exec) {
75  for (auto it : tasks)
76  it->WriteTask(w);
77  }
78 }
79 
80 void JetScapeTask::CollectHeaders(weak_ptr<JetScapeWriter> w) {
81  //VERBOSE(10);
82  if (active_exec) {
83  for (auto it : tasks)
84  it->CollectHeader(w);
85  }
86 }
87 
88 void JetScapeTask::Add(shared_ptr<JetScapeTask> m_tasks) {
89  tasks.push_back(m_tasks);
90 }
91 
92 } // end namespace Jetscape