thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
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 
21 namespace ThePEG {
22 
44 class PartonExtractor: public HandlerBase, public LastXCombInfo<> {
45 
47  friend class XComb;
48 
49 public:
50 
52  typedef map<cPPtr,PBIPtr> PartonBinInstanceMap;
53 
54 public:
55 
62 
66  virtual ~PartonExtractor();
68 
69 public:
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 
219 protected:
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 
260  PBIPtr newRemnants(tPBIPtr oldpb, tPPtr newp, const LorentzMomentum & k);
261 
265  void addNewRemnants(tPBIPtr oldpb, tPBIPtr newpb, tStepPtr step);
266 
278  virtual void transformRemnants(LorentzMomentum & Ph, LorentzMomentum & Pr,
279  const LorentzMomentum & k,
280  const LorentzMomentum & P) const;
281 
293  virtual void
295  const LorentzMomentum & k) const;
297 
298 public:
299 
306  void persistentOutput(PersistentOStream & os) const;
307 
313  void persistentInput(PersistentIStream & is, int version);
315 
319  static void Init();
320 
321 protected:
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 
352 protected:
353 
360  virtual IBPtr clone() const;
361 
366  virtual IBPtr fullclone() const;
368 
371 
376  virtual void dofinish();
378 
379 private:
380 
384  PartonBinInstanceMap& partonBinInstances() const {
385  assert(lastXCombPtr());
386  return lastXCombPtr()->partonBinInstanceMap();
387  }
388 
392  vector<PDFPtr> theSpecialDensities;
393 
398 
403 
408 
414 
420  bool flatSHatY;
421 
422 private:
423 
428 
432  PartonExtractor & operator=(const PartonExtractor &) = delete;
433 
434 };
435 
440 template <>
443  typedef HandlerBase NthBase;
444 };
445 
448 template <>
450 struct ClassTraits<PartonExtractor>: public ClassTraitsBase<PartonExtractor> {
451  static string className() { return "ThePEG::PartonExtractor"; }
452 };
453 
456 }
457 
458 #endif /* ThePEG_PartonExtractor_H */
PersistentIStream is used to read persistent objects from a stream where they were previously written...
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.
bool flatSHatY
True if this extractor should override the -generation in the PDFs and generate a flat distribution i...
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...
The PDFCuts class is used to specify cuts on scale and momentum fractions for which a PDFBase object ...
Definition: PDFCuts.h:27
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...
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
virtual void construct(const PBIPair &pbins, tStepPtr step) const
Construct remnants and add them to the step.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
virtual void dofinish()
Finalize this object.
virtual bool generateL(const PBIPair &pbins, const double *r1, const double *r2)
Generate for all parton extractions.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
virtual pair< int, int > nDims(const PBPair &pbins)
Determine the number of random numbers needed to calculate and the product of all densitiy functions...
LastXCombInfo is a templated class giving easy access to the information in an XComb object...
Definition: LastXCombInfo.h:32
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
virtual void constructRemnants(const PBIPair &pbins, tSubProPtr sub, tStepPtr step) const
Construct remnants for partons created outside of this extractor.
int theMaxTries
The maximum number of tries allowed when trying to produce remnants.
vector< PDFPtr > theSpecialDensities
A list of special PDFBase objects to be used.
virtual bool canHandle(const cPDPair &)
Return true if this parton extractor can handle the given types of incoming particles.
tXCPtr lastXCombPtr() const
Return a pointer to the last selected XComb.
Definition: LastXCombInfo.h:50
tPBIPtr partonBinInstance(tcPPtr) const
Return the corresponding parton bin instance for a given extracted parton.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
virtual void prepare(const PBIPair &pbins)
Prepare the given parton bin instances for generating a new event.
map< cPPtr, PBIPtr > PartonBinInstanceMap
A map of PartonBinInstance objects indexed by the extracted parton.
PDFPtr theNoPDF
The NoPDF object.
virtual IBPtr clone() const
Make a simple clone of this object.
pair< tPPtr, tPPtr > tPPair
A pair of transient pointers to const Particle objects.
Definition: Containers.h:133
PartonBinInstanceMap & partonBinInstances() const
The PartonBinInstance&#39;s used mapped to the respective partons.
int maxTries() const
The maximum number of attempts allowed when trying to generate remnants.
The PartonExtractor is a base class defining the interface to objects responsible for extracting part...
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual Energy2 newScale()
May be overriden by sub-classes which have their own oppinion about what scale to use in a hard subpr...
The XComb class stores all information about the generation of a hard sub-proces for a given pair of ...
Definition: XComb.h:43
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
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...
void select(tXCombPtr newXComb)
Set the XComb object describing the current hard sub-process.
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.
virtual void colourConnect(tPPtr particle, tPPtr parton, const tPVector &remnants) const
Connect the remnants with the colour lines of the extracted parton.
virtual void transformRemnants(LorentzMomentum &Ph, LorentzMomentum &Pr, const LorentzMomentum &k, const LorentzMomentum &P) const
Transform remnant momentum.
pair< PBIPtr, PBIPtr > PBIPair
A pair of pointers to PartonBinInstance objects.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
PartonBinInstance is used to store information about the generation of a given parton extraction for ...
static ClassDescription< PartonExtractor > initPartonExtractor
Describe a concrete class with persistent data.
HandlerBase is an abstract base class derived from the Interfaced class via the HandlerBaseT class ad...
Definition: HandlerBase.h:151
virtual LorentzRotation boostRemnants(PBIPair &bins, LorentzMomentum k1, LorentzMomentum k2, bool side1, bool side2) const
Get boost for hard subsystem and boost remnants.
tcPDFPtr getPDF(tcPDPtr particle) const
Return the PDFBase object to be used for the incoming particle type.
virtual ~PartonExtractor()
Destructor.
PDFPtr theSecondPDF
PDFBase object to override second PDF.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
PDFT pdf(tcPPtr parton) const
Return the parton density used to extract the given parton.
Definition: LastXCombInfo.h:85
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 void updatePartonBinInstances(const PBIPair &pbins)
Update information on the given parton bin instances.
PartonExtractor & operator=(const PartonExtractor &)=delete
Private and non-existent assignment operator.
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
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...
tcPDFPtr noPDF() const
The NoPDF object.
PartonExtractor()
Default constructor.
pair< cPDPtr, cPDPtr > cPDPair
A pair of pointers to const ParticleData objects.
Definition: Containers.h:118
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
virtual double fullFn(const PBIPair &pbins, Energy2 scale, pair< bool, bool > noLastPDF=make_pair(false, false))
Return the product of all density functions.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
static void Init()
Standard Init function used to initialize the interface.
Cuts is a class for implementing kinematical cuts in ThePEG.
Definition: Cuts.h:53
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52