thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
PartonExtractor.h
1// -*- C++ -*-
2//
3// PartonExtractor.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 Leif Lonnblad
5//
6// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8//
9#ifndef ThePEG_PartonExtractor_H
10#define ThePEG_PartonExtractor_H
11// This is the declaration of the PartonExtractor class.
12
13#include "ThePEG/Handlers/HandlerBase.h"
14#include "ThePEG/Handlers/LastXCombInfo.h"
15#include "ThePEG/PDF/PartonBin.h"
16#include "ThePEG/PDF/PartonBinInstance.h"
17#include "ThePEG/PDF/PDFBase.h"
18#include "ThePEG/PDT/ParticleData.h"
19#include "PartonExtractor.xh"
20
21namespace ThePEG {
22
44class PartonExtractor: public HandlerBase, public LastXCombInfo<> {
45
47 friend class XComb;
48
49public:
50
52 typedef map<cPPtr,PBIPtr> PartonBinInstanceMap;
53
54public:
55
62
68
69public:
70
77 virtual bool canHandle(const cPDPair &) { return true; }
78
84 virtual PartonPairVec getPartons(Energy maxEnergy, const cPDPair &,
85 const Cuts &) const;
86
92 virtual Energy2 newScale();
93
98 virtual void colourConnect(tPPtr particle, tPPtr parton,
99 const tPVector & remnants) const;
100
108 virtual PBIPair newRemnants(tPPair oldp, tPPair newp, tStepPtr step);
109
114 virtual pair<int,int> nDims(const PBPair & pbins);
115
120 virtual void prepare(const PBIPair & pbins);
121
125 virtual void updatePartonBinInstances(const PBIPair & pbins);
126
130 virtual bool generateL(const PBIPair & pbins,
131 const double * r1, const double * r2);
132
138 virtual void generateL(PartonBinInstance & pb, const double * r);
139
144 virtual Energy2 generateSHat(Energy2 s, const PBIPair & pbins,
145 const double * r1, const double * r2,
146 bool mepartons = false);
147
154 virtual double fullFn(const PBIPair & pbins, Energy2 scale,
155 pair<bool,bool> noLastPDF = make_pair(false,false));
156
160 virtual void construct(const PBIPair & pbins, tStepPtr step) const;
161
169 virtual void constructRemnants(const PBIPair & pbins, tSubProPtr sub,
170 tStepPtr step) const;
171
184 virtual LorentzRotation
186 bool side1, bool side2) const;
188
196
200 void select(tXCombPtr newXComb);
201
203
208 int maxTries() const { return theMaxTries; }
209
217 tcPDFPtr getPDF(tcPDPtr particle) const;
218
219protected:
220
224
238 virtual bool generate(PartonBinInstance & pb, const double * r,
239 Energy2 shat, const Lorentz5Momentum & first,
240 bool haveMEPartons = false);
241
245 virtual double fullFn(const PartonBinInstance & pb,
246 bool noLastPDF = false);
247
253 virtual void construct(PartonBinInstance & pb,
254 tStepPtr step, bool boost = true) const;
255
261
265 void addNewRemnants(tPBIPtr oldpb, tPBIPtr newpb, tStepPtr step);
266
279 const LorentzMomentum & k,
280 const LorentzMomentum & P) const;
281
293 virtual void
295 const LorentzMomentum & k) const;
297
298public:
299
307
313 void persistentInput(PersistentIStream & is, int version);
315
319 static void Init();
320
321protected:
322
327 virtual void addPartons(tPBPtr incoming ,const PDFCuts & cuts,
328 tcPDFPtr pdf ,PartonVector & pbins) const;
329
333 tcPDFPtr noPDF() const { return theNoPDF; }
334
339 template <typename Iterator>
340 void findConnect(tColinePtr line, tPPtr parton, bool anti,
341 Iterator first, Iterator last) const {
342 for ( ; first != last; ++first ) {
343 if ( *first != parton && (**first).hasColour(anti) &&
344 !(**first).colourLine(anti) ) {
345 line->addColoured(*first, anti);
346 return;
347 }
348 }
349 throw RemColException(*this);
350 }
351
352protected:
353
360 virtual IBPtr clone() const;
361
366 virtual IBPtr fullclone() const;
368
371
376 virtual void dofinish();
378
379private:
380
385 assert(lastXCombPtr());
386 return lastXCombPtr()->partonBinInstanceMap();
387 }
388
392 vector<PDFPtr> theSpecialDensities;
393
398
403
408
414
421
422private:
423
428
433
434};
435
440template <>
443 typedef HandlerBase NthBase;
444};
445
448template <>
450struct ClassTraits<PartonExtractor>: public ClassTraitsBase<PartonExtractor> {
451 static string className() { return "ThePEG::PartonExtractor"; }
452};
453
456}
457
458#endif /* ThePEG_PartonExtractor_H */
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
Cuts is a class for implementing kinematical cuts in ThePEG.
Definition: Cuts.h:53
HandlerBase is an abstract base class derived from the Interfaced class via the HandlerBaseT class ad...
Definition: HandlerBase.h:151
LastXCombInfo is a templated class giving easy access to the information in an XComb object.
Definition: LastXCombInfo.h:32
tXCPtr lastXCombPtr() const
Return a pointer to the last selected XComb.
Definition: LastXCombInfo.h:50
PDFT pdf(tcPPtr parton) const
Return the parton density used to extract the given parton.
Definition: LastXCombInfo.h:85
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
The PDFCuts class is used to specify cuts on scale and momentum fractions for which a PDFBase object ...
Definition: PDFCuts.h:27
PartonBinInstance is used to store information about the generation of a given parton extraction for ...
The PartonExtractor is a base class defining the interface to objects responsible for extracting part...
PartonExtractor()
Default constructor.
PDFPtr theNoPDF
The NoPDF object.
PBIPtr newRemnants(tPBIPtr oldpb, tPPtr newp, const LorentzMomentum &k)
Used by the public newRemnants() for each of the parton bins.
virtual bool generate(PartonBinInstance &pb, const double *r, Energy2 shat, const Lorentz5Momentum &first, bool haveMEPartons=false)
Used by generateSHat() for each of the final parton bins.
virtual bool generateL(const PBIPair &pbins, const double *r1, const double *r2)
Generate for all parton extractions.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual void constructRemnants(const PBIPair &pbins, tSubProPtr sub, tStepPtr step) const
Construct remnants for partons created outside of this extractor.
virtual double fullFn(const PartonBinInstance &pb, bool noLastPDF=false)
Used by the public fullFn() for each of the final parton bins.
virtual double fullFn(const PBIPair &pbins, Energy2 scale, pair< bool, bool > noLastPDF=make_pair(false, false))
Return the product of all density functions.
virtual void construct(PartonBinInstance &pb, tStepPtr step, bool boost=true) const
Used by the public construct() for each of the final parton bins.
virtual void updatePartonBinInstances(const PBIPair &pbins)
Update information on the given parton bin instances.
virtual void transformRemnants(LorentzMomentum &Ph, LorentzMomentum &Pr, const LorentzMomentum &k, const LorentzMomentum &P) const
Transform remnant momentum.
tcPDFPtr noPDF() const
The NoPDF object.
void findConnect(tColinePtr line, tPPtr parton, bool anti, Iterator first, Iterator last) const
Connect the first (anti) coloured particle in the given range (not equal to parton) and connect it to...
virtual Energy2 generateSHat(Energy2 s, const PBIPair &pbins, const double *r1, const double *r2, bool mepartons=false)
Generate the rest of the degrees of freedom to calculate and the product of all densitiy functions.
virtual void construct(const PBIPair &pbins, tStepPtr step) const
Construct remnants and add them to the step.
PartonExtractor & operator=(const PartonExtractor &)=delete
Private and non-existent assignment operator.
static ClassDescription< PartonExtractor > initPartonExtractor
Describe a concrete class with persistent data.
void select(tXCombPtr newXComb)
Set the XComb object describing the current hard sub-process.
vector< PDFPtr > theSpecialDensities
A list of special PDFBase objects to be used.
virtual PBIPair newRemnants(tPPair oldp, tPPair newp, tStepPtr step)
If remnants has already been created for the given parton, remove them from the given step and genera...
map< cPPtr, PBIPtr > PartonBinInstanceMap
A map of PartonBinInstance objects indexed by the extracted parton.
int maxTries() const
The maximum number of attempts allowed when trying to generate remnants.
PartonBinInstanceMap & partonBinInstances() const
The PartonBinInstance's used mapped to the respective partons.
virtual PartonPairVec getPartons(Energy maxEnergy, const cPDPair &, const Cuts &) const
Return a vector of possible pairs of parton bins which can be produced within a given maximum total p...
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
PDFPtr theSecondPDF
PDFBase object to override second PDF.
virtual void colourConnect(tPPtr particle, tPPtr parton, const tPVector &remnants) const
Connect the remnants with the colour lines of the extracted parton.
virtual void prepare(const PBIPair &pbins)
Prepare the given parton bin instances for generating a new event.
tcPDFPtr getPDF(tcPDPtr particle) const
Return the PDFBase object to be used for the incoming particle type.
virtual IBPtr clone() const
Make a simple clone of this object.
void addNewRemnants(tPBIPtr oldpb, tPBIPtr newpb, tStepPtr step)
Used by the public newRemnants() for each of the parton bins.
PDFPtr theFirstPDF
PDFBase object to override first PDF.
static void Init()
Standard Init function used to initialize the interface.
int theMaxTries
The maximum number of tries allowed when trying to produce remnants.
virtual pair< int, int > nDims(const PBPair &pbins)
Determine the number of random numbers needed to calculate and the product of all densitiy functions...
virtual void dofinish()
Finalize this object.
virtual void constructRemnants(PartonBinInstance &pb, LorentzMomentum &Ph, const LorentzMomentum &k) const
Construct remnants recursively for the parton represented by pb.
tPBIPtr partonBinInstance(tcPPtr) const
Return the corresponding parton bin instance for a given extracted parton.
virtual bool canHandle(const cPDPair &)
Return true if this parton extractor can handle the given types of incoming particles.
virtual LorentzRotation boostRemnants(PBIPair &bins, LorentzMomentum k1, LorentzMomentum k2, bool side1, bool side2) const
Get boost for hard subsystem and boost remnants.
bool flatSHatY
True if this extractor should override the -generation in the PDFs and generate a flat distribution i...
virtual void addPartons(tPBPtr incoming, const PDFCuts &cuts, tcPDFPtr pdf, PartonVector &pbins) const
Add parton bins to pbins for the given incoming particle and the specified cuts.
virtual Energy2 newScale()
May be overriden by sub-classes which have their own oppinion about what scale to use in a hard subpr...
virtual void generateL(PartonBinInstance &pb, const double *r)
Used by generateL() for each of the final parton bins.
virtual ~PartonExtractor()
Destructor.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
The XComb class stores all information about the generation of a hard sub-proces for a given pair of ...
Definition: XComb.h:43
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
pair< cPDPtr, cPDPtr > cPDPair
A pair of pointers to const ParticleData objects.
Definition: Containers.h:118
pair< PBIPtr, PBIPtr > PBIPair
A pair of pointers to PartonBinInstance objects.
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
pair< tPPtr, tPPtr > tPPair
A pair of transient pointers to const Particle objects.
Definition: Containers.h:133
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30