Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:23:57

0001 // -*- C++ -*-
0002 //
0003 // BasicConsistency.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 THEPEG_BasicConsistency_H
0010 #define THEPEG_BasicConsistency_H
0011 //
0012 // This is the declaration of the BasicConsistency class.
0013 //
0014 
0015 #include "ThePEG/Handlers/AnalysisHandler.h"
0016 
0017 namespace Herwig {
0018 using namespace ThePEG;
0019 
0020 /** \ingroup Analysis
0021  * The BasicConsistency class is a simple analysis which performs a basic
0022  * analysis of the event checking that energy, momentum and charge are
0023  * conserved and no quarks or clusters are final-state particles.
0024  *
0025  * @see \ref BasicConsistencyInterfaces "The interfaces"
0026  * defined for BasicConsistency.
0027  */
0028 class BasicConsistency: public AnalysisHandler {
0029 
0030 public:
0031 
0032   /**
0033    * The default constructor.
0034    */
0035   BasicConsistency();
0036 
0037   /** @name Virtual functions required by the AnalysisHandler class. */
0038   //@{
0039   /**
0040    * Analyze a given Event. Note that a fully generated event
0041    * may be presented several times, if it has been manipulated in
0042    * between. The default version of this function will call transform
0043    * to make a lorentz transformation of the whole event, then extract
0044    * all final state particles and call analyze(tPVector) of this
0045    * analysis object and those of all associated analysis objects. The
0046    * default version will not, however, do anything on events which
0047    * have not been fully generated, or have been manipulated in any
0048    * way.
0049    * @param event pointer to the Event to be analyzed.
0050    * @param ieve the event number.
0051    * @param loop the number of times this event has been presented.
0052    * If negative the event is now fully generated.
0053    * @param state a number different from zero if the event has been
0054    * manipulated in some way since it was last presented.
0055    */
0056   virtual void analyze(tEventPtr event, long ieve, int loop, int state);
0057   //@}
0058 
0059 public:
0060 
0061   /** @name Functions used by the persistent I/O system. */
0062   //@{
0063   /**
0064    * Function used to write out object persistently.
0065    * @param os the persistent output stream written to.
0066    */
0067   void persistentOutput(PersistentOStream & os) const;
0068 
0069   /**
0070    * Function used to read in object persistently.
0071    * @param is the persistent input stream read from.
0072    * @param version the version number of the object when written.
0073    */
0074   void persistentInput(PersistentIStream & is, int version);
0075   //@}
0076 
0077   /**
0078    * The standard Init function used to initialize the interfaces.
0079    * Called exactly once for each class by the class description system
0080    * before the main function starts or
0081    * when this class is dynamically loaded.
0082    */
0083   static void Init();
0084 
0085 protected:
0086 
0087   /** @name Clone Methods. */
0088   //@{
0089   /**
0090    * Make a simple clone of this object.
0091    * @return a pointer to the new object.
0092    */
0093   virtual IBPtr clone() const;
0094 
0095   /** Make a clone of this object, possibly modifying the cloned object
0096    * to make it sane.
0097    * @return a pointer to the new object.
0098    */
0099   virtual IBPtr fullclone() const;
0100   //@}
0101 
0102 protected:
0103 
0104   /** @name Standard Interfaced functions. */
0105   //@{
0106   /**
0107    * Initialize this object. Called in the run phase just before
0108    * a run begins.
0109    */
0110   virtual void doinitrun();
0111 
0112   /**
0113    * Finalize this object. Called in the run phase just after a
0114    * run has ended. Used eg. to write out statistics.
0115    */
0116   virtual void dofinish();
0117   //@}
0118 
0119 private:
0120 
0121   /**
0122    * The assignment operator is private and must never be called.
0123    * In fact, it should not even be implemented.
0124    */
0125   BasicConsistency & operator=(const BasicConsistency &) = delete;
0126 
0127 private:
0128 
0129   /**
0130    *  Maximum momentum deviation
0131    */
0132   Energy _epsmom;
0133 
0134   /**
0135    *  check for quarks
0136    */
0137   bool _checkquark;
0138 
0139   /**
0140    *  check for charge conservation
0141    */
0142   bool _checkcharge;
0143 
0144   /**
0145    *  Check for clusters in  the final-state
0146    */
0147   bool _checkcluster;
0148 
0149   /**
0150    *  Check the branching ratios
0151    */
0152   bool _checkBR;
0153 
0154   /**
0155    *  Maximum absolute momentum deviation before warning
0156    */
0157   Energy _absolutemomentumtolerance;
0158 
0159   /**
0160    *  Maximum momentum deviation relative to beam energy before warning
0161    */
0162   double _relativemomentumtolerance;
0163 
0164 };
0165 
0166 }
0167 
0168 #endif /* THEPEG_BasicConsistency_H */