File: PartonBinInstance.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 (145 lines) | stat: -rw-r--r-- 4,921 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
// -*- C++ -*-
//
// PartonBinInstance.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 PartonBinInstance class.
//

#include "PartonBinInstance.h"
#include "ThePEG/Persistency/PersistentOStream.h"
#include "ThePEG/Persistency/PersistentIStream.h"

using namespace ThePEG;

PartonBinInstance::PartonBinInstance()
  : theJacobian(1.0), theXi(-1.0), theEps(-1.0), theLi(-1.0), theX(-1.0),
    theL(-1.0), theScale(ZERO), theRemnantWeight(0.0) {}

PartonBinInstance::PartonBinInstance(const PartonBinInstance & x)
  : Base(x),
    theBin(x.theBin), theBins(x.theBins), theIncoming(x.theIncoming),
    theJacobian(x.theJacobian), theParticle(x.theParticle),
    theParton(x.theParton), thePartons(x.thePartons), theXi(x.theXi),
    theEps(x.theEps), theLi(x.theLi), theX(x.theX), theL(x.theL),
    theScale(x.theScale), theKT(x.theKT), theRemnantWeight(x.theRemnantWeight),
    theRemnants(x.theRemnants), theRemInfo(x.theRemInfo) {}

PartonBinInstance::PartonBinInstance(tcPBPtr pb, tPBIPtr pbi)
  : theBin(pb), theJacobian(1.0), theXi(-1.0), theEps(-1.0), theLi(-1.0),
    theX(-1.0), theL(-1.0), theScale(ZERO), theRemnantWeight(0.0) {
  if ( pbi ) theIncoming = pbi;
  else if ( bin()->incoming() )
    theIncoming = new_ptr(PartonBinInstance(bin()->incoming()));
}

PartonBinInstance::PartonBinInstance(tPPtr part, tcPBPtr pb, Energy2 scale)
  : theBin(pb), theJacobian(1.0), theParton(part), theXi(1.0), theEps(0.0),
    theLi(0.0), theX(1.0), theL(0.0), theScale(scale),
    theRemnantWeight(1.0) {
  if ( !pb->incoming() || part->parents().empty() ) return;
  particle(parton()->parents()[0]);
  Energy2 P2 = max(-particle()->momentum().m2(), ZERO);
  theXi = parton()->momentum().dirPlus()/particle()->momentum().dirPlus();
  theLi = -log(xi());
  theIncoming = new_ptr(PartonBinInstance(particle(), pb->incoming(), P2));
  theX = xi()*incoming()->x();
  theL = li() + incoming()->li();
  theEps =  Math::exp1m(-li());
}

PartonBinInstance::PartonBinInstance(tPPtr Part, tPPtr part, tcPBPtr pb, Energy2 scale)
  : theBin(pb), theJacobian(1.0), theParton(part), theXi(1.0), theEps(0.0),
    theLi(0.0), theX(1.0), theL(0.0), theScale(scale),
    theRemnantWeight(1.0) {
  if ( !pb->incoming() ) return;
  particle(Part);
  Energy2 P2 = max(-particle()->momentum().m2(), ZERO);
  theXi = parton()->momentum().dirPlus()/particle()->momentum().dirPlus();
  theLi = -log(xi());
  theIncoming = new_ptr(PartonBinInstance(particle(), pb->incoming(), P2));
  theX = xi()*incoming()->x();
  theL = li() + incoming()->li();
  theEps =  Math::exp1m(-li());
}

PartonBinInstance::~PartonBinInstance() {}

tPBIPtr PartonBinInstance::getFirst() {
  return incoming()? incoming()->getFirst(): tPBIPtr(this);
}


// TAKE AWAY ?
void PartonBinInstance::reset(double lx, Energy2 Q2) {
  l(lx);
  li(lx);
  scale(Q2);
  particle(tPPtr());
  parton(tPPtr());
  theRemnants.clear();
  thePartons.clear();
  remnantWeight(1.0);
}

void PartonBinInstance::prepare() {
  li(-1.0);
  l(0.0);
  if ( !incoming() ) return;
  //  li(-1.0);
  //  l(-1.0);
  reset(-1.0, ZERO);
  incoming()->prepare();
}

bool PartonBinInstance::hasPoleIn1() const {
  return ( !incoming() || incoming()->hasPoleIn1()) &&
    (!pdf() || pdf()->hasPoleIn1(particleData(), partonData()) );
}

// TAKE AWAY ?
void PartonBinInstance::generate(const double * r) {
  scale(ZERO);
  if ( !incoming() ) return;
  if ( li() >= 0 ) return;
  li(0.0);
  jacobian(1.0);
  remnantWeight(1.0);
  if ( bin()->pdfDim() )
    li(pdf()->flattenL(particleData(), partonData(), bin()->cuts(),
		       *r++, theJacobian));
  if ( bin()->pdfDim() > 1 )
    scale(pdf()->flattenScale(particleData(), partonData(), bin()->cuts(),
			      li(), *r++, theJacobian)
	  *bin()->cuts().scaleMaxL(li()));
  incoming()->generate(r);
  l(li() + incoming()->l());
}

void PartonBinInstance::persistentOutput(PersistentOStream & os) const {
  os << theBin << theBins << theIncoming << theJacobian << theParticle
     << theParton << thePartons << theXi << theEps << theLi << theX << theL
     << ounit(theScale, GeV2) << ounit(theKT, GeV) << theRemnantWeight
     << theRemnants;
}

void PartonBinInstance::persistentInput(PersistentIStream & is, int) {
  is >> theBin >> theBins >> theIncoming >> theJacobian >> theParticle
     >> theParton >> thePartons >> theXi >> theEps >> theLi >> theX >> theL
     >> iunit(theScale, GeV2) >> iunit(theKT, GeV) >> theRemnantWeight
     >> theRemnants;
  theRemInfo = RemIPtr();
}

ClassDescription<PartonBinInstance> PartonBinInstance::initPartonBinInstance;
// Definition of the static class description member.

void PartonBinInstance::Init() {

}