thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
StandardXComb.h
1 // -*- C++ -*-
2 //
3 // StandardXComb.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2017 Leif Lonnblad
5 // Copyright (C) 2009-2017 Simon Platzer
6 //
7 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
8 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
9 //
10 #ifndef ThePEG_StandardXComb_H
11 #define ThePEG_StandardXComb_H
12 // This is the declaration of the StandardXComb class.
13 
14 #include "ThePEG/Config/ThePEG.h"
15 #include "SubProcessHandler.fh"
16 #include "ThePEG/PDF/PartonExtractor.fh"
17 #include "ThePEG/PDF/PartonBin.h"
18 #include "ThePEG/PDF/PartonBinInstance.h"
19 #include "ThePEG/Utilities/VSelector.h"
20 #include "ThePEG/Utilities/ClassDescription.h"
21 #include "ThePEG/Utilities/Maths.h"
22 #include "ThePEG/Utilities/XSecStat.h"
23 #include "ThePEG/EventRecord/Particle.h"
24 #include "ThePEG/MatrixElement/MEBase.h"
25 #include "ThePEG/Handlers/XComb.h"
26 #include "ThePEG/Handlers/StandardEventHandler.h"
27 #include "ThePEG/Handlers/SubProcessHandler.fh"
28 #include "StandardXComb.fh"
29 
30 namespace ThePEG {
31 
53 class StandardXComb: public XComb {
54 
55 public:
56 
59 
62 
64  friend class MEBase;
65 
66 public:
67 
73  StandardXComb(Energy newMaxEnergy, const cPDPair & inc,
74  tEHPtr newEventHandler,tSubHdlPtr newSubProcessHandler,
75  tPExtrPtr newExtractor, tCascHdlPtr newCKKW,
76  const PBPair & newPartonBins, tCutsPtr newCuts, tMEPtr newME,
77  const DiagramVector & newDiagrams, bool mir,
78  tStdXCombPtr newHead = tStdXCombPtr());
79 
83  StandardXComb(tStdXCombPtr newHead,
84  const PBPair & newPartonBins, tMEPtr newME,
85  const DiagramVector & newDiagrams);
86 
90  StandardXComb();
91 
95  virtual ~StandardXComb();
96 
100  StandardXComb(tMEPtr me, const tPVector & parts, DiagramIndex i);
101 
103 
106 
112 
119  void refillPartonBinInstances(const double* r);
120 
129  bool setIncomingPartons(tStdXCombPtr labHead = tStdXCombPtr());
130 
134  void fill(const PPair& newParticles,
135  const PPair& newPartons,
136  const vector<Lorentz5Momentum>& newMEMomenta,
137  const DVector& newLastRandomNumbers = DVector());
138 
140 
147  tcSubHdlPtr subProcessHandler() const { return theSubProcessHandler; }
148 
152  tMEPtr matrixElement() const { return theME; }
153 
159  tStdXCombPtr head() const { return theHead; }
160 
164  void head(tStdXCombPtr headXC) { theHead = headXC; }
165 
171 
177 
182  tStdXCombPtr lastProjector() const { return theProjector; }
183 
188  void lastProjector(tStdXCombPtr pxc) { theProjector = pxc; }
189 
191 
197  virtual bool checkInit();
198 
203  virtual int nDim() const { return theNDim; }
204 
208  const pair<int,int>& partonDimensions() const { return partonDims; }
209 
213  bool willPassCuts();
214 
218  double cutWeight() const { return theCutWeight; }
219 
223  virtual void clean();
224 
229 
234 
240  virtual CrossSection dSigDR(const pair<double,double> ll, int nr, const double * r);
241 
248  CrossSection dSigDR(const double * r);
249 
253  double lastPDFWeight() const { return theLastPDFWeight; }
254 
259 
264  void checkReshufflingNeeds();
265 
270  bool needsReshuffling() const { return theNeedsReshuffling; }
271 
276  void reshuffle(vector<Lorentz5Momentum>&) const;
277 
281  virtual tSubProPtr construct();
283 
289  virtual const XSecStat & stats() const { return theStats; }
290 
295  virtual void select(double weight) { theStats.select(weight); }
296 
300  virtual void accept() { theStats.accept(); }
301 
305  void reweight(double oldWeight, double newWeight) {
306  theStats.reweight(oldWeight,newWeight);
307  }
308 
314  virtual void reject(double weight = 1.0) { theStats.reject(weight); }
315 
319  virtual void reset() { theStats.reset(); }
321 
327  const DiagramVector & diagrams() const { return theDiagrams; }
328 
333  bool mirror() const { return isMirror; }
334 
340  const vector<Lorentz5Momentum> & meMomenta() const { return theMEMomenta; }
341 
345  tcDiagPtr lastDiagram() const {
346  if ( !theExternalDiagram )
347  return diagrams()[lastDiagramIndex()];
348  return theExternalDiagram;
349  }
350 
356  const cPDVector & mePartonData() const { return theMEPartonData; }
357 
361  DiagramIndex lastDiagramIndex() const { return theLastDiagramIndex; }
362 
368  const DVector & meInfo() const { return theMEInfo; }
369 
375  void meInfo(const DVector & info) { theMEInfo = info; }
376 
382  const DVector& lastRandomNumbers() const { return theLastRandomNumbers; }
383 
388  double jacobian() const { return theLastJacobian; }
389 
395  double lastME2() const { return theLastME2; }
396 
400  double lastPreweight() const { return theLastPreweight; }
401 
408 
415  double lastMEPDFWeight() const { return theLastMEPDFWeight; }
416 
421  double lastMECouplings() const { return theLastMECouplings; }
423 
428  virtual void newSubProcess(bool group = false);
429 
435  vector<Lorentz5Momentum> & meMomenta() { return theMEMomenta; }
436 
443 
450 
455  void externalDiagram(tcDiagPtr diag) { theExternalDiagram = diag; }
456 
460  void lastDiagramIndex(DiagramIndex i) { theLastDiagramIndex = i; }
461 
465  void lastPDFWeight(double w) { theLastPDFWeight = w; }
466 
471 
476  void jacobian(double j) { theLastJacobian = j; }
477 
483  void lastME2(double v) { theLastME2 = v; }
484 
488  void lastPreweight(double w) { theLastPreweight = w; }
489 
496 
503  void lastMEPDFWeight(double v) { theLastMEPDFWeight = v; }
504 
508  void lastMECouplings(double v) { theLastMECouplings = v; }
509 
510 public:
511 
518  void persistentOutput(PersistentOStream & os) const;
519 
525  void persistentInput(PersistentIStream & is, int version);
527 
531  static void Init();
532 
533 private:
534 
539 
543  tMEPtr theME;
544 
549 
553  DiagramVector theDiagrams;
554 
559  bool isMirror;
560 
565  int theNDim;
566 
567 protected:
568 
573  pair<int,int> partonDims;
574 
575 private:
576 
581 
587  vector<Lorentz5Momentum> theMEMomenta;
588 
595 
600 
604  DiagramIndex theLastDiagramIndex;
605 
612 
619 
624 
629 
635 
641  double theLastME2;
642 
647 
654 
662 
667 
673  tStdXCombPtr theHead;
674 
680 
685  tStdXCombPtr theProjector;
686 
691 
696 
700  double theCutWeight;
701 
707 
711  double reshuffleEquation(double, const vector<pair<Energy2,Energy2> >&, Energy2) const;
712 
716  double solveReshuffleEquation(const vector<pair<Energy2,Energy2> >&, Energy2) const;
717 
718 private:
719 
724 
728  StandardXComb & operator=(const StandardXComb &) = delete;
729 
730 };
731 
738 template <>
739 struct BaseClassTrait<StandardXComb,1>: public ClassTraitsType {
741  typedef XComb NthBase;
742 };
743 
748 template <>
749 struct ClassTraits<StandardXComb>:
750  public ClassTraitsBase<StandardXComb> {
752  static string className() { return "ThePEG::StandardXComb"; }
753 };
754 
757 }
758 
759 #endif /* ThePEG_StandardXComb_H */
double theLastME2
The matrix element squared as calculated for the last phase space point.
double reshuffleEquation(double, const vector< pair< Energy2, Energy2 > > &, Energy2) const
Calculate the reshuffling equation given the coefficients.
CrossSection theLastMECrossSection
The partonic cross section as calculated for the last phase space point.
void reset()
Reset the statistics.
Definition: XSecStat.h:92
PersistentIStream is used to read persistent objects from a stream where they were previously written...
void select(double weight)
An event of the corresponding class has been attempted.
Definition: XSecStat.h:117
double theCutWeight
The cut weight encountered from fuzzy cuts.
bool mirror() const
True if the TreeDiagram&#39;s for this matrix element should in fact be mirrored before used to create an...
void reweight(double oldWeight, double newWeight)
Reweight a selected and accepted event.
CrossSection theLastCrossSection
The cross section calculated in the last call to dSigDR.
double cutWeight() const
Return the cut weight encountered from fuzzy cuts.
const Selector< tStdXCombPtr > & projectors() const
Return a selector object of xcombs to choose subprocesses different than the one currently integrated...
void lastMEPDFWeight(double v)
Set the PDF weight as calculated for the last phase space point, if the matrix element does supply PD...
const DiagramVector & diagrams() const
The diagrams used by the matrix element.
double theLastMEPDFWeight
The PDF weight as calculated for the last phase space point, if the matrix element does supply PDF we...
double lastPreweight() const
Return the last preweight factor.
double solveReshuffleEquation(const vector< pair< Energy2, Energy2 > > &, Energy2) const
Solve the reshuffling equation given the coefficients.
double lastPDFWeight() const
Return the PDF weight used in the last call to dSigDR.
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
double theLastPreweight
The last preweight factor.
void accept()
An event of the corresponding class has been accepted.
Definition: XSecStat.h:109
void head(tStdXCombPtr headXC)
Set the head XComb pointer.
pair< int, int > partonDims
The number of dimensions of the phase space used for each of the incoming partons.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
static ClassDescription< StandardXComb > initStandardXComb
Describe a concrete class with persistent data.
tStdXCombPtr head() const
Return a pointer to the head XComb this XComb depends on.
double theLastJacobian
Save the last jacobian obtained when generating the kinematics for the call to dSigHatDR.
double lastMEPDFWeight() const
Return the PDF weight as calculated for the last phase space point, if the matrix element does supply...
virtual void reset()
Reset statistics.
virtual int nDim() const
The number of dimensions of the phase space used to generate this process.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
virtual void newSubProcess(bool group=false)
Construct the corresponding SubProcess object if it hasn&#39;t been done before.
DiagramIndex lastDiagramIndex() const
Return the index of the last selected diagram.
void lastMECouplings(double v)
Set the coupling factor.
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
double lastME2() const
Return the matrix element squared as calculated for the last phase space point.
static void Init()
Standard Init function used to initialize the interface.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual ~StandardXComb()
Destructor.
void externalDiagram(tcDiagPtr diag)
Set a diagram to be used instead of the one selected by the matrix element.
void fill(const PPair &newParticles, const PPair &newPartons, const vector< Lorentz5Momentum > &newMEMomenta, const DVector &newLastRandomNumbers=DVector())
Fill phase space information as far as possible.
void reshuffle(vector< Lorentz5Momentum > &) const
Perform the reshuffling from hardProcessMass to mass values, given outgoing momenta.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
virtual void reject(double weight=1.0)
Reject the current event assuming it was previously accepted.
This is the main config header file for ThePEG.
const DVector & meInfo() const
Get information saved by the matrix element in the calculation of the cross section to be used later ...
const cPDVector & mePartonData() const
Return the parton types to be used by the matrix element object, in the order specified by the TreeDi...
void lastPreweight(double w)
Set the last preweight factor.
DVector & lastRandomNumbers()
Access the random numbers used to generate the last phase space point, if the matrix element requeste...
void reject(double weight=1.0)
Reject the event which was last accepted with accept() or selected with select(double).
Definition: XSecStat.h:142
vector< double > DVector
A vector of doubles.
Definition: Containers.h:163
tStdXCombPtr theHead
A pointer to the head XComb this XComb depends on.
MEBase::DiagramIndex DiagramIndex
A vector of indices.
Definition: StandardXComb.h:61
cPDVector theMEPartonData
The parton types to be used by the matrix element object, in the order specified by the TreeDiagram o...
bool theNeedsReshuffling
True if a reshuffling is required when constructing the hard subprocess.
bool checkedCuts
True, if cuts have already been checked.
tStdXCombPtr lastProjector() const
Return a pointer to a projector xcomb which will generate a subprocess different from the one just in...
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual void clean()
Reset all saved data about last generated phasespace point;.
tSubHdlPtr theSubProcessHandler
The corresponding sub-process handler.
tMEPtr theME
The matrix element to be used.
The XComb class stores all information about the generation of a hard sub-proces for a given pair of ...
Definition: XComb.h:43
bool kinematicsGenerated() const
Return true, if kinematics have already been generated.
vector< Lorentz5Momentum > & meMomenta()
Return the momenta of the partons to be used by the matrix element object, in the order specified by ...
void didGenerateKinematics()
Indicate that kinematics have been generated.
bool needsReshuffling() const
Return true if a reshuffling is required when constructing the hard subprocess.
MEBase::DiagramVector DiagramVector
A vector of DiagramBase objects.
Definition: StandardXComb.h:58
virtual void accept()
Accept the current event assuming it was previously selcted.
void reweight(double oldWeight, double newWeight)
Reweight a selected and accepted event.
Definition: XSecStat.h:129
int theNDim
The number of dimensions of the phase space used to generate this process.
The StandardXComb class inherits from the more general XComb class which stores all information about...
Definition: StandardXComb.h:53
DVector theMEInfo
Information saved by the matrix element in the calculation of the cross section to be used later when...
double lastMECouplings() const
Return the coupling factor as calculated for the lats phase space point.
virtual tSubProPtr construct()
Construct a sub-process object from the information available.
cPDVector & mePartonData()
Return the parton types to be used by the matrix element object, in the order specified by the TreeDi...
DiagramVector theDiagrams
The diagrams used by the matrix element.
virtual bool checkInit()
Try to determine if this subprocess is at all possible.
tcSubHdlPtr subProcessHandler() const
Return a pointer to the corresponding sub-process handler.
bool isMirror
True if the TreeDiagram&#39;s for this matrix element should in fact be mirrored before used to create an...
pair< PPtr, PPtr > PPair
A pair of pointers to Particle objects.
Definition: Containers.h:127
tStdXCombPtr theProjector
A pointer to a projector xcomb which will generate a subprocess different from the one just integrate...
virtual const XSecStat & stats() const
The statistics object for this XComb.
bool willPassCuts()
Return true, if the current configuration will pass the cuts.
virtual CrossSection dSigDR(const pair< double, double > ll, int nr, const double *r)
Generate a phase space point from a vector r of nr numbers in the interval ]0,1[ and return the corre...
vector< cPDPtr > cPDVector
A vector of pointers to const ParticleData objects.
Definition: Containers.h:36
bool theKinematicsGenerated
True, if kinematics have already been generated.
tcDiagPtr lastDiagram() const
Return the last selected diagram.
bool passedCuts
The result of the last call to willPassCuts.
tMEPtr matrixElement() const
The matrix element to be used.
tcDiagPtr theExternalDiagram
A diagram to be used instead of the one selected by the matrix element.
CrossSection lastMECrossSection() const
Return the partonic cross section as calculated for the last phase space point.
void recreatePartonBinInstances(Energy2 scale)
Properly setup the PartonBinInstance objects provided a sub process has been constructed using this X...
const vector< Lorentz5Momentum > & meMomenta() const
Return the momenta of the partons to be used by the matrix element object, in the order specified by ...
void lastPDFWeight(double w)
Set the PDF weight used in the last call to dSigDR.
vector< DiagPtr > DiagramVector
A vector of pointers to DiagramBase objects.
Definition: MEBase.h:77
void lastDiagramIndex(DiagramIndex i)
Set the last selected diagram.
virtual void select(double weight)
Select the current event.
Selector< tStdXCombPtr > & projectors()
Return a selector object of xcombs to choose subprocesses different than the one currently integrated...
DVector theLastRandomNumbers
The random numbers used to generate the last phase space point, if the matrix element requested so...
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
XSecStat theStats
Statistics gathering for this XComb.
Selector< tStdXCombPtr > theProjectors
A selector object of xcombs to choose subprocesses different than the one currently integrated...
double theLastPDFWeight
The PDF weight used in the last call to dSigDR.
void meInfo(const DVector &info)
Set information saved by the matrix element in the calculation of the cross section to be used later ...
void lastMECrossSection(CrossSection v)
Set the partonic cross section as calculated for the last phase space point.
bool setIncomingPartons(tStdXCombPtr labHead=tStdXCombPtr())
Setup information on incoming partons depending on the information previously supplied through the ch...
pair< cPDPtr, cPDPtr > cPDPair
A pair of pointers to const ParticleData objects.
Definition: Containers.h:118
The MEBase class is the base class of all objects representing hard matrix elements in ThePEG...
Definition: MEBase.h:72
StandardXComb & operator=(const StandardXComb &)=delete
Private and non-existent assignment operator.
DiagramVector::size_type DiagramIndex
The size_type used in the DiagramVector.
Definition: MEBase.h:79
CrossSection lastCrossSection() const
Return the cross section calculated in the last call to dSigDR.
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
void lastProjector(tStdXCombPtr pxc)
Set a pointer to a projector xcomb which will generate a subprocess different from the one just integ...
DiagramIndex theLastDiagramIndex
The last selected tree diagram.
void refillPartonBinInstances(const double *r)
Fill the variables needed to generate remnants; momenta will be used from the partons set in this xco...
void lastCrossSection(CrossSection s)
Set the cross section calculated in the last call to dSigDR.
const pair< int, int > & partonDimensions() const
Return the parton extraction dimensions.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
XSecStat is a concrete helper class used to collect statistics about the cross section for a specific...
Definition: XSecStat.h:36
const DVector & lastRandomNumbers() const
Return the random numbers used to generate the last phase space point, if the matrix element requeste...
StandardXComb()
Default constructor.
void checkReshufflingNeeds()
Check if a reshuffling is required when constructing the hard subprocess.
vector< Lorentz5Momentum > theMEMomenta
The momenta of the partons to be used by the matrix element object, in the order specified by the Tre...
double jacobian() const
Get the last jacobian obtained when generating the kinematics for the call to dSigHatDR.
double theLastMECouplings
The coupling factor.
void jacobian(double j)
Set the last jacobian obtained when generating the kinematics for the call to dSigHatDR.
void lastME2(double v)
Set the matrix element squared as calculated for the last phase space point.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52