ThePEG  1.8.0
LesHouchesFileReader.h
1 // -*- C++ -*-
2 //
3 // LesHouchesFileReader.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_LesHouchesFileReader_H
10 #define THEPEG_LesHouchesFileReader_H
11 // This is the declaration of the LesHouchesFileReader class.
12 
13 #include "ThePEG/LesHouches/LesHouchesReader.h"
14 #include "LesHouchesFileReader.fh"
15 #include "ThePEG/PDT/Decayer.h"
16 #include "ThePEG/Utilities/CFileLineReader.h"
17 #include <stdio.h>
18 
19 namespace ThePEG {
20 
38 
39 public:
40 
46  LesHouchesFileReader() : neve(0), ieve(0), theQNumbers(false) {}
47 
53 
57  virtual ~LesHouchesFileReader();
59 
60 public:
61 
68  virtual void initialize(LesHouchesEventHandler & eh);
69 
75  virtual void open();
76 
80  virtual void close();
81 
87  virtual bool doReadEvent();
89 
93  string filename() const { return theFileName; }
94 
95 public:
96 
103  void persistentOutput(PersistentOStream & os) const;
104 
110  void persistentInput(PersistentIStream & is, int version);
112 
116  static void Init();
117 
118 protected:
119 
126  virtual IBPtr clone() const;
127 
132  virtual IBPtr fullclone() const;
134 
142  virtual void doinit();
143 
148  virtual bool preInitialize() const;
149  //@
150 
151 protected:
152 
157 
158 protected:
159 
163  long neve;
164 
168  long ieve;
169 
175  string LHFVersion;
176 
181  string outsideBlock;
182 
186  string headerBlock;
187 
191  string initComments;
192 
197  map<string,string> initAttributes;
198 
203 
208  map<string,string> eventAttributes;
209 
210 private:
211 
215  string theFileName;
216 
221 
226 
227 private:
228 
233 
238 
239 public:
240 
244  class LesHouchesFileError: public Exception {};
247 };
248 
249 }
250 
251 
252 #include "ThePEG/Utilities/ClassTraits.h"
253 
254 namespace ThePEG {
255 
262 template <>
263 struct BaseClassTrait<LesHouchesFileReader,1>: public ClassTraitsType {
265  typedef LesHouchesReader NthBase;
266 };
267 
273 template <>
274 struct ClassTraits<LesHouchesFileReader>
275  : public ClassTraitsBase<LesHouchesFileReader> {
279  static string className() { return "ThePEG::LesHouchesFileReader"; }
285  static string library() { return "LesHouches.so"; }
286 
287 };
288 
291 }
292 
293 #endif /* THEPEG_LesHouchesFileReader_H */
static ClassDescription< LesHouchesFileReader > initLesHouchesFileReader
Describe an abstract base class with persistent data.
virtual bool preInitialize() const
Return true if this object needs to be initialized before all other objects because it needs to extra...
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...
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...
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.
virtual void close()
Close the file from which events have been read.
string theFileName
The name of the file from where to read events.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
long ieve
The current event number.
static string library()
The name of a file containing the dynamic library where the class T is implemented.
Definition: ClassTraits.h:85
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual void open()
Open a file with events.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
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.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
virtual bool doReadEvent()
Read the next event from the file or stream into the corresponding protected variables.
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
LesHouchesFileReader & operator=(const LesHouchesFileReader &)
Private and non-existent assignment operator.
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
string filename() const
Return the name of the file from where to read events.
CFileLineReader is a wrapper around a standard C FILE stream.
virtual IBPtr clone() const
Make a simple clone of this object.
long neve
The number of events in this file.
map< string, string > initAttributes
If LHF.
CFileLineReader cfile
The wrapper around the C FILE stream from which to read.
LesHouchesFileReader()
Default constructor.
LesHouchesFileReader is an base class to be used for objects which reads event files from matrix elem...