Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef Herwig_WeightAnalyzer_H
0003 #define Herwig_WeightAnalyzer_H
0004 //
0005 // This is the declaration of the WeightAnalyzer class.
0006 //
0007 
0008 #include "ThePEG/Handlers/AnalysisHandler.h"
0009 
0010 namespace Herwig {
0011 
0012 using namespace ThePEG;
0013 
0014 /**
0015  * Here is the documentation of the WeightAnalyzer class.
0016  *
0017  * @see \ref WeightAnalyzerInterfaces "The interfaces"
0018  * defined for WeightAnalyzer.
0019  */
0020 class WeightAnalyzer: public AnalysisHandler {
0021 
0022 public:
0023 
0024   /**
0025    * The default constructor.
0026    */
0027   WeightAnalyzer();
0028 
0029 public:
0030 
0031   /** @name Virtual functions required by the AnalysisHandler class. */
0032   //@{
0033   /**
0034    * Analyze a given Event. Note that a fully generated event
0035    * may be presented several times, if it has been manipulated in
0036    * between. The default version of this function will call transform
0037    * to make a lorentz transformation of the whole event, then extract
0038    * all final state particles and call analyze(tPVector) of this
0039    * analysis object and those of all associated analysis objects. The
0040    * default version will not, however, do anything on events which
0041    * have not been fully generated, or have been manipulated in any
0042    * way.
0043    * @param event pointer to the Event to be analyzed.
0044    * @param ieve the event number.
0045    * @param loop the number of times this event has been presented.
0046    * If negative the event is now fully generated.
0047    * @param state a number different from zero if the event has been
0048    * manipulated in some way since it was last presented.
0049    */
0050   virtual void analyze(tEventPtr event, long ieve, int loop, int state);
0051   //@}
0052 
0053 protected:
0054 
0055   /**
0056    * Initialize this object. Called in the run phase just before
0057    * a run begins.
0058    */
0059   virtual void doinitrun();
0060 
0061   /**
0062    * Finalize this object. Called in the run phase just after a
0063    * run has ended. Used eg. to write out statistics.
0064    */
0065   virtual void dofinish();
0066 
0067 
0068 public:
0069 
0070   /** @name Functions used by the persistent I/O system. */
0071   //@{
0072   /**
0073    * Function used to write out object persistently.
0074    * @param os the persistent output stream written to.
0075    */
0076   void persistentOutput(PersistentOStream & os) const;
0077 
0078   /**
0079    * Function used to read in object persistently.
0080    * @param is the persistent input stream read from.
0081    * @param version the version number of the object when written.
0082    */
0083   void persistentInput(PersistentIStream & is, int version);
0084   //@}
0085 
0086   /**
0087    * The standard Init function used to initialize the interfaces.
0088    * Called exactly once for each class by the class description system
0089    * before the main function starts or
0090    * when this class is dynamically loaded.
0091    */
0092   static void Init();
0093 
0094 protected:
0095 
0096   /** @name Clone Methods. */
0097   //@{
0098   /**
0099    * Make a simple clone of this object.
0100    * @return a pointer to the new object.
0101    */
0102   virtual IBPtr clone() const;
0103 
0104   /** Make a clone of this object, possibly modifying the cloned object
0105    * to make it sane.
0106    * @return a pointer to the new object.
0107    */
0108   virtual IBPtr fullclone() const;
0109   //@}
0110 
0111 
0112 // If needed, insert declarations of virtual function defined in the
0113 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0114 
0115 private:
0116 
0117   /**
0118    * The sum of weights
0119    */
0120   double sumWeights;
0121 
0122   /**
0123    * The sum of positive weights
0124    */
0125   double sumPositiveWeights;
0126 
0127   /**
0128    * The sum of negative weights
0129    */
0130   double sumNegativeWeights;
0131 
0132   /**
0133    * The sum of weights calculated by subprocess group weights
0134    */
0135   double sumGroupWeights;
0136 
0137   /**
0138    * The sum of positive weights calculated by subprocess group weights
0139    */
0140   double sumPositiveGroupWeights;
0141 
0142   /**
0143    * The sum of negative weights calculated by subprocess group weights
0144    */
0145   double sumNegativeGroupWeights;
0146 
0147   /**
0148    * The maximum deviation of the group weight sum from one
0149    */
0150   double maxDeviationGroupWeight;
0151 
0152   /**
0153    * The maximum deviation of the event weight sum from the overall
0154    * event weight
0155    */
0156   double maxDeviationEventWeight;
0157 
0158   /**
0159    * Total number of positive weights
0160    */
0161   double nPositiveWeights;
0162 
0163   /**
0164    * Total number of negative weights
0165    */
0166   double nNegativeWeights;
0167 
0168   /**
0169    * The maximum postive weight
0170    */
0171   double maxPositiveWeight;
0172 
0173   /**
0174    * The maximum absolute negative weight
0175    */
0176   double maxNegativeWeight;
0177 
0178   /**
0179    * Histogram of positive weight occurences
0180    */
0181   map<double,double> positiveWeightDistribution;
0182 
0183   /**
0184    * Histogram of negative weight occurences
0185    */
0186   map<double,double> negativeWeightDistribution;
0187   
0188   
0189   /**
0190    * Gnuplot output
0191    */
0192   bool gnuplot;
0193   
0194   
0195 
0196 private:
0197 
0198   /**
0199    * The assignment operator is private and must never be called.
0200    * In fact, it should not even be implemented.
0201    */
0202   WeightAnalyzer & operator=(const WeightAnalyzer &) = delete;
0203 
0204 };
0205 
0206 }
0207 
0208 #endif /* Herwig_WeightAnalyzer_H */