Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // Graphviz.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_GraphvizPlot_H
0010 #define THEPEG_GraphvizPlot_H
0011 //
0012 // This is the declaration of the GraphvizPlot class.
0013 //
0014 
0015 #include "ThePEG/Repository/CurrentGenerator.h"
0016 #include "ThePEG/Handlers/AnalysisHandler.h"
0017 
0018 namespace ThePEG {
0019 
0020 /** \ingroup Analysis
0021  * The GraphvizPlot class generates
0022  * an output of the tree structure of the event which can be viewed using dot.
0023  *
0024  * @see \ref GraphvizPlotInterfaces "The interfaces"
0025  * defined for GraphvizPlot.
0026  */
0027 class GraphvizPlot: public AnalysisHandler {
0028 
0029 public:
0030 
0031   /** @name Standard constructors and destructors. */
0032   //@{
0033   /**
0034    * The default constructor.
0035    */
0036   GraphvizPlot() : _eventNumber(1), _quiet(false) {}
0037   //@}
0038 
0039 public:
0040 
0041   /** @name Virtual functions required by the AnalysisHandler class. */
0042   //@{
0043   /**
0044    * Analyze a given Event. Note that a fully generated event
0045    * may be presented several times, if it has been manipulated in
0046    * between. The default version of this function will call transform
0047    * to make a lorentz transformation of the whole event, then extract
0048    * all final state particles and call analyze(tPVector) of this
0049    * analysis object and those of all associated analysis objects. The
0050    * default version will not, however, do anything on events which
0051    * have not been fully generated, or have been manipulated in any
0052    * way.
0053    * @param event pointer to the Event to be analyzed.
0054    * @param ieve the event number.
0055    * @param loop the number of times this event has been presented.
0056    * If negative the event is now fully generated.
0057    * @param state a number different from zero if the event has been
0058    * manipulated in some way since it was last presented.
0059    */
0060   virtual void analyze(tEventPtr event, long ieve, int loop, int state);
0061   //@}
0062 
0063 public:
0064 
0065   /** @name Functions used by the persistent I/O system. */
0066   //@{
0067   /**
0068    * Function used to write out object persistently.
0069    * @param os the persistent output stream written to.
0070    */
0071   void persistentOutput(PersistentOStream & os) const;
0072 
0073   /**
0074    * Function used to read in object persistently.
0075    * @param is the persistent input stream read from.
0076    * @param version the version number of the object when written.
0077    */
0078   void persistentInput(PersistentIStream & is, int version);
0079   //@}
0080 
0081   /**
0082    * The standard Init function used to initialize the interfaces.
0083    * Called exactly once for each class by the class description system
0084    * before the main function starts or
0085    * when this class is dynamically loaded.
0086    */
0087   static void Init();
0088 
0089 protected:
0090 
0091   /** @name Clone Methods. */
0092   //@{
0093   /**
0094    * Make a simple clone of this object.
0095    * @return a pointer to the new object.
0096    */
0097   virtual IBPtr clone() const {return new_ptr(*this);}
0098 
0099   /** Make a clone of this object, possibly modifying the cloned object
0100    * to make it sane.
0101    * @return a pointer to the new object.
0102    */
0103   virtual IBPtr fullclone() const {return new_ptr(*this);}
0104   //@}
0105 
0106 protected:
0107 
0108   /** @name Standard Interfaced functions. */
0109   //@{
0110   /**
0111    * Finalize this object. Called in the run phase just after a
0112    * run has ended. Used eg. to write out statistics.
0113    */
0114   virtual void dofinish();
0115   //@}
0116 
0117   /**
0118    * Helper function to obtain the name of a particle.
0119    */
0120   string particleName(tcPPtr) const;
0121 
0122 private:
0123 
0124   /**
0125    * The static object used to initialize the description of this class.
0126    * Indicates that this is a concrete class with persistent data.
0127    */
0128   static ClassDescription<GraphvizPlot> initGraphvizPlot;
0129 
0130   /**
0131    * The assignment operator is private and must never be called.
0132    * In fact, it should not even be implemented.
0133    */
0134   GraphvizPlot & operator=(const GraphvizPlot &) = delete;
0135 
0136 private:
0137 
0138   /**
0139    * Event number that should be drawn 
0140    */
0141   long _eventNumber;
0142 
0143   /**
0144    * Tell the object not to write out messages to the standard output.
0145    */
0146   bool _quiet;
0147 
0148 
0149 };
0150 
0151 }
0152 
0153 #include "ThePEG/Utilities/ClassTraits.h"
0154 
0155 namespace ThePEG {
0156 
0157 /** @cond TRAITSPECIALIZATIONS */
0158 
0159 /** This template specialization informs ThePEG about the
0160  *  base classes of GraphvizPlot. */
0161 template <>
0162 struct BaseClassTrait<GraphvizPlot,1> {
0163   /** Typedef of the first base class of GraphvizPlot. */
0164   typedef AnalysisHandler NthBase;
0165 };
0166 
0167 /** This template specialization informs ThePEG about the name of
0168  *  the GraphvizPlot class and the shared object where it is defined. */
0169 template <>
0170 struct ClassTraits<GraphvizPlot>
0171   : public ClassTraitsBase<GraphvizPlot> {
0172   /** Return a platform-independent class name */
0173   static string className() { return "ThePEG::GraphvizPlot"; }
0174   /** Return the name(s) of the shared library (or libraries) be loaded to get
0175    *  access to the GraphvizPlot class and any other class on which it depends
0176    *  (except the base class). */
0177   static string library() { return "GraphvizPlot.so"; }
0178 };
0179 
0180 /** @endcond */
0181 
0182 }
0183 
0184 #endif /* THEPEG_GraphvizPlot_H */