|
|
|||
File indexing completed on 2026-08-06 09:38:19
0001 // -*- C++ -*- 0002 // 0003 // HepMCFile.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_HepMCFile_H 0010 #define THEPEG_HepMCFile_H 0011 // 0012 // This is the declaration of the HepMCFile class. 0013 // 0014 #include <iostream> 0015 #include <fstream> 0016 #include <config.h> 0017 #include "ThePEG/Handlers/AnalysisHandler.h" 0018 #include "ThePEG/Repository/CurrentGenerator.h" 0019 #include "ThePEG/Repository/EventGenerator.h" 0020 #include "ThePEG/Config/HepMCHelper.h" 0021 namespace ThePEG { 0022 0023 /** \ingroup Analysis 0024 * The HepMCFile class outputs ThePEG events in HepMC format. 0025 * 0026 * @see \ref HepMCFileInterfaces "The interfaces" 0027 * defined for HepMCFile. 0028 */ 0029 class HepMCFile: public AnalysisHandler { 0030 0031 public: 0032 0033 /** @name Standard constructors and destructors. */ 0034 //@{ 0035 /** 0036 * The default constructor. 0037 */ 0038 HepMCFile(); 0039 0040 /** 0041 * The copy constructor. 0042 */ 0043 HepMCFile(const HepMCFile &); 0044 //@} 0045 0046 public: 0047 0048 /** @name Virtual functions required by the AnalysisHandler class. */ 0049 //@{ 0050 /** 0051 * Analyze a given Event. Note that a fully generated event 0052 * may be presented several times, if it has been manipulated in 0053 * between. The default version of this function will call transform 0054 * to make a lorentz transformation of the whole event, then extract 0055 * all final state particles and call analyze(tPVector) of this 0056 * analysis object and those of all associated analysis objects. The 0057 * default version will not, however, do anything on events which 0058 * have not been fully generated, or have been manipulated in any 0059 * way. 0060 * @param event pointer to the Event to be analyzed. 0061 * @param ieve the event number. 0062 * @param loop the number of times this event has been presented. 0063 * If negative the event is now fully generated. 0064 * @param state a number different from zero if the event has been 0065 * manipulated in some way since it was last presented. 0066 */ 0067 virtual void analyze(tEventPtr event, long ieve, int loop, int state); 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 protected: 0114 0115 /** @name Standard Interfaced functions. */ 0116 //@{ 0117 /** 0118 * Initialize this object. Called in the run phase just before 0119 * a run begins. 0120 */ 0121 virtual void doinitrun(); 0122 0123 /** 0124 * Finalize this object. Called in the run phase just after a 0125 * run has ended. Used eg. to write out statistics. 0126 */ 0127 virtual void dofinish(); 0128 //@} 0129 0130 private: 0131 0132 /** 0133 * The static object used to initialize the description of this class. 0134 * Indicates that this is a concrete class with persistent data. 0135 */ 0136 static ClassDescription<HepMCFile> initHepMCFile; 0137 0138 /** 0139 * The assignment operator is private and must never be called. 0140 * In fact, it should not even be implemented. 0141 */ 0142 HepMCFile & operator=(const HepMCFile &) = delete; 0143 0144 private: 0145 0146 /** 0147 * Last event that should be written out as HepMC format 0148 */ 0149 long _eventNumber; 0150 0151 /** 0152 * The HepMC format 0153 */ 0154 int _format; 0155 0156 /** 0157 * The HepMC filename 0158 */ 0159 string _filename; 0160 0161 #ifdef HAVE_HEPMC_ROOTIO 0162 /** 0163 * The name of TTRee in ROOT file 0164 */ 0165 string _ttreename; 0166 0167 /** 0168 * The name of branch in ROOT file 0169 */ 0170 string _tbranchname; 0171 0172 #endif 0173 /** 0174 * The HepMC I/O handler 0175 */ 0176 #ifdef HAVE_HEPMC3 0177 HepMC::Writer *_hepmcio; 0178 #else 0179 HepMC::IO_BaseClass *_hepmcio; 0180 #endif 0181 /** 0182 * The HepMC dump file 0183 */ 0184 ofstream _hepmcdump; 0185 0186 /** 0187 * Selector for the choice of units 0188 */ 0189 int _unitchoice; 0190 0191 /** 0192 * Choice of output precision in GenEvent format 0193 */ 0194 unsigned int _geneventPrecision; 0195 0196 /** 0197 * Choice of adding Heavy Ion information. 0198 */ 0199 int _addHI; 0200 0201 }; 0202 0203 } 0204 0205 #include "ThePEG/Utilities/ClassTraits.h" 0206 0207 namespace ThePEG { 0208 0209 /** @cond TRAITSPECIALIZATIONS */ 0210 0211 /** This template specialization informs ThePEG about the 0212 * base classes of HepMCFile. */ 0213 template <> 0214 struct BaseClassTrait<HepMCFile,1> { 0215 /** Typedef of the first base class of HepMCFile. */ 0216 typedef AnalysisHandler NthBase; 0217 }; 0218 0219 /** This template specialization informs ThePEG about the name of 0220 * the HepMCFile class and the shared object where it is defined. */ 0221 template <> 0222 struct ClassTraits<HepMCFile> 0223 : public ClassTraitsBase<HepMCFile> { 0224 /** Return a platform-independent class name */ 0225 static string className() { return "ThePEG::HepMCFile"; } 0226 /** Return the name(s) of the shared library (or libraries) be loaded to get 0227 * access to the HepMCFile class and any other class on which it depends 0228 * (except the base class). */ 0229 static string library() { return "HepMCAnalysis.so"; } 0230 }; 0231 0232 /** @endcond */ 0233 0234 } 0235 0236 #endif /* THEPEG_HepMCFile_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|