|
|
|||
File indexing completed on 2026-08-06 09:38:19
0001 // -*- C++ -*- 0002 // 0003 // HIHepMCFile.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_HIHepMCFile_H 0010 #define THEPEG_HIHepMCFile_H 0011 // 0012 // This is the declaration of the HIHepMCFile 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 0022 namespace ThePEG { 0023 0024 /** \ingroup Analysis 0025 * The HIHepMCFile class outputs ThePEG events in HepMC format with additional Heavy Ion information. 0026 * 0027 * @see \ref HIHepMCFileInterfaces "The interfaces" 0028 * defined for HIHepMCFile. 0029 */ 0030 class HIHepMCFile: public AnalysisHandler { 0031 0032 public: 0033 0034 /** @name Standard constructors and destructors. */ 0035 //@{ 0036 /** 0037 * The default constructor. 0038 */ 0039 HIHepMCFile(); 0040 0041 /** 0042 * The copy constructor. 0043 */ 0044 HIHepMCFile(const HIHepMCFile &); 0045 //@} 0046 0047 public: 0048 0049 /** @name Virtual functions required by the AnalysisHandler class. */ 0050 //@{ 0051 /** 0052 * Analyze a given Event. Note that a fully generated event 0053 * may be presented several times, if it has been manipulated in 0054 * between. The default version of this function will call transform 0055 * to make a lorentz transformation of the whole event, then extract 0056 * all final state particles and call analyze(tPVector) of this 0057 * analysis object and those of all associated analysis objects. The 0058 * default version will not, however, do anything on events which 0059 * have not been fully generated, or have been manipulated in any 0060 * way. 0061 * @param event pointer to the Event to be analyzed. 0062 * @param ieve the event number. 0063 * @param loop the number of times this event has been presented. 0064 * If negative the event is now fully generated. 0065 * @param state a number different from zero if the event has been 0066 * manipulated in some way since it was last presented. 0067 */ 0068 virtual void analyze(tEventPtr event, long ieve, int loop, int state); 0069 //@} 0070 0071 public: 0072 0073 /** @name Functions used by the persistent I/O system. */ 0074 //@{ 0075 /** 0076 * Function used to write out object persistently. 0077 * @param os the persistent output stream written to. 0078 */ 0079 void persistentOutput(PersistentOStream & os) const; 0080 0081 /** 0082 * Function used to read in object persistently. 0083 * @param is the persistent input stream read from. 0084 * @param version the version number of the object when written. 0085 */ 0086 void persistentInput(PersistentIStream & is, int version); 0087 //@} 0088 0089 /** 0090 * The standard Init function used to initialize the interfaces. 0091 * Called exactly once for each class by the class description system 0092 * before the main function starts or 0093 * when this class is dynamically loaded. 0094 */ 0095 static void Init(); 0096 0097 protected: 0098 0099 /** @name Clone Methods. */ 0100 //@{ 0101 /** 0102 * Make a simple clone of this object. 0103 * @return a pointer to the new object. 0104 */ 0105 virtual IBPtr clone() const; 0106 0107 /** Make a clone of this object, possibly modifying the cloned object 0108 * to make it sane. 0109 * @return a pointer to the new object. 0110 */ 0111 virtual IBPtr fullclone() const; 0112 //@} 0113 0114 protected: 0115 0116 /** @name Standard Interfaced functions. */ 0117 //@{ 0118 /** 0119 * Initialize this object. Called in the run phase just before 0120 * a run begins. 0121 */ 0122 virtual void doinitrun(); 0123 0124 /** 0125 * Finalize this object. Called in the run phase just after a 0126 * run has ended. Used eg. to write out statistics. 0127 */ 0128 virtual void dofinish(); 0129 //@} 0130 0131 private: 0132 0133 /** 0134 * The static object used to initialize the description of this class. 0135 * Indicates that this is a concrete class with persistent data. 0136 */ 0137 static ClassDescription<HIHepMCFile> initHIHepMCFile; 0138 0139 /** 0140 * The assignment operator is private and must never be called. 0141 * In fact, it should not even be implemented. 0142 */ 0143 HIHepMCFile & operator=(const HIHepMCFile &) = delete; 0144 0145 private: 0146 0147 /** 0148 * Last event that should be written out as HepMC format 0149 */ 0150 long _eventNumber; 0151 0152 /** 0153 * The HepMC format 0154 */ 0155 int _format; 0156 0157 /** 0158 * The HepMC filename 0159 */ 0160 string _filename; 0161 0162 #ifdef HAVE_HEPMC_ROOTIO 0163 /** 0164 * The name of TTRee in ROOT file 0165 */ 0166 string _ttreename; 0167 0168 /** 0169 * The name of branch in ROOT file 0170 */ 0171 string _tbranchname; 0172 0173 #endif 0174 /** 0175 * The HepMC I/O handler 0176 */ 0177 #ifdef HAVE_HEPMC3 0178 HepMC::Writer *_hepmcio; 0179 #else 0180 HepMC::IO_BaseClass *_hepmcio; 0181 #endif 0182 0183 /** 0184 * The HepMC dump file 0185 */ 0186 ofstream _hepmcdump; 0187 0188 /** 0189 * Selector for the choice of units 0190 */ 0191 int _unitchoice; 0192 0193 /** 0194 * Choice of output precision in GenEvent format 0195 */ 0196 unsigned int _geneventPrecision; 0197 }; 0198 0199 } 0200 0201 #include "ThePEG/Utilities/ClassTraits.h" 0202 0203 namespace ThePEG { 0204 0205 /** @cond TRAITSPECIALIZATIONS */ 0206 0207 /** This template specialization informs ThePEG about the 0208 * base classes of HIHepMCFile. */ 0209 template <> 0210 struct BaseClassTrait<HIHepMCFile,1> { 0211 /** Typedef of the first base class of HIHepMCFile. */ 0212 typedef AnalysisHandler NthBase; 0213 }; 0214 0215 /** This template specialization informs ThePEG about the name of 0216 * the HIHepMCFile class and the shared object where it is defined. */ 0217 template <> 0218 struct ClassTraits<HIHepMCFile> 0219 : public ClassTraitsBase<HIHepMCFile> { 0220 /** Return a platform-independent class name */ 0221 static string className() { return "ThePEG::HIHepMCFile"; } 0222 /** Return the name(s) of the shared library (or libraries) be loaded to get 0223 * access to the HIHepMCFile class and any other class on which it depends 0224 * (except the base class). */ 0225 static string library() { return "HepMCAnalysis.so"; } 0226 }; 0227 0228 /** @endcond */ 0229 0230 } 0231 0232 #endif /* THEPEG_HIHepMCFile_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|