Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:14

0001 // -*- C++ -*-
0002 //
0003 // MatchboxRambo.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef Herwig_MatchboxRambo_H
0010 #define Herwig_MatchboxRambo_H
0011 //
0012 // This is the declaration of the MatchboxRambo class.
0013 //
0014 
0015 #include "Herwig/MatrixElement/Matchbox/Phasespace/MatchboxPhasespace.h"
0016 
0017 namespace Herwig {
0018 
0019 using namespace ThePEG;
0020 
0021 /**
0022  * \ingroup Matchbox
0023  * \author Simon Platzer
0024  *
0025  * \brief MatchboxRambo implements RAMBO phase space generation.
0026  *
0027  */
0028 class MatchboxRambo: public MatchboxPhasespace {
0029 
0030 public:
0031 
0032   /**
0033    * The default constructor.
0034    */
0035   MatchboxRambo();
0036 
0037 public:
0038 
0039   /**
0040    * Prepare a phase space generator for the given xcomb object.
0041    */
0042   virtual void setXComb(tStdXCombPtr);
0043 
0044   /**
0045    * Generate a phase space point and return its weight.
0046    */
0047   virtual double generateTwoToNKinematics(const double*,
0048                       vector<Lorentz5Momentum>& momenta);
0049 
0050   /**
0051    * Return the number of random numbers required to produce a given
0052    * multiplicity final state.
0053    */
0054   virtual int nDimPhasespace(int nFinal) const {
0055     if ( nFinal == 1 )
0056       return 1;
0057     return 4*nFinal;
0058   }
0059 
0060 protected:
0061 
0062   /**
0063    * The function object defining the equation
0064    * to be solved.
0065    */
0066   struct ReshuffleEquation {
0067 
0068     typedef double ArgType;
0069     typedef Energy ValType;
0070 
0071     static double aUnit() { return 1.; }
0072     static Energy vUnit() { return 1.*GeV; }
0073 
0074     Energy operator() (double xi) const;
0075 
0076     Energy w;
0077     cPDVector::const_iterator dataBegin;
0078     cPDVector::const_iterator dataEnd;
0079     vector<Lorentz5Momentum>::const_iterator momentaBegin;
0080     vector<Lorentz5Momentum>::const_iterator momentaEnd;
0081 
0082     ReshuffleEquation(Energy q,
0083               cPDVector::const_iterator dBegin,
0084               cPDVector::const_iterator dEnd,
0085               vector<Lorentz5Momentum>::const_iterator mBegin,
0086               vector<Lorentz5Momentum>::const_iterator mEnd)
0087       : w(q),
0088     dataBegin(dBegin), dataEnd(dEnd),
0089     momentaBegin(mBegin),
0090     momentaEnd(mEnd) {}
0091 
0092   };
0093 
0094 public:
0095 
0096   /** @name Functions used by the persistent I/O system. */
0097   //@{
0098   /**
0099    * Function used to write out object persistently.
0100    * @param os the persistent output stream written to.
0101    */
0102   void persistentOutput(PersistentOStream & os) const;
0103 
0104   /**
0105    * Function used to read in object persistently.
0106    * @param is the persistent input stream read from.
0107    * @param version the version number of the object when written.
0108    */
0109   void persistentInput(PersistentIStream & is, int version);
0110   //@}
0111 
0112   /**
0113    * The standard Init function used to initialize the interfaces.
0114    * Called exactly once for each class by the class description system
0115    * before the main function starts or
0116    * when this class is dynamically loaded.
0117    */
0118   static void Init();
0119 
0120 protected:
0121 
0122   /** @name Clone Methods. */
0123   //@{
0124   /**
0125    * Make a simple clone of this object.
0126    * @return a pointer to the new object.
0127    */
0128   virtual IBPtr clone() const;
0129 
0130   /** Make a clone of this object, possibly modifying the cloned object
0131    * to make it sane.
0132    * @return a pointer to the new object.
0133    */
0134   virtual IBPtr fullclone() const;
0135   //@}
0136 
0137 
0138 // If needed, insert declarations of virtual function defined in the
0139 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0140 
0141 
0142 private:
0143 
0144   /**
0145    * The assignment operator is private and must never be called.
0146    * In fact, it should not even be implemented.
0147    */
0148   MatchboxRambo & operator=(const MatchboxRambo &) = delete;
0149 
0150   /**
0151    * Whether or not we need to reshuffle.
0152    */
0153   bool needToReshuffle;
0154 
0155   /**
0156    * True, if a reference sample of phasespace points should be
0157    * generated.
0158    */
0159   bool theMakeReferenceSample;
0160 
0161   /**
0162    * Map processes to streams for reference samples
0163    */
0164   map<cPDVector,ofstream*> referenceSamples;
0165 
0166   /**
0167    * The stream to fill for the reference sample
0168    */
0169   ofstream* referenceSample;
0170 
0171   /**
0172    * Write the generated point to the reference sample
0173    */
0174   void dumpReference(const vector<Lorentz5Momentum>&, double) const;
0175 
0176 };
0177 
0178 }
0179 
0180 #endif /* Herwig_MatchboxRambo_H */