Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:19

0001 // -*- C++ -*-
0002 //
0003 // LWHFactory.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 //
0006 // ThePEG 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 THEPEG_LWHFactory_H
0010 #define THEPEG_LWHFactory_H
0011 //
0012 // This is the declaration of the LWHFactory class.
0013 //
0014 
0015 #include "ThePEG/Analysis/FactoryBase.h"
0016 
0017 namespace ThePEG {
0018 
0019 /**
0020  * Here is the documentation of the LWHFactory class. It inherits from
0021  * the abstract FactoryBase class and implements the Light-Weight
0022  * Histogram package, LWH. This implements the most rudimentary
0023  * histogramming facilities according to the <a
0024  * href="http://aida.freehep.org">AIDA</a> interface
0025  * specifications. Currently the only thing that is supported is
0026  * simple, equally binned, one dimensional histograms. It is mainly
0027  * intended to be used in applications where one needs to fill simple
0028  * histograms and output them. With LWH it is then possible to do this
0029  * without the overhead of a full AIDA implementation, but still
0030  * having the option to use a full implementation later on with
0031  * minimal changes.
0032  *
0033  * @see \ref LWHFactoryInterfaces "The interfaces"
0034  * defined for LWHFactory.
0035  */
0036 class LWHFactory: public FactoryBase {
0037 
0038 public:
0039 
0040   /** @name Manipulate histograms */
0041   //@{
0042   /**
0043    * Rescale the given \a histogram so that the integral over the bins
0044    * will give the correct integrated cross section for the observable
0045    * in the given \a unit.
0046    */
0047   virtual void
0048   normalizeToXSec(tH1DPtr histogram, CrossSection unit = picobarn) const;
0049 
0050   /**
0051    * Rescale the given \a histogram so that the integral over the bins
0052    * gives the fraction of the total cross section generated which is
0053    * contained in the bins.
0054    */
0055   virtual void normalizeToXSecFraction(tH1DPtr histogram) const;
0056 
0057   /**
0058    * Rescale the given \a histogram so that the integral over the bins
0059    * gives one.
0060    */
0061   virtual void normalizeToUnity(tH1DPtr histogram) const;
0062 
0063   /**
0064    * Rescale the given \a histogram so that the integral over the bins
0065    * will give the correct integrated cross section for the observable
0066    * in the given \a unit.
0067    */
0068   virtual void
0069   normalizeToXSec(tH2DPtr histogram, CrossSection unit = picobarn) const;
0070 
0071   /**
0072    * Rescale the given \a histogram so that the integral over the bins
0073    * gives the fraction of the total cross section generated which is
0074    * contained in the bins.
0075    */
0076   virtual void normalizeToXSecFraction(tH2DPtr histogram) const;
0077 
0078   /**
0079    * Rescale the given \a histogram so that the integral over the bins
0080    * gives one.
0081    */
0082   virtual void normalizeToUnity(tH2DPtr histogram) const;
0083   //@}
0084 
0085 public:
0086 
0087   /** @name Functions used by the persistent I/O system. */
0088   //@{
0089   /**
0090    * Function used to write out object persistently.
0091    * @param os the persistent output stream written to.
0092    */
0093   void persistentOutput(PersistentOStream & os) const;
0094 
0095   /**
0096    * Function used to read in object persistently.
0097    * @param is the persistent input stream read from.
0098    * @param version the version number of the object when written.
0099    */
0100   void persistentInput(PersistentIStream & is, int version);
0101   //@}
0102 
0103   /**
0104    * The standard Init function used to initialize the interfaces.
0105    * Called exactly once for each class by the class description system
0106    * before the main function starts or
0107    * when this class is dynamically loaded.
0108    */
0109   static void Init();
0110 
0111 protected:
0112 
0113   /** @name Clone Methods. */
0114   //@{
0115   /**
0116    * Make a simple clone of this object.
0117    * @return a pointer to the new object.
0118    */
0119   virtual IBPtr clone() const { return new_ptr(*this); }
0120 
0121   /** Make a clone of this object, possibly modifying the cloned object
0122    * to make it sane.
0123    * @return a pointer to the new object.
0124    */
0125   virtual IBPtr fullclone() const { return new_ptr(*this); }
0126   //@}
0127 
0128 
0129 
0130 protected:
0131 
0132   /** @name Standard Interfaced functions. */
0133   //@{
0134   /**
0135    * Initialize this object. Called in the run phase just before
0136    * a run begins.
0137    */
0138   virtual void doinitrun();
0139   //@}
0140 
0141 
0142 private:
0143 
0144   /**
0145    * The static object used to initialize the description of this class.
0146    * Indicates that this is a concrete class with persistent data.
0147    */
0148   static ClassDescription<LWHFactory> initLWHFactory;
0149 
0150   /**
0151    * The assignment operator is private and must never be called.
0152    * In fact, it should not even be implemented.
0153    */
0154   LWHFactory & operator=(const LWHFactory &) = delete;
0155 
0156 };
0157 
0158 }
0159 
0160 #include "ThePEG/Utilities/ClassTraits.h"
0161 
0162 namespace ThePEG {
0163 
0164 /** @cond TRAITSPECIALIZATIONS */
0165 
0166 /** This template specialization informs ThePEG about the
0167  *  base classes of LWHFactory. */
0168 template <>
0169 struct BaseClassTrait<LWHFactory,1> {
0170   /** Typedef of the first base class of LWHFactory. */
0171   typedef FactoryBase NthBase;
0172 };
0173 
0174 /** This template specialization informs ThePEG about the name of
0175  *  the LWHFactory class and the shared object where it is defined. */
0176 template <>
0177 struct ClassTraits<LWHFactory>
0178   : public ClassTraitsBase<LWHFactory> {
0179   /** Return a platform-independent class name */
0180   static string className() { return "ThePEG::LWHFactory"; }
0181 
0182   /** Return the name of the shared library be loaded to get access to
0183    *  the LWHFactory class and every other class it uses
0184    *  (except the base class). */
0185   static string library() { return "LWHFactory.so"; }
0186 };
0187 
0188 /** @endcond */
0189 
0190 }
0191 
0192 #endif /* THEPEG_LWHFactory_H */