Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // CellGridSampler.hpp 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_CellGridSampler_H
0010 #define Herwig_CellGridSampler_H
0011 //
0012 // This is the declaration of the CellGridSampler class.
0013 //
0014 
0015 #include "Herwig/Sampling/BinSampler.h"
0016 
0017 #include "SimpleCellGrid.h"
0018 
0019 
0020 namespace Herwig {
0021 
0022 using namespace ThePEG;
0023 
0024 /**
0025  * \ingroup Matchbox
0026  * \author Simon Platzer
0027  *
0028  * \brief CellGridSampler samples XCombs bins using CellGrids
0029  *
0030  * @see \ref CellGridSamplerInterfaces "The interfaces"
0031  * defined for CellGridSampler.
0032  */
0033 class CellGridSampler: 
0034     public Herwig::BinSampler, ExSample::SimpleCellGrid {
0035 
0036 public:
0037 
0038   /** @name Standard constructors and destructors. */
0039   //@{
0040   /**
0041    * The default constructor.
0042    */
0043   CellGridSampler();
0044 
0045   /**
0046    * The destructor.
0047    */
0048   virtual ~CellGridSampler();
0049   //@}
0050 
0051 public:
0052 
0053   /**
0054    * Clone this object.
0055    */
0056   Ptr<CellGridSampler>::ptr cloneMe() const {
0057     return dynamic_ptr_cast<Ptr<CellGridSampler>::ptr>(clone());
0058   }
0059 
0060 public:
0061 
0062   /**
0063    * Generate the next point; store the point in lastPoint() and its
0064    * weight using select(); if noMaxInfo is true, do not throw
0065    * NewMaximum or UpdateCrossSections exceptions.
0066    */
0067   virtual double generate();
0068 
0069   /**
0070    * Initialize this bin sampler. This default version calls runIteration.
0071    */
0072   virtual void initialize(bool progress);
0073 
0074   /**
0075    * Finalize this sampler.
0076    */
0077   virtual void finalize(bool);
0078 
0079   /**
0080    * Adapt
0081    */
0082   virtual void adapt();
0083 
0084   /**
0085    * Return true, if grid data exists for this sampler.
0086    */
0087   virtual bool existsGrid() const;
0088 
0089   /**
0090    * Save grid data
0091    */
0092   virtual void saveGrid() const;
0093   
0094   /**
0095    * The splittings for each dimension befor adaption.
0096    */
0097     
0098   const vector<int>& pre_adaption_splits() const { return the_pre_adaption_splits; }
0099 
0100 public:
0101 
0102   /** @name Functions used by the persistent I/O system. */
0103   //@{
0104   /**
0105    * Function used to write out object persistently.
0106    * @param os the persistent output stream written to.
0107    */
0108   void persistentOutput(PersistentOStream & os) const;
0109 
0110   /**
0111    * Function used to read in object persistently.
0112    * @param is the persistent input stream read from.
0113    * @param version the version number of the object when written.
0114    */
0115   void persistentInput(PersistentIStream & is, int version);
0116   //@}
0117 
0118   /**
0119    * The standard Init function used to initialize the interfaces.
0120    * Called exactly once for each class by the class description system
0121    * before the main function starts or
0122    * when this class is dynamically loaded.
0123    */
0124   static void Init();
0125 
0126 protected:
0127 
0128   /** @name Clone Methods. */
0129   //@{
0130   /**
0131    * Make a simple clone of this object.
0132    * @return a pointer to the new object.
0133    */
0134   virtual IBPtr clone() const;
0135 
0136   /** Make a clone of this object, possibly modifying the cloned object
0137    * to make it sane.
0138    * @return a pointer to the new object.
0139    */
0140   virtual IBPtr fullclone() const;
0141   //@}
0142 
0143 
0144 // If needed, insert declarations of virtual function defined in the
0145 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0146 
0147 private:
0148 
0149   /**
0150    * The assignment operator is private and must never be called.
0151    * In fact, it should not even be implemented.
0152    */
0153   CellGridSampler & operator=(const CellGridSampler &) = delete;
0154 
0155   /**
0156    * The number of points used to explore a cell
0157    */
0158   size_t theExplorationPoints;
0159 
0160   /**
0161    * The number of exploration steps
0162    */
0163   size_t theExplorationSteps;
0164 
0165   /**
0166    * The adaption threshold.
0167    */
0168   double theGain;
0169 
0170   /**
0171    * The adaption threshold.
0172    */
0173   double theEpsilon;
0174 
0175   /**
0176    * The minimum probability for cell selection.
0177    */
0178   double theMinimumSelection;
0179 
0180   /**
0181    * The splittings for each dimension befor adaption.
0182    */
0183   vector<int>  the_pre_adaption_splits;
0184 
0185   /**
0186    * The number of splits to put into parton luminiosity degrees of
0187    * freedom.
0188    */
0189   int theLuminositySplits;
0190 
0191   /**
0192    * The number of splits to put into channel degrees of freedom.
0193    */
0194   int theChannelSplits;
0195 
0196   /**
0197    * Perform splits for all channels
0198    */
0199   bool theAllChannelSplits;
0200 
0201   /**
0202    * Perform unweighting in cells
0203    */
0204   bool theUnweightCells;
0205 
0206 };
0207 
0208 }
0209 
0210 #endif /* Herwig_CellGridSampler_H */