thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
LesHouchesFileReader.h
1 // -*- C++ -*-
2 //
3 // LesHouchesFileReader.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2017 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_LesHouchesFileReader_H
10 #define THEPEG_LesHouchesFileReader_H
11 // This is the declaration of the LesHouchesFileReader class.
12 
13 #include "LesHouchesReader.h"
14 #include "LesHouchesFileReader.fh"
15 #include "ThePEG/PDT/Decayer.h"
16 #include "ThePEG/Utilities/CFileLineReader.h"
17 #include <string>
18 #include <stdio.h>
19 
20 namespace ThePEG {
21 
22 
40 
41 public:
42 
49  theIncludeFxFxTags(false),
50  theIncludeCentral(false) {}
51 
57 
61  virtual ~LesHouchesFileReader();
63 
64 public:
65 
72  virtual void initialize(LesHouchesEventHandler & eh);
73 
79  virtual void open();
80 
84  virtual void close();
85 
86 
92  virtual bool doReadEvent();
94 
98  string filename() const { return theFileName; }
99 
104  virtual vector<string> optWeightsNamesFunc();
105 
106 
107 public:
108 
115  void persistentOutput(PersistentOStream & os) const;
116 
122  void persistentInput(PersistentIStream & is, int version);
124 
128  static void Init();
129 
130 
135  void erase_substr(std::string& subject, const std::string& search);
136 
137 
138 protected:
139 
146  virtual IBPtr clone() const;
147 
152  virtual IBPtr fullclone() const;
154 
162  virtual void doinit();
163 
168  virtual bool preInitialize() const;
169  //@
170 
171 protected:
172 
177 
178 protected:
179 
183  long neve;
184 
188  long ieve;
189 
195  string LHFVersion;
196 
201  string outsideBlock;
202 
206  string headerBlock;
207 
211  string initComments;
212 
217  map<string,string> initAttributes;
218 
223 
228  map<string,string> eventAttributes;
229 
230 private:
231 
235  string theFileName;
236 
241 
246 
251 
256 
260  map<string,string> scalemap;
261 
266  map<string,double> optionalWeightsTemp;
267 
268 
269 private:
270 
275 
280 
281 public:
282 
286  class LesHouchesFileError: public Exception {};
289 };
290 
291 }
292 
293 
294 #include "ThePEG/Utilities/ClassTraits.h"
295 
296 namespace ThePEG {
297 
304 template <>
305 struct BaseClassTrait<LesHouchesFileReader,1>: public ClassTraitsType {
307  typedef LesHouchesReader NthBase;
308 };
309 
315 template <>
316 struct ClassTraits<LesHouchesFileReader>
317  : public ClassTraitsBase<LesHouchesFileReader> {
321  static string className() { return "ThePEG::LesHouchesFileReader"; }
327  static string library() { return "LesHouches.so"; }
328 
329 };
330 
333 }
334 
335 #endif /* THEPEG_LesHouchesFileReader_H */
static ClassDescription< LesHouchesFileReader > initLesHouchesFileReader
Describe an abstract base class with persistent data.
void erase_substr(std::string &subject, const std::string &search)
Erases all occurences of a substring from a string.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
The LesHouchesEventHandler inherits from the general EventHandler class and administers the reading o...
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
virtual bool preInitialize() const
Return true if this object needs to be initialized before all other objects because it needs to extra...
string LHFVersion
If the file is a standard Les Houches formatted file (LHF) this is its version number.
LesHouchesReader is an abstract base class to be used for objects which reads event files or streams ...
bool theQNumbers
Whether or not to search for QNUMBERS stuff.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
DecayerPtr theDecayer
Decayer for any decay modes read from the file.
virtual ~LesHouchesFileReader()
Destructor.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual void close()
Close the file from which events have been read.
map< string, string > scalemap
Further information on the weights.
string theFileName
The name of the file from where to read events.
long ieve
The current event number.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual void open()
Open a file with events.
string filename() const
Return the name of the file from where to read events.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
virtual vector< string > optWeightsNamesFunc()
Return the optional weights information string ("Names")
static void Init()
Standard Init function used to initialize the interfaces.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
virtual void initialize(LesHouchesEventHandler &eh)
Initialize.
Exception is the base class for all exceptions to be used in ThePEG.
Definition: Exception.h:44
map< string, string > eventAttributes
If LHF.
bool theIncludeCentral
Include central weight (for backup use)
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
virtual bool doReadEvent()
Read the next event from the file or stream into the corresponding protected variables.
CFileLineReader is a wrapper around a standard C FILE stream.
map< string, double > optionalWeightsTemp
Temporary holder for optional weights.
LesHouchesFileReader & operator=(const LesHouchesFileReader &)=delete
Private and non-existent assignment operator.
bool theIncludeFxFxTags
Include/Read FxFx tags.
long neve
The number of events in this file.
map< string, string > initAttributes
If LHF.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
virtual IBPtr clone() const
Make a simple clone of this object.
CFileLineReader cfile
The wrapper around the C FILE stream from which to read.
LesHouchesFileReader()
Default constructor.
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52
LesHouchesFileReader is an base class to be used for objects which reads event files from matrix elem...