-
Notifications
You must be signed in to change notification settings - Fork 0
/
YSCrossSectionpp.cpp
133 lines (117 loc) · 3.4 KB
/
YSCrossSectionpp.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//
// YSCrossSectionpp.cpp
// calculates the pp cross section from systematics data in mb energy (√s) in GeV
//
// Created by Yves Schutz on 06/03/14.
// Copyright (c) 2014 Yves Schutz. All rights reserved.
//
#include <QDebug>
#include <QtMath>
#include "qcustomplot.h"
#include "YSCrossSectionpp.h"
//______________________________________________________________________________
YSCrossSectionpp::YSCrossSectionpp()
{
// ctor
SetName("pp Cross Section");
SetAxisLabel("√s (GeV)", "sigma (mb)");
}
//______________________________________________________________________________
YSCrossSectionpp::~YSCrossSectionpp()
{
// dtor
}
//______________________________________________________________________________
qreal YSCrossSectionpp::Eval(qreal x) const
{
// compute the function at x
qreal rv = 0.;
if (x == 0)
return rv;
switch (mType) {
case kElastic:
{
rv = mPar[0] + mPar[1] *pow(x * x, mPar[2])+
mPar[3] * pow(log(x * x / mPar[4]), 2.);
break;
}
case kInelastic:
{
rv = (mPar[0] + mPar[1] *pow(x * x, mPar[2]) +
mPar[3] * pow(log(x * x / mPar[4]), 2.)+
mPar[5] * pow(x * x, mPar[6])) -
(mPar[7] + mPar[8] * pow(x * x, mPar[9]) +
mPar[10] * pow(log(x * x / mPar[11]), 2.) +
mPar[12] * pow(x * x, mPar[13]));
break;
}
case kTotal:
{
rv = mPar[0] + mPar[1] * pow(x * x, mPar[2])+
mPar[3] * pow(log(x * x / mPar[4]), 2.) +
mPar[5] * pow(x * x, mPar[6]);
break;
}
default:
break;
}
return rv;
}
//______________________________________________________________________________
void YSCrossSectionpp::Print() const
{
// print the formula
switch (mType) {
case kElastic:
{
qDebug() << "pp elastic cross section";
qDebug() << "[0]+[1]*pow(x*x,[2])+[3]*pow(log(x*x/[4]),2.)";
break;
}
case kInelastic:
{
qDebug() << "pp inelastic cross section";
qDebug() << "([0]+[1]*pow(x*x,[2])+[3]*pow(log(x*x/[4]),2.)+[5]*pow(x*x,[6]))-([7]+[8]*pow(x*x,[9])+[10]*pow(log(x*x/[11]),2.)+[12]*pow(x*x,[13]))";
break;
}
case kTotal:
{
qDebug() << "pp total cross section";
qDebug() << "[0]+[1]*pow(x*x,[2])+[3]*pow(log(x*x/[4]),2.)+[5]*pow(x*x,[6])";
break;
}
default:
break;
}
qDebug() << "cross section in mb (10**-27 cm2)";
for(int index = 0; index < mPar.size(); index++)
qDebug() << QString("[%1] = %2").arg(index).arg(mPar[index]);
}
//______________________________________________________________________________
void YSCrossSectionpp::SetType(YSCrossSectionpp::YSCSType type)
{
// selects among elastic, inelastic and total
// cross seection in mb
mType = type;
QVector<double> array;
switch (mType) {
case kElastic:
{
array << 5.166342 << 1.287805E1 << -4.059868E-1 << 9.028824E-2 << 2.92E1;
break;
}
case kInelastic:
{
array << 35.5 << 42.59 << -0.46 << 0.3076 << 29.2 << -33.36 << -0.5454 << 5.166342 << 12.87805 << -0.4059868 << 0.09028824 << 29.2 << 0.0 << 0.0;
break;
}
case kTotal:
{
array << 3.55E1 << 4.259E1 << -4.6E-1 << 3.076E-1 << 2.92E1 << -3.336E1 << -5.454E-1;
break;
}
default:
break;
}
SetParameters(array);
}