ThePEG  1.8.0
HepMCFile.h
1 // -*- C++ -*-
2 //
3 // HepMCFile.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 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 "ThePEG/Handlers/AnalysisHandler.h"
17 #include "ThePEG/Repository/CurrentGenerator.h"
18 #include "ThePEG/Repository/EventGenerator.h"
19 #include "HepMC/IO_BaseClass.h"
20 
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 &);
143 
144 private:
145 
150 
154  int _format;
155 
159  string _filename;
160 
164  HepMC::IO_BaseClass *_hepmcio;
165 
169  ofstream _hepmcdump;
170 
175 
179  unsigned int _geneventPrecision;
180 };
181 
182 }
183 
184 #include "ThePEG/Utilities/ClassTraits.h"
185 
186 namespace ThePEG {
187 
192 template <>
193 struct BaseClassTrait<HepMCFile,1> {
195  typedef AnalysisHandler NthBase;
196 };
197 
200 template <>
201 struct ClassTraits<HepMCFile>
202  : public ClassTraitsBase<HepMCFile> {
204  static string className() { return "ThePEG::HepMCFile"; }
208  static string library() { return "HepMCAnalysis.so"; }
209 };
210 
213 }
214 
215 #endif /* THEPEG_HepMCFile_H */