File indexing completed on 2025-08-05 08:19:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "HardProcess.h"
0017 #include "JetScapeLogger.h"
0018 #include "JetScapeXML.h"
0019 #include "JetScapeSignalManager.h"
0020 #include <string>
0021
0022 #include <iostream>
0023
0024 using namespace std;
0025
0026 #define MAGENTA "\033[35m"
0027
0028 namespace Jetscape {
0029
0030 HardProcess::HardProcess() {
0031 VERBOSE(8);
0032 SetId("HardProcess");
0033 }
0034
0035 HardProcess::~HardProcess() {
0036 VERBOSE(8);
0037 hp_list.clear();
0038 hd_list.clear();
0039 disconnect_all();
0040 }
0041
0042 void HardProcess::Init() {
0043 JetScapeModuleBase::Init();
0044
0045 JSINFO << "Initialize HardProcess : " << GetId() << " ...";
0046
0047 VERBOSE(8);
0048
0049 ini = JetScapeSignalManager::Instance()->GetInitialStatePointer().lock();
0050 if (!ini) {
0051
0052
0053 bool in_vac = GetXMLElementInt({"Eloss", "Matter", "in_vac"});
0054 if (!in_vac) {
0055 JSWARN << "No initial state module! Please check whether you intend to "
0056 "add an initial state module.";
0057 }
0058 }
0059 string status = GetXMLElementText({"PartonPrinter","Status"});
0060 if (status!="off")
0061 {
0062 printer = GetXMLElementText({"PartonPrinter","FileName"});
0063 JSINFO << BOLDYELLOW << "Extra parton info goes to " << printer ;
0064 }
0065 InitTask();
0066
0067 JetScapeTask::InitTasks();
0068 }
0069
0070 void HardProcess::Exec() {
0071 JSINFO << "Run Hard Process : " << GetId() << " ...";
0072 VERBOSE(8) << "Current Event #" << GetCurrentEvent();
0073
0074 JetScapeTask::ExecuteTasks();
0075 }
0076
0077 void HardProcess::Clear() {
0078 JSDEBUG << "Clear Hard Process : " << GetId() << " ...";
0079
0080 hp_list.clear();
0081 hd_list.clear();
0082 VERBOSE(8) << hp_list.size();
0083 }
0084
0085 void HardProcess::WriteTask(weak_ptr<JetScapeWriter> w) {
0086 VERBOSE(8);
0087
0088 auto f = w.lock();
0089 if (f) {
0090 VERBOSE(8) << f->GetOutputFileName();
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104 f->WriteComment("HardProcess Parton List: " + GetId());
0105 for (auto hp : hp_list)
0106 f->Write(hp);
0107 }
0108 }
0109
0110 void HardProcess::CollectHeader(weak_ptr<JetScapeWriter> w) {
0111 auto f = w.lock();
0112 if (f) {
0113 auto &header = f->GetHeader();
0114 header.SetSigmaGen(GetSigmaGen());
0115 header.SetSigmaErr(GetSigmaErr());
0116 header.SetPtHat(GetPtHat());
0117 header.SetEventWeight(GetEventWeight());
0118 }
0119 }
0120
0121 }