Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef Herwig_HardProcessAnalysis_H
0003 #define Herwig_HardProcessAnalysis_H
0004 //
0005 // This is the declaration of the HardProcessAnalysis class.
0006 //
0007 
0008 #include "ThePEG/Handlers/AnalysisHandler.h"
0009 #include "Herwig/Utilities/Histogram.h"
0010 
0011 namespace Herwig {
0012 
0013 using namespace ThePEG;
0014 
0015 /**
0016  * Here is the documentation of the HardProcessAnalysis class.
0017  *
0018  * @see \ref HardProcessAnalysisInterfaces "The interfaces"
0019  * defined for HardProcessAnalysis.
0020  */
0021 class HardProcessAnalysis: public AnalysisHandler {
0022 
0023 public:
0024 
0025   /**
0026    * The default constructor.
0027    */
0028   HardProcessAnalysis();
0029 
0030 public:
0031 
0032   /** @name Virtual functions required by the AnalysisHandler class. */
0033   //@{
0034   /**
0035    * Analyze a given Event. Note that a fully generated event
0036    * may be presented several times, if it has been manipulated in
0037    * between. The default version of this function will call transform
0038    * to make a lorentz transformation of the whole event, then extract
0039    * all final state particles and call analyze(tPVector) of this
0040    * analysis object and those of all associated analysis objects. The
0041    * default version will not, however, do anything on events which
0042    * have not been fully generated, or have been manipulated in any
0043    * way.
0044    * @param event pointer to the Event to be analyzed.
0045    * @param ieve the event number.
0046    * @param loop the number of times this event has been presented.
0047    * If negative the event is now fully generated.
0048    * @param state a number different from zero if the event has been
0049    * manipulated in some way since it was last presented.
0050    */
0051   virtual void analyze(tEventPtr event, long ieve, int loop, int state);
0052 
0053   //@}
0054 
0055 protected:
0056 
0057   /**
0058    * Initialize this object. Called in the run phase just before
0059    * a run begins.
0060    */
0061   virtual void doinitrun();
0062 
0063   /**
0064    * Finalize this object. Called in the run phase just after a
0065    * run has ended. Used eg. to write out statistics.
0066    */
0067   virtual void dofinish();
0068 
0069 
0070 public:
0071 
0072   /** @name Functions used by the persistent I/O system. */
0073   //@{
0074   /**
0075    * Function used to write out object persistently.
0076    * @param os the persistent output stream written to.
0077    */
0078   void persistentOutput(PersistentOStream & os) const;
0079 
0080   /**
0081    * Function used to read in object persistently.
0082    * @param is the persistent input stream read from.
0083    * @param version the version number of the object when written.
0084    */
0085   void persistentInput(PersistentIStream & is, int version);
0086   //@}
0087 
0088   /**
0089    * The standard Init function used to initialize the interfaces.
0090    * Called exactly once for each class by the class description system
0091    * before the main function starts or
0092    * when this class is dynamically loaded.
0093    */
0094   static void Init();
0095 
0096 protected:
0097 
0098   /** @name Clone Methods. */
0099   //@{
0100   /**
0101    * Make a simple clone of this object.
0102    * @return a pointer to the new object.
0103    */
0104   virtual IBPtr clone() const;
0105 
0106   /** Make a clone of this object, possibly modifying the cloned object
0107    * to make it sane.
0108    * @return a pointer to the new object.
0109    */
0110   virtual IBPtr fullclone() const;
0111   //@}
0112 
0113 
0114 // If needed, insert declarations of virtual function defined in the
0115 // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0116 
0117 
0118 private:
0119 
0120   /**
0121    * The assignment operator is private and must never be called.
0122    * In fact, it should not even be implemented.
0123    */
0124   HardProcessAnalysis & operator=(const HardProcessAnalysis &) = delete;
0125 
0126   /**
0127    * Differential information per outgoing parton
0128    */
0129   struct Histograms {
0130 
0131     /**
0132      * The constructor
0133      */
0134     Histograms() {}
0135 
0136     /**
0137      * The constructor
0138      */
0139     explicit Histograms(Energy ECM, unsigned int theNBins);
0140 
0141     /**
0142      * Analyse given momentum
0143      */
0144     void fill(const Lorentz5Momentum& p, double weight);
0145 
0146     /**
0147      * Finalize given process id and cross section.
0148      */
0149     void finalize(ostream& dat,
0150           ostream& plot,
0151           const string& subpro,
0152           size_t legid,
0153           double norm,
0154           bool theUnitWeights);
0155 
0156     /**
0157      * Pt spectrum
0158      */
0159     HistogramPtr transverse;
0160 
0161     /**
0162      * Rapidity distribution
0163      */
0164     HistogramPtr rapidity;
0165 
0166     /**
0167      * Azimuthal angle distribution
0168      */
0169     HistogramPtr phi;
0170 
0171   };
0172 
0173   /**
0174    * Outgoing partons and x distributions
0175    */
0176   struct AllHistograms {
0177 
0178     /**
0179      * Outgoing partons
0180      */
0181     vector<Histograms> outgoing;
0182 
0183     /**
0184      * x1 distribution
0185      */
0186     HistogramPtr x1;
0187 
0188     /**
0189      * x2 distribution
0190      */
0191     HistogramPtr x2;
0192 
0193     /**
0194      * sqrt(shat) distribution
0195      */
0196     HistogramPtr sshat;
0197 
0198     /**
0199      * y distribution
0200      */
0201     HistogramPtr rapidity;
0202 
0203     /**
0204      * The sum of weights
0205      */
0206     double sumWeights;
0207 
0208   };
0209 
0210   /**
0211    * Histograms per subprocess
0212    */
0213   map<vector<string>,AllHistograms> histogramData;
0214 
0215   /**
0216    * The total sum of weights
0217    */
0218   double sumWeights;
0219 
0220   /**
0221    * Analyze a given final state
0222    */
0223   void fill(PPair, ParticleVector, double);
0224 
0225   /**
0226    * The number of bins to use
0227    */
0228   unsigned int theNBins;
0229 
0230   /**
0231    * True, if unit weights should be booked
0232    */
0233   bool theUnitWeights;
0234 
0235   /**
0236    * True, if subprocesses should be distinguished by initial state
0237    */
0238   bool theSplitInitialStates;
0239 
0240   /**
0241    * True, if partons should be handled as jets irrespective of flavour
0242    */
0243   bool thePartonsAreJets;
0244 
0245 };
0246 
0247 }
0248 
0249 #endif /* Herwig_HardProcessAnalysis_H */