thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
LesHouchesFileReader.h
1// -*- C++ -*-
2//
3// LesHouchesFileReader.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_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
20namespace ThePEG {
21
22
40
41public:
42
49 theIncludeFxFxTags(false),
50 theIncludeCentral(false) {}
51
57
63
64public:
65
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
107public:
108
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
138protected:
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
171protected:
172
177
178protected:
179
183 long neve;
184
188 long ieve;
189
196
202
207
212
217 map<string,string> initAttributes;
218
223
228 map<string,string> eventAttributes;
229
230private:
231
236
241
246
251
256
260 map<string,string> scalemap;
261
266 map<string,double> optionalWeightsTemp;
267
268
269private:
270
275
280
281public:
282
286 class LesHouchesFileError: public Exception {};
289};
290
291}
292
293
294#include "ThePEG/Utilities/ClassTraits.h"
295
296namespace ThePEG {
297
304template <>
305struct BaseClassTrait<LesHouchesFileReader,1>: public ClassTraitsType {
307 typedef LesHouchesReader NthBase;
308};
309
315template <>
316struct 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 */
CFileLineReader is a wrapper around a standard C FILE stream.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
Exception is the base class for all exceptions to be used in ThePEG.
Definition: Exception.h:44
The LesHouchesEventHandler inherits from the general EventHandler class and administers the reading o...
LesHouchesFileReader is an base class to be used for objects which reads event files from matrix elem...
virtual void close()
Close the file from which events have been read.
virtual void initialize(LesHouchesEventHandler &eh)
Initialize.
string theFileName
The name of the file from where to read events.
LesHouchesFileReader(const LesHouchesFileReader &)
Copy-constructor.
map< string, double > optionalWeightsTemp
Temporary holder for optional weights.
CFileLineReader cfile
The wrapper around the C FILE stream from which to read.
long neve
The number of events in this file.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
bool theQNumbers
Whether or not to search for QNUMBERS stuff.
virtual void open()
Open a file with events.
map< string, string > eventAttributes
If LHF.
static void Init()
Standard Init function used to initialize the interfaces.
map< string, string > initAttributes
If LHF.
virtual IBPtr clone() const
Make a simple clone of this object.
DecayerPtr theDecayer
Decayer for any decay modes read from the file.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
LesHouchesFileReader()
Default constructor.
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...
virtual bool doReadEvent()
Read the next event from the file or stream into the corresponding protected variables.
bool theIncludeCentral
Include central weight (for backup use)
virtual vector< string > optWeightsNamesFunc()
Return the optional weights information string ("Names")
string filename() const
Return the name of the file from where to read events.
static ClassDescription< LesHouchesFileReader > initLesHouchesFileReader
Describe an abstract base class with persistent data.
bool theIncludeFxFxTags
Include/Read FxFx tags.
string LHFVersion
If the file is a standard Les Houches formatted file (LHF) this is its version number.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
virtual ~LesHouchesFileReader()
Destructor.
LesHouchesFileReader & operator=(const LesHouchesFileReader &)=delete
Private and non-existent assignment operator.
long ieve
The current event number.
map< string, string > scalemap
Further information on the weights.
LesHouchesReader is an abstract base class to be used for objects which reads event files or streams ...
PersistentIStream is used to read persistent objects from a stream where they were previously written...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
static string library()
The name of a file containing the dynamic library where the class T is implemented.
Definition: ClassTraits.h:85