herwig is hosted by Hepforge, IPPP Durham
Herwig  7.2.1
FxFxFileReader.h
1 // -*- C++ -*-
2 //
3 // FxFxFileReader.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_FxFxFileReader_H
10 #define THEPEG_FxFxFileReader_H
11 // This is the declaration of the FxFxFileReader class.
12 
13 #include "FxFxReader.h"
14 #include "FxFxFileReader.fh"
15 #include "ThePEG/PDT/Decayer.h"
16 #include "ThePEG/Utilities/CFileLineReader.h"
17 #include <stdio.h>
18 
19 namespace ThePEG {
20 
21 
38 class FxFxFileReader: public FxFxReader {
39 
40 public:
41 
48  theIncludeCentral(false) {}
49 
55 
59  virtual ~FxFxFileReader();
61 
62 public:
63 
70  virtual void initialize(FxFxEventHandler & eh);
71 
77  virtual void open();
78 
82  virtual void close();
83 
84 
90  virtual bool doReadEvent();
92 
96  string filename() const { return theFileName; }
97 
98  /* vector<string> optionalWeightsNames;
99 
100  virtual vector<string> optWeightNamesFunc();*/
101 
102 
103  virtual vector<string> optWeightsNamesFunc();
104 
105 
110  void erase_substr(std::string& subject, const std::string& search);
111 
112 
113 public:
114 
121  void persistentOutput(PersistentOStream & os) const;
122 
128  void persistentInput(PersistentIStream & is, int version);
130 
134  static void Init();
135 
136 protected:
137 
144  virtual IBPtr clone() const;
145 
150  virtual IBPtr fullclone() const;
152 
160  virtual void doinit();
161 
166  virtual bool preInitialize() const;
167  //@
168 
169 protected:
170 
175 
176 protected:
177 
181  long neve;
182 
186  long ieve;
187 
193  string LHFVersion;
194 
199  string outsideBlock;
200 
204  string headerBlock;
205 
209  string initComments;
210 
215  map<string,string> initAttributes;
216 
221 
226  map<string,string> eventAttributes;
227 
228 private:
229 
233  string theFileName;
234 
239 
244 
249 
254 
258  map<string,string> scalemap;
259 
264  map<string,double> optionalWeightsTemp;
265 
266 
267 private:
268 
273 
277  FxFxFileReader & operator=(const FxFxFileReader &) = delete;
278 
279 public:
280 
284  class FxFxFileError: public Exception {};
287 };
288 
289 }
290 
291 
292 #include "ThePEG/Utilities/ClassTraits.h"
293 
294 namespace ThePEG {
295 
302 template <>
303 struct BaseClassTrait<FxFxFileReader,1>: public ClassTraitsType {
305  typedef FxFxReader NthBase;
306 };
307 
313 template <>
314 struct ClassTraits<FxFxFileReader>
315  : public ClassTraitsBase<FxFxFileReader> {
319  static string className() { return "Herwig::FxFxFileReader"; }
325  static string library() { return "HwFxFx.so"; }
326 
327 };
328 
331 }
332 
333 #endif /* THEPEG_FxFxFileReader_H */
string outsideBlock
If LHF.
virtual bool doReadEvent()
Read the next event from the file or stream into the corresponding protected variables.
map< string, string > initAttributes
If LHF.
The FxFxEventHandler inherits from the general EventHandler class and administers the reading of even...
virtual vector< string > optWeightsNamesFunc()
return the weight names
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
virtual ~FxFxFileReader()
Destructor.
string eventComments
If LHF.
DecayerPtr theDecayer
Decayer for any decay modes read from the file.
virtual void open()
Open a file with events.
FxFxFileReader & operator=(const FxFxFileReader &)=delete
Private and non-existent assignment operator.
CFileLineReader cfile
The wrapper around the C FILE stream from which to read.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
FxFxReader is an abstract base class to be used for objects which reads event files or streams from m...
Definition: FxFxReader.h:77
map< string, string > eventAttributes
If LHF.
string theFileName
The name of the file from where to read events.
string headerBlock
If LHF.
string initComments
If LHF.
static void Init()
Standard Init function used to initialize the interfaces.
virtual IBPtr clone() const
Make a simple clone of this object.
static ClassDescription< FxFxFileReader > initFxFxFileReader
Describe an abstract base class with persistent data.
FxFxFileReader is an base class to be used for objects which reads event files from matrix element ge...
string filename() const
Return the name of the file from where to read events.
bool theIncludeCentral
Include central weight (for backup use)
FxFxFileReader()
Default constructor.
ThePEG::Ptr< Decayer >::pointer DecayerPtr
bool theIncludeFxFxTags
Include/Read FxFx tags.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
map< string, string > scalemap
Further information on the weights.
map< string, double > optionalWeightsTemp
Temporary holder for optional weights.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
long neve
The number of events in this file.
string LHFVersion
If the file is a standard Les Houches formatted file (LHF) this is its version number.
void erase_substr(std::string &subject, const std::string &search)
Erases all occurences of a substring from a string.
virtual bool preInitialize() const
Return true if this object needs to be initialized before all other objects because it needs to extra...
bool theQNumbers
Whether or not to search for QNUMBERS stuff.
long ieve
The current event number.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
virtual void close()
Close the file from which events have been read.
virtual void initialize(FxFxEventHandler &eh)
Initialize.