thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
StandardXComb.h
1 // -*- C++ -*-
2 //
3 // StandardXComb.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 // Copyright (C) 2009-2019 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 
256  virtual map<string,double> generateOptionalWeights();
257 
261  double lastPDFWeight() const { return theLastPDFWeight; }
262 
267 
272  void checkReshufflingNeeds();
273 
278  bool needsReshuffling() const { return theNeedsReshuffling; }
279 
284  void reshuffle(vector<Lorentz5Momentum>&) const;
285 
289  virtual tSubProPtr construct();
291 
297  virtual const XSecStat & stats() const { return theStats; }
298 
303  virtual void select(double weight) { theStats.select(weight); }
304 
308  virtual void accept() { theStats.accept(); }
309 
313  void reweight(double oldWeight, double newWeight) {
314  theStats.reweight(oldWeight,newWeight);
315  }
316 
322  virtual void reject(double weight = 1.0) { theStats.reject(weight); }
323 
327  virtual void reset() { theStats.reset(); }
329 
335  const DiagramVector & diagrams() const { return theDiagrams; }
336 
341  bool mirror() const { return isMirror; }
342 
348  const vector<Lorentz5Momentum> & meMomenta() const { return theMEMomenta; }
349 
353  tcDiagPtr lastDiagram() const {
354  if ( !theExternalDiagram )
355  return diagrams()[lastDiagramIndex()];
356  return theExternalDiagram;
357  }
358 
364  const cPDVector & mePartonData() const { return theMEPartonData; }
365 
369  DiagramIndex lastDiagramIndex() const { return theLastDiagramIndex; }
370 
376  const DVector & meInfo() const { return theMEInfo; }
377 
383  void meInfo(const DVector & info) { theMEInfo = info; }
384 
390  const DVector& lastRandomNumbers() const { return theLastRandomNumbers; }
391 
396  double jacobian() const { return theLastJacobian; }
397 
403  double lastME2() const { return theLastME2; }
404 
408  double lastPreweight() const { return theLastPreweight; }
409 
416 
423  double lastMEPDFWeight() const { return theLastMEPDFWeight; }
424 
429  double lastMECouplings() const { return theLastMECouplings; }
431 
436  virtual void newSubProcess(bool group = false);
437 
443  vector<Lorentz5Momentum> & meMomenta() { return theMEMomenta; }
444 
451 
458 
463  void externalDiagram(tcDiagPtr diag) { theExternalDiagram = diag; }
464 
468  void lastDiagramIndex(DiagramIndex i) { theLastDiagramIndex = i; }
469 
473  void lastPDFWeight(double w) { theLastPDFWeight = w; }
474 
479 
484  void jacobian(double j) { theLastJacobian = j; }
485 
491  void lastME2(double v) { theLastME2 = v; }
492 
496  void lastPreweight(double w) { theLastPreweight = w; }
497 
504 
511  void lastMEPDFWeight(double v) { theLastMEPDFWeight = v; }
512 
516  void lastMECouplings(double v) { theLastMECouplings = v; }
517 
518 public:
519 
526  void persistentOutput(PersistentOStream & os) const;
527 
533  void persistentInput(PersistentIStream & is, int version);
535 
539  static void Init();
540 
541 private:
542 
547 
551  tMEPtr theME;
552 
557 
561  DiagramVector theDiagrams;
562 
567  bool isMirror;
568 
573  int theNDim;
574 
575 protected:
576 
581  pair<int,int> partonDims;
582 
583 private:
584 
589 
595  vector<Lorentz5Momentum> theMEMomenta;
596 
603 
608 
612  DiagramIndex theLastDiagramIndex;
613 
620 
627 
632 
637 
643 
649  double theLastME2;
650 
655 
662 
670 
675 
681  tStdXCombPtr theHead;
682 
688 
693  tStdXCombPtr theProjector;
694 
699 
704 
708  double theCutWeight;
709 
715 
719  double reshuffleEquation(double, const vector<pair<Energy2,Energy2> >&, Energy2) const;
720 
724  double solveReshuffleEquation(const vector<pair<Energy2,Energy2> >&, Energy2) const;
725 
726 private:
727 
732 
736  StandardXComb & operator=(const StandardXComb &) = delete;
737 
738 };
739 
746 template <>
747 struct BaseClassTrait<StandardXComb,1>: public ClassTraitsType {
749  typedef XComb NthBase;
750 };
751 
756 template <>
757 struct ClassTraits<StandardXComb>:
758  public ClassTraitsBase<StandardXComb> {
760  static string className() { return "ThePEG::StandardXComb"; }
761 };
762 
765 }
766 
767 #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
virtual map< string, double > generateOptionalWeights()
If variations are available for the subprocess handled, generate and return a map of optional weights...
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