Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F19252039
PDF.cc
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
PDF.cc
View Options
/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#include
"HEJ/PDF.hh"
#include
<iostream>
#include
<stdexcept>
#include
<string>
namespace
HEJ
{
namespace
{
int
to_beam
(
ParticleID
id
){
if
(
std
::
abs
(
id
)
==
pid
::
proton
){
return
(
id
>
0
)
?
1
:-
1
;
}
throw
std
::
invalid_argument
(
"unknown beam type: "
+
std
::
to_string
(
id
)
);
}
}
#if defined LHAPDF_MAJOR_VERSION && LHAPDF_MAJOR_VERSION == 6
PDF
::
PDF
(
int
id
,
ParticleID
beam1
,
ParticleID
beam2
)
:
pdf
{
LHAPDF
::
mkPDF
(
id
)},
beamtype
{{
to_beam
(
beam1
),
to_beam
(
beam2
)}}
{}
double
PDF
::
pdfpt
(
size_t
beam_idx
,
double
x
,
double
q
,
ParticleID
id
)
const
{
if
(
!
(
inRangeQ
(
q
)
&&
inRangeX
(
x
)))
return
0.
;
if
(
id
==
pid
::
gluon
){
return
pdf
->
xfxQ
(
21
,
x
,
q
);
}
else
if
(
abs
(
id
)
<
7
){
return
pdf
->
xfxQ
(
id
*
beamtype
[
beam_idx
],
x
,
q
);
}
else
{
std
::
cerr
<<
"particle type unknown: "
<<
id
<<
std
::
endl
;
return
0.0
;
}
}
double
PDF
::
Halphas
(
double
q
)
const
{
double
as
=
pdf
->
alphasQ
(
q
);
if
(
std
::
isnan
(
as
)
||
as
>
0.5
)
{
as
=
0.5
;
}
return
as
;
}
int
PDF
::
id
()
const
{
return
pdf
->
lhapdfID
();
};
bool
PDF
::
inRangeQ
(
double
q
)
const
{
return
pdf
->
inRangeQ
(
q
);
}
bool
PDF
::
inRangeX
(
double
x
)
const
{
return
pdf
->
inRangeX
(
x
);
}
#else
/* LHAPDF version unknown or older than 6 */
PDF
::
PDF
(
std
::
string
LHAPDFName
,
int
LHAPDFsubset
,
ParticleID
beam1
,
ParticleID
beam2
)
:
beamtype
{{
to_beam
(
beam1_type
),
to_beam
(
beam2_type
)}}
{
LHAPDF
::
initPDFSet
(
LHAPDFName
,
LHAPDF
::
LHGRID
,
LHAPDFsubset
);
}
double
PDF
::
pdfpt
(
size_t
beam_idx
,
double
x
,
double
q
,
ParticleID
id
)
const
{
if
(
!
(
inRangeQ
(
q
)
&&
inRangeX
(
x
)))
return
0.
;
if
(
id
==
pid
::
gluon
){
return
LHAPDF
::
xfx
(
x
,
q
,
0
);
}
else
if
(
abs
(
id
)
<
7
){
return
LHAPDF
::
xfx
(
x
,
q
,
id
*
beamtype
[
beam_idx
]);
}
else
{
std
::
cerr
<<
"particle type unknown: "
<<
id
<<
std
::
endl
;
return
0.0
;
}
}
double
PDF
::
Halphas
(
double
q
)
const
{
double
as
=
LHAPDF
::
alphasPDF
(
q
);
if
(
isnan
(
as
)
||
as
>
0.5
)
as
=
0.5
;
return
as
;
}
bool
PDF
::
inRangeQ
(
double
q
)
const
{
// here we assume that all members actually have the same range!
static
constexpr
int
member
=
0
;
return
(
LHAPDF
::
getQ2min
(
member
)
<
q
*
q
)
&&
(
q
*
q
<
LHAPDF
::
getQ2max
(
member
));
}
bool
PDF
::
inRangeX
(
double
x
)
const
{
// here we assume that all members actually have the same range!
static
constexpr
int
member
=
0
;
return
(
LHAPDF
::
getXmin
(
member
)
<
x
)
&&
(
x
<
LHAPDF
::
getXmax
(
member
));
}
#endif
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Tue, Sep 30, 6:13 AM (13 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6480624
Default Alt Text
PDF.cc (2 KB)
Attached To
Mode
rHEJ HEJ
Attached
Detach File
Event Timeline
Log In to Comment