thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
HepMCFile.h
1 // -*- C++ -*-
2 //
3 // HepMCFile.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef THEPEG_HepMCFile_H
10 #define THEPEG_HepMCFile_H
11 //
12 // This is the declaration of the HepMCFile class.
13 //
14 #include <iostream>
15 #include <fstream>
16 #include <config.h>
17 #include "ThePEG/Handlers/AnalysisHandler.h"
18 #include "ThePEG/Repository/CurrentGenerator.h"
19 #include "ThePEG/Repository/EventGenerator.h"
20 #include "ThePEG/Config/HepMCHelper.h"
21 namespace ThePEG {
22 
29 class HepMCFile: public AnalysisHandler {
30 
31 public:
32 
38  HepMCFile();
39 
43  HepMCFile(const HepMCFile &);
45 
46 public:
47 
67  virtual void analyze(tEventPtr event, long ieve, int loop, int state);
69 
70 public:
71 
78  void persistentOutput(PersistentOStream & os) const;
79 
85  void persistentInput(PersistentIStream & is, int version);
87 
94  static void Init();
95 
96 protected:
97 
104  virtual IBPtr clone() const;
105 
110  virtual IBPtr fullclone() const;
112 
113 protected:
114 
121  virtual void doinitrun();
122 
127  virtual void dofinish();
129 
130 private:
131 
137 
142  HepMCFile & operator=(const HepMCFile &) = delete;
143 
144 private:
145 
150 
154  int _format;
155 
159  string _filename;
160 
161 #ifdef HAVE_HEPMC_ROOTIO
162 
165  string _ttreename;
166 
170  string _tbranchname;
171 
172 #endif
173 
176 #ifdef HAVE_HEPMC3
177  HepMC::Writer *_hepmcio;
178 #else
179  HepMC::IO_BaseClass *_hepmcio;
180 #endif
181 
184  ofstream _hepmcdump;
185 
190 
194  unsigned int _geneventPrecision;
195 
199  int _addHI;
200 
201 };
202 
203 }
204 
205 #include "ThePEG/Utilities/ClassTraits.h"
206 
207 namespace ThePEG {
208 
213 template <>
214 struct BaseClassTrait<HepMCFile,1> {
216  typedef AnalysisHandler NthBase;
217 };
218 
221 template <>
222 struct ClassTraits<HepMCFile>
223  : public ClassTraitsBase<HepMCFile> {
225  static string className() { return "ThePEG::HepMCFile"; }
229  static string library() { return "HepMCAnalysis.so"; }
230 };
231 
234 }
235 
236 #endif /* THEPEG_HepMCFile_H */
PersistentIStream is used to read persistent objects from a stream where they were previously written...
int _unitchoice
Selector for the choice of units.
Definition: HepMCFile.h:189
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
virtual void analyze(tEventPtr event, long ieve, int loop, int state)
Analyze a given Event.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
HepMCFile()
The default constructor.
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
The AnalysisHandler is the base class of all analysis objects which may be handled by the FullEventGe...
InitState state() const
Return the state of initialization of this object.
virtual void dofinish()
Finalize this object.
HepMC::IO_BaseClass * _hepmcio
The HepMC I/O handler.
Definition: HepMCFile.h:179
ofstream _hepmcdump
The HepMC dump file.
Definition: HepMCFile.h:184
HepMCFile & operator=(const HepMCFile &)=delete
The assignment operator is private and must never be called.
unsigned int _geneventPrecision
Choice of output precision in GenEvent format.
Definition: HepMCFile.h:194
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
static void Init()
The standard Init function used to initialize the interfaces.
int _format
The HepMC format.
Definition: HepMCFile.h:154
static ClassDescription< HepMCFile > initHepMCFile
The static object used to initialize the description of this class.
Definition: HepMCFile.h:136
virtual IBPtr clone() const
Make a simple clone of this object.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
The HepMCFile class outputs ThePEG events in HepMC format.
Definition: HepMCFile.h:29
int _addHI
Choice of adding Heavy Ion information.
Definition: HepMCFile.h:199
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
virtual void doinitrun()
Initialize this object.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
long _eventNumber
Last event that should be written out as HepMC format.
Definition: HepMCFile.h:149
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
string _filename
The HepMC filename.
Definition: HepMCFile.h:159
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52