thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
MadGraphReader.h
1// -*- C++ -*-
2//
3// MadGraphReader.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_MadGraphReader_H
10#define THEPEG_MadGraphReader_H
11// This is the declaration of the MadGraphReader class.
12
13#include "ThePEG/LesHouches/LesHouchesFileReader.h"
14
15namespace ThePEG {
16
25
26public:
27
34 : fixedScale(91.188*GeV), fixedAEM(0.007546772), fixedAS(0.12),
35 doInitCuts(false) {}
37
38public:
39
46 virtual void open();
47
56 virtual long scan();
57
63 virtual bool doReadEvent();
65
66public:
67
75
81 void persistentInput(PersistentIStream & is, int version);
83
87 static void Init();
88
89protected:
90
97 virtual IBPtr clone() const;
98
103 virtual IBPtr fullclone() const;
105
106protected:
107
110
116 virtual void doinit();
117
122 CutsPtr initCuts();
123
129 virtual void initPDFs();
130
135 virtual bool preInitialize() const;
136
141 virtual void dofinish() {
143 if ( stats.accepted() > 0 ) useMe();
144 }
146
147protected:
148
154 string scanCuts(string);
155
159 long numberOfEvents(string);
160
161protected:
162
169
175 double fixedAEM;
176
182 double fixedAS;
183
188 map<string,double> cuts;
189
194
195public:
196
201 struct WeightedException: public Exception {};
202
203private:
204
209
214
215};
216
217}
218
219
220#include "ThePEG/Utilities/ClassTraits.h"
221
222namespace ThePEG {
223
230template <>
231struct BaseClassTrait<MadGraphReader,1>: public ClassTraitsType {
233 typedef LesHouchesFileReader NthBase;
234};
235
241template <>
242struct ClassTraits<MadGraphReader>
243 : public ClassTraitsBase<MadGraphReader> {
245 static string className() { return "ThePEG::MadGraphReader"; }
249 static string library() { return "MadGraphReader.so"; }
250
251};
252
255}
256
257#endif /* THEPEG_MadGraphReader_H */
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
virtual void dofinish()
Finalize this object.
void useMe() const
Should be called to indicate that this object has actually been used.
Definition: Interfaced.h:93
LesHouchesFileReader is an base class to be used for objects which reads event files from matrix elem...
XSecStat stats
Collect statistics for this reader.
MadGraphReader inherits from LesHouchesFileReader and is able to read event files produced by the Mad...
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
static ClassDescription< MadGraphReader > initMadGraphReader
Describe a concrete class with persistent data.
Energy fixedScale
Fixed scale.
virtual void dofinish()
Finalize this object.
virtual void initPDFs()
Called from LesHouchesReader::doinit() to extract PDFs from the event file and add the corresponding ...
bool doInitCuts
If true, cuts may be extracted from the event file during initialization.
virtual bool doReadEvent()
Read the next event form the file or stream into the corresponding protected variables.
static void Init()
Standard Init function used to initialize the interfaces.
MadGraphReader & operator=(const MadGraphReader &)=delete
Private and non-existent assignment operator.
virtual void open()
Open a file or stream with events and read in the run information into the corresponding protected va...
string scanCuts(string)
Interface function to scan a madgraph file and extract information about used cuts.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
CutsPtr initCuts()
Called from doinit() to extract cuts from the event file and add the corresponding objects to the cur...
map< string, double > cuts
New MadGraph files contain suitable information about cuts used in the generation.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual bool preInitialize() const
Return true if this object needs to be initialized before all other objects because it needs to extra...
virtual IBPtr clone() const
Make a simple clone of this object.
long numberOfEvents(string)
Function to extract the number of events from a string.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
virtual long scan()
Scan the file or stream to obtain information about cross section weights and particles etc.
MadGraphReader()
Default constructor.
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
double accepted() const
Number of accepts so far.
Definition: XSecStat.h:240
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
Exception class used to inform about inability to work with some weighted event files.