File: PDFBase.cc

package info (click to toggle)
thepeg 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 9,312 kB
  • ctags: 11,509
  • sloc: cpp: 57,129; sh: 11,315; java: 3,212; lisp: 1,402; makefile: 830; ansic: 58; perl: 3
file content (173 lines) | stat: -rw-r--r-- 5,817 bytes parent folder | download
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// -*- C++ -*-
//
// PDFBase.cc is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
//
// This is the implementation of the non-inlined, non-templated member
// functions of the PDFBase class.
//

#include "PDFBase.h"
#include "ThePEG/PDF/RemnantHandler.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"
#include "ThePEG/PDT/ParticleData.h"
#include "ThePEG/Interface/Reference.h"
#include "ThePEG/Interface/Switch.h"
#include "ThePEG/Utilities/Debug.h"
#include "ThePEG/Repository/Repository.h"
#include "ThePEG/Utilities/EnumIO.h"
#include "ThePEG/Interface/ClassDocumentation.h"
#include "ThePEG/PDT/StandardMatchers.h"

using namespace ThePEG;
PDFBase::PDFBase()
  : rangeException(rangeZero) {}

PDFBase::PDFBase(const PDFBase & x)
  : HandlerBase(x), theRemnantHandler(x.theRemnantHandler),
    rangeException(x.rangeException) {}

PDFBase::~PDFBase() {}

bool PDFBase::canHandle(tcPDPtr particle) const {
  return canHandleParticle(particle) && remnantHandler() &&
    remnantHandler()->canHandle(particle, partons(particle));
}

bool PDFBase::hasPoleIn1(tcPDPtr, tcPDPtr) const {
  return false;
}

double PDFBase::
xfx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale, double x,
    double eps, Energy2 particleScale) const {
  using Math::log1m;
  return xfl(particle, parton, partonScale,
	     (x < 0.5 || eps <= 0.0)? -log(x): -log1m(eps), particleScale);
}

double PDFBase::
xfl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale, double l,
    Energy2 particleScale) const {
  using Math::exp1m;
  return xfx(particle, parton, partonScale, exp(-l), exp1m(-l), particleScale);
}

double PDFBase::
xfvx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale, double x,
     double eps, Energy2 particleScale) const {
  if ( !QuarkMatcher::Check(*parton) ) return 0.0;
  return max(0.0, xfx(particle, parton, partonScale, x, eps, particleScale) -
	     xfx(particle, parton->CC(), partonScale, x, eps, particleScale));
}

double PDFBase::
xfvl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale, double l,
     Energy2 particleScale) const {
  if ( !QuarkMatcher::Check(*parton) ) return 0.0;
  return max(0.0, xfl(particle, parton, partonScale, l, particleScale) -
	     xfl(particle, parton->CC(), partonScale, l, particleScale));
}

double PDFBase::
xfsx(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale, double x,
     double eps, Energy2 particleScale) const {
  return max(0., xfx(particle,parton,partonScale,x,eps,particleScale)-
	     xfvx(particle,parton,partonScale,x,eps,particleScale));
}

double PDFBase::
xfsl(tcPDPtr particle, tcPDPtr parton, Energy2 partonScale, double l,
     Energy2 particleScale) const {
  return max(0., xfl(particle,parton,partonScale,l,particleScale)-
	     xfvl(particle,parton,partonScale,l,particleScale));
}

double PDFBase::flattenL(tcPDPtr, tcPDPtr, const PDFCuts & c,
			 double z, double & jacobian) const {
  jacobian *= c.lMax() - c.lMin();
  return c.lMin() + z*(c.lMax() - c.lMin());
}

double PDFBase::
flattenScale(tcPDPtr, tcPDPtr, const PDFCuts & c,
	     double l, double z, double & jacobian) const {
  if ( c.scaleMin()  > ZERO ) {
    double r = c.scaleMaxL(l)/c.scaleMin();
    double ret = pow(r, z - 1.0);
    jacobian *= log(r)*ret;
    return ret;
  } else {
    return z;
  }
}

void PDFBase::doinit() {
  HandlerBase::doinit();
}

void PDFBase::persistentOutput(PersistentOStream & os) const {
  os << theRemnantHandler << oenum(rangeException);
}

void PDFBase::persistentInput(PersistentIStream & is, int) {
  is >> theRemnantHandler >> ienum(rangeException);
}

AbstractClassDescription<PDFBase> PDFBase::initPDFBase;

void PDFBase::Init() {

  static ClassDocumentation<PDFBase> documentation
    ("There is no documentation for the ThePEG::PDFBase class");

  static Reference<PDFBase,RemnantHandler> interfaceRemnantHandler
    ("RemnantHandler",
     "A remnant handler capable of generating remnants for the partons "
     "which can be extracted with this PDF.",
     &PDFBase::theRemnantHandler, false, false, true, false);

  static Switch<PDFBase,RangeException> interfaceRangeException
    ("RangeException",
     "How to handle cases when momentum fractions or scales are "
     "outside of limits. Note that this switch may be ignored in sub-classes.",
     &PDFBase::rangeException, rangeZero, true, false);
  static SwitchOption interfaceRangeExceptionFreeze
    (interfaceRangeException,
     "Freeze", "Values are frozen outside the given ranges.", rangeFreeze);
  static SwitchOption interfaceRangeExceptionZero
    (interfaceRangeException,
     "Zero", "Values are zero outside the given ranges.", rangeZero);
  static SwitchOption interfaceRangeExceptionThrow
    (interfaceRangeException,
     "Throw", "An exception is thrown outside the given ranges.", rangeThrow);

}

RemnantHandlerCantHandle::RemnantHandlerCantHandle(string pdf, string rh) {
  theMessage << "Cannot assign '" << rh << "' as remnant handler for the "
	     << "parton density object '" << pdf
	     << "' because the remnant handler does not feel up to the job.";
  severity(warning);
}

PDFWrongParticle::PDFWrongParticle(string p, string pdf, string mess) {
  theMessage << "Cannot assign particle '" << p << "' to be handled by the "
	     << "parton density object '" << pdf << "'. " << mess;
  severity(warning);
}

PDFRange::PDFRange(string pdf, string var, double val, double lim) {
  theMessage << "In parton density function '" << pdf << "': the value of "
	     << var << ", " << val << ", was out of range (" << lim
	     << ").";
  severity(eventerror);
}