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