lhapdf
is hosted by
Hepforge
,
IPPP Durham
LHAPDF
6.1.6
include
LHAPDF
CompositePDF.h
1
// -*- C++ -*-
2
//
3
// This file is part of LHAPDF
4
// Copyright (C) 2012-2016 The LHAPDF collaboration (see AUTHORS for details)
5
//
6
#pragma once
7
#ifndef LHAPDF_CompositePDF_H
8
#define LHAPDF_CompositePDF_H
9
10
#include "LHAPDF/PDF.h"
11
#include "LHAPDF/Interpolator.h"
12
#include "LHAPDF/Extrapolator.h"
13
#include "LHAPDF/KnotArray.h"
14
15
namespace
LHAPDF
{
16
17
21
class
CompositePDF
:
public
PDF
{
22
public
:
23
25
26
28
CompositePDF
() { }
29
33
template
<
typename
PDFPTR>
34
CompositePDF
(std::vector<PDFPTR>& pdfs) {
35
setConstituentPDFs
(pdfs);
36
}
37
39
CompositePDF
(
const
std::vector< std::pair<std::string, int> >& setnames_members);
40
42
CompositePDF
(
const
std::vector<int>& lhaids);
43
45
virtual
~CompositePDF
() {
46
reset
();
47
}
48
50
51
53
54
56
const
std::vector<PDF*>
constituentPDFs
()
const
{
57
return
_pdfs
;
58
}
59
61
std::vector<PDF*>
constituentPDFs
() {
62
return
_pdfs
;
63
}
64
66
template
<
typename
PDFPTR>
67
void
setConstituentPDFs
(std::vector<PDFPTR>& pdfs) {
68
reset
();
69
addConstituentPDFs
(pdfs);
70
}
71
73
void
addConstituentPDF
(
PDF
* pdf) {
74
_pdfs
.push_back(pdf);
75
}
76
78
template
<
typename
PDFPTR>
79
void
addConstituentPDFs
(std::vector<PDFPTR>& pdfs) {
80
for
(
PDF
* p : pdfs)
addConstituentPDF
(p);
81
}
82
84
void
reset
() {
85
for
(
PDF
* p :
_pdfs
)
delete
p;
86
_pdfs.clear();
87
}
88
90
91
93
94
95
const
std::vector<int>&
flavors
()
const
{
96
if
(
_flavors
.empty()) {
97
for
(
PDF
* p :
_pdfs
) {
98
for
(
int
pid : p->flavors()) {
99
if
(!
contains
(
_flavors
, pid))
_flavors
.push_back(pid);
100
}
101
}
102
sort(
_flavors
.begin(),
_flavors
.end());
103
// std::cout << "Computed flavors: # = " << _flavors.size() << std::endl;
104
}
105
// std::cout << "Pre-computed " << _flavors.size() << " flavors" << std::endl;
106
return
_flavors
;
107
}
108
109
bool
inRangeQ2
(
double
q2)
const
{
110
for
(
PDF
* p :
_pdfs
)
111
if
(!p->inRangeQ2(q2))
return
false
;
112
return
true
;
113
}
114
115
bool
inRangeX
(
double
x)
const
{
116
for
(
PDF
* p :
_pdfs
)
117
if
(!p->inRangeX(x))
return
false
;
118
return
true
;
119
}
120
122
123
124
protected
:
125
127
double
_xfxQ2
(
int
id
,
double
x,
double
q2)
const
{
128
double
rtn = 1;
129
for
(
const
PDF
* p :
constituentPDFs
())
130
rtn *= p->xfxQ2(
id
, x, q2);
131
return
rtn;
132
}
133
135
// std::vector< unique_ptr<PDF> > _pdfs;
136
std::vector<PDF*>
_pdfs
;
137
138
};
139
140
141
}
142
#endif
LHAPDF::CompositePDF::setConstituentPDFs
void setConstituentPDFs(std::vector< PDFPTR > &pdfs)
Set the list of constituent PDFs.
Definition:
CompositePDF.h:67
LHAPDF::CompositePDF::addConstituentPDF
void addConstituentPDF(PDF *pdf)
Append a PDF to the list of constituents.
Definition:
CompositePDF.h:73
LHAPDF::CompositePDF::CompositePDF
CompositePDF()
Default (empty) constructor.
Definition:
CompositePDF.h:28
LHAPDF::PDF
PDF is the general interface for access to parton density information.
Definition:
PDF.h:26
LHAPDF::CompositePDF::inRangeX
bool inRangeX(double x) const
Grid range check for x.
Definition:
CompositePDF.h:115
LHAPDF::CompositePDF::inRangeQ2
bool inRangeQ2(double q2) const
Grid range check for Q2.
Definition:
CompositePDF.h:109
LHAPDF::CompositePDF::addConstituentPDFs
void addConstituentPDFs(std::vector< PDFPTR > &pdfs)
Append several PDFs to the list of constituents.
Definition:
CompositePDF.h:79
LHAPDF::CompositePDF::_pdfs
std::vector< PDF * > _pdfs
Collection of owned PDF pointers.
Definition:
CompositePDF.h:136
LHAPDF::CompositePDF::constituentPDFs
std::vector< PDF * > constituentPDFs()
Get the list of constituent PDFs (non-const version)
Definition:
CompositePDF.h:61
LHAPDF::PDF::_flavors
vector< int > _flavors
Locally cached list of supported PIDs.
Definition:
PDF.h:561
LHAPDF::CompositePDF::CompositePDF
CompositePDF(std::vector< PDFPTR > &pdfs)
Constructor from a list of PDF pointers.
Definition:
CompositePDF.h:34
LHAPDF::CompositePDF::reset
void reset()
Clear the list of constituent PDFs, deleting the objects.
Definition:
CompositePDF.h:84
LHAPDF::CompositePDF::~CompositePDF
virtual ~CompositePDF()
Virtual destructor to allow inheritance.
Definition:
CompositePDF.h:45
LHAPDF::CompositePDF::flavors
const std::vector< int > & flavors() const
List of flavours defined by this PDF set.
Definition:
CompositePDF.h:95
LHAPDF::CompositePDF::constituentPDFs
const std::vector< PDF * > constituentPDFs() const
Get the list of constituent PDFs (const version)
Definition:
CompositePDF.h:56
LHAPDF
Namespace for all LHAPDF functions and classes.
Definition:
AlphaS.h:14
LHAPDF::contains
bool contains(const std::string &s, const std::string &sub)
Does a string s contain the sub substring?
Definition:
Utils.h:110
LHAPDF::CompositePDF
A PDF defined by multiplicative combination of several constituent PDFs.
Definition:
CompositePDF.h:21
LHAPDF::CompositePDF::_xfxQ2
double _xfxQ2(int id, double x, double q2) const
Get PDF xf(x,Q2) value (via multiplicative PDF combination)
Definition:
CompositePDF.h:127
Generated on Thu Jun 8 2017 16:43:05 for LHAPDF by
1.8.13