-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMadGraphProcess.cpp
75 lines (66 loc) · 2.6 KB
/
MadGraphProcess.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//=============================================================================
// NOLI SE TANGERE
#include "CPPProcess.h"
#include "CepGen/Core/Exception.h"
#include "CepGen/Event/Event.h"
#include "CepGen/Modules/ProcessesFactory.h"
#include "CepGen/Process/KTProcess.h"
using namespace cepgen;
class MadGraphProcess : public proc::KTProcess {
public:
MadGraphProcess(const ParametersList& params);
proc::ProcessPtr clone(const ParametersList&) const override { return proc::ProcessPtr(new MadGraphProcess(*this)); }
private:
void preparePhaseSpace() override;
double computeKTFactorisedMatrixElement() override;
void fillCentralParticlesKinematics() override;
const std::string param_card_;
CPPProcess proc_;
Momentum qt_1_, qt_2_;
std::vector<Momentum> p_cent_;
std::vector<double*> momenta_;
};
MadGraphProcess::MadGraphProcess(const ParametersList& params)
: KTProcess(params, std::array<pdgid_t, 2>{}, std::vector<pdgid_t>{}),
param_card_(params.get<std::string>("parametersCard", "param_card.dat")) {
description_ = proc_.name();
params_.set<std::string>("description", description_);
CG_INFO("MadGraphProcess") << "Process considered: " << description_;
}
void MadGraphProcess::preparePhaseSpace() {
//--- initialise the process
try {
proc_.initProc(param_card_);
} catch (const char* chr) {
throw CG_FATAL("MadGraphProcess") << "Failed to initialise parameters card at \"" << param_card_ << "\":\n\t"
<< chr;
}
if (proc_.nprocesses > 1)
throw CG_FATAL("MadGraphProcess") << "Multi-processes matrix elements are not supported!";
momenta_.resize(proc_.nexternal);
for (size_t i = proc_.ninitial; i < proc_.nexternal; ++i)
p_cent_.emplace_back(0., 0., 0., proc_.getMasses().at(i));
}
double MadGraphProcess::computeKTFactorisedMatrixElement() {
qt_1_ = Momentum::fromPtEtaPhi(qt1_, 0., phi_qt1_);
qt_2_ = Momentum::fromPtEtaPhi(qt2_, 0., phi_qt2_);
qt_1_.setMass(0.);
qt_2_.setMass(0.);
momenta_[0] = qt_1_.pVector().data();
momenta_[1] = qt_2_.pVector().data();
for (size_t i = 0; i < p_cent_.size(); ++i)
momenta_[2 + i] = p_cent_.at(i).pVector().data();
proc_.setMomenta(momenta_);
proc_.sigmaKin();
const double* me = proc_.getMatrixElements();
return me[0] * constants::GEVM2_TO_PB;
}
void MadGraphProcess::fillCentralParticlesKinematics() {
const auto& mom_filled = proc_.getMomenta();
for (const auto& mom4 : mom_filled) {
Momentum mom(mom4);
//CG_INFO( "" ) << mom;
}
}
REGISTER_PROCESS("mg5", "", MadGraphProcess)
//=============================================================================