ThePEG  1.8.0
PartonExtractor.h
1 // -*- C++ -*-
2 //
3 // PartonExtractor.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 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 bool generateL(const PBIPair & pbins,
126  const double * r1, const double * r2);
127 
133  virtual void generateL(PartonBinInstance & pb, const double * r);
134 
139  virtual Energy2 generateSHat(Energy2 s, const PBIPair & pbins,
140  const double * r1, const double * r2,
141  bool mepartons = false);
142 
149  virtual double fullFn(const PBIPair & pbins, Energy2 scale,
150  pair<bool,bool> noLastPDF = make_pair(false,false));
151 
155  virtual void construct(const PBIPair & pbins, tStepPtr step) const;
156 
164  virtual void constructRemnants(const PBIPair & pbins, tSubProPtr sub,
165  tStepPtr step) const;
166 
179  virtual LorentzRotation
181  bool side1, bool side2) const;
183 
191 
195  void select(tXCombPtr newXComb);
196 
198 
203  int maxTries() const { return theMaxTries; }
204 
212  tcPDFPtr getPDF(tcPDPtr particle) const;
213 
214 protected:
215 
219 
233  virtual bool generate(PartonBinInstance & pb, const double * r,
234  Energy2 shat, const Lorentz5Momentum & first,
235  bool haveMEPartons = false);
236 
240  virtual double fullFn(const PartonBinInstance & pb,
241  bool noLastPDF = false);
242 
248  virtual void construct(PartonBinInstance & pb,
249  tStepPtr step, bool boost = true) const;
250 
255  PBIPtr newRemnants(tPBIPtr oldpb, tPPtr newp, const LorentzMomentum & k);
256 
260  void addNewRemnants(tPBIPtr oldpb, tPBIPtr newpb, tStepPtr step);
261 
273  virtual void transformRemnants(LorentzMomentum & Ph, LorentzMomentum & Pr,
274  const LorentzMomentum & k,
275  const LorentzMomentum & P) const;
276 
288  virtual void
290  const LorentzMomentum & k) const;
292 
293 public:
294 
301  void persistentOutput(PersistentOStream & os) const;
302 
308  void persistentInput(PersistentIStream & is, int version);
310 
314  static void Init();
315 
316 protected:
317 
322  virtual void addPartons(tPBPtr incoming ,const PDFCuts & cuts,
323  tcPDFPtr pdf ,PartonVector & pbins) const;
324 
328  tcPDFPtr noPDF() const { return theNoPDF; }
329 
334  template <typename Iterator>
335  void findConnect(tColinePtr line, tPPtr parton, bool anti,
336  Iterator first, Iterator last) const {
337  for ( ; first != last; ++first ) {
338  if ( *first != parton && (**first).hasColour(anti) &&
339  !(**first).colourLine(anti) ) {
340  line->addColoured(*first, anti);
341  return;
342  }
343  }
344  throw RemColException(*this);
345  }
346 
347 protected:
348 
355  virtual IBPtr clone() const;
356 
361  virtual IBPtr fullclone() const;
363 
366 
371  virtual void dofinish();
373 
374 private:
375 
379  mutable PartonBinInstanceMap partonBinInstances;
380 
384  vector<PDFPtr> theSpecialDensities;
385 
390 
395 
400 
406 
412  bool flatSHatY;
413 
414 private:
415 
420 
425 
426 };
427 
432 template <>
435  typedef HandlerBase NthBase;
436 };
437 
440 template <>
442 struct ClassTraits<PartonExtractor>: public ClassTraitsBase<PartonExtractor> {
443  static string className() { return "ThePEG::PartonExtractor"; }
444 };
445 
448 }
449 
450 #endif /* ThePEG_PartonExtractor_H */
PersistentIStream is used to read persistent objects from a stream where they were previously written...
virtual IBPtr clone() const
Make a simple clone of this object.
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...
The PDFCuts class is used to specify cuts on scale and momentum fractions for which a PDFBase object ...
Definition: PDFCuts.h:27
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
virtual void dofinish()
Finalize this object.
virtual void construct(const PBIPair &pbins, tStepPtr step) const
Construct remnants and add them to the step.
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
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
tcPDFPtr noPDF() const
The NoPDF object.
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:681
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:509
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.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
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 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 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.
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...
pair< tPPtr, tPPtr > tPPair
A pair of transient pointers to const Particle objects.
Definition: Containers.h:133
The PartonExtractor is a base class defining the interface to objects responsible for extracting part...
virtual Energy2 newScale()
May be overriden by sub-classes which have their own oppinion about what scale to use in a hard subpr...
int maxTries() const
The maximum number of attempts allowed when trying to generate remnants.
The XComb class stores all information about the generation of a hard sub-proces for a given pair of ...
Definition: XComb.h:43
QTY< 0, 1, 0 >::Type Energy
Energy.
Definition: Unitsystem.h:34
virtual void colourConnect(tPPtr particle, tPPtr parton, const tPVector &remnants) const
Connect the remnants with the colour lines of the extracted parton.
virtual LorentzRotation boostRemnants(PBIPair &bins, LorentzMomentum k1, LorentzMomentum k2, bool side1, bool side2) const
Get boost for hard subsystem and boost remnants.
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.
PDFT pdf(tcPPtr parton) const
Return the parton density used to extract the given parton.
Definition: LastXCombInfo.h:85
virtual void constructRemnants(const PBIPair &pbins, tSubProPtr sub, tStepPtr step) const
Construct remnants for partons created outside of this extractor.
PDFPtr theFirstPDF
PDFBase object to override first PDF.
pair< PBIPtr, PBIPtr > PBIPair
A pair of pointers to PartonBinInstance objects.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
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
tPBIPtr partonBinInstance(tcPPtr) const
Return the corresponding parton bin instance for a given extracted parton.
virtual void transformRemnants(LorentzMomentum &Ph, LorentzMomentum &Pr, const LorentzMomentum &k, const LorentzMomentum &P) const
Transform remnant momentum.
virtual ~PartonExtractor()
Destructor.
PDFPtr theSecondPDF
PDFBase object to override second PDF.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
PartonExtractor & operator=(const PartonExtractor &)
Private and non-existent assignment operator.
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...
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
PartonExtractor()
Default constructor.
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
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
tcPDFPtr getPDF(tcPDPtr particle) const
Return the PDFBase object to be used for the incoming particle type.
PartonBinInstanceMap partonBinInstances
The PartonBinInstance's used mapped to the respective partons.
static void Init()
Standard Init function used to initialize the interface.
Cuts is a class for implementing kinematical cuts in ThePEG.
Definition: Cuts.h:52