|
|
|||
File indexing completed on 2026-08-06 09:38:27
0001 // -*- C++ -*- 0002 // 0003 // MadGraphReader.h is a part of ThePEG - Toolkit for HEP Event Generation 0004 // Copyright (C) 1999-2019 Leif Lonnblad 0005 // 0006 // ThePEG is licenced under version 3 of the GPL, see COPYING for details. 0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 0008 // 0009 #ifndef THEPEG_MadGraphReader_H 0010 #define THEPEG_MadGraphReader_H 0011 // This is the declaration of the MadGraphReader class. 0012 0013 #include "ThePEG/LesHouches/LesHouchesFileReader.h" 0014 0015 namespace ThePEG { 0016 0017 /** 0018 * MadGraphReader inherits from LesHouchesFileReader and is able to 0019 * read event files produced by the MadGraph/MadEvent program. 0020 * 0021 * @see \ref MadGraphReaderInterfaces "The interfaces" 0022 * defined for MadGraphReader. 0023 */ 0024 class MadGraphReader: public LesHouchesFileReader { 0025 0026 public: 0027 0028 /** @name Standard constructors and destructors. */ 0029 //@{ 0030 /** 0031 * Default constructor. 0032 */ 0033 MadGraphReader() 0034 : fixedScale(91.188*GeV), fixedAEM(0.007546772), fixedAS(0.12), 0035 doInitCuts(false) {} 0036 //@} 0037 0038 public: 0039 0040 /** @name Virtual functions specified by the LesHouchesReader base class. */ 0041 //@{ 0042 /** 0043 * Open a file or stream with events and read in the run information 0044 * into the corresponding protected variables. 0045 */ 0046 virtual void open(); 0047 0048 /** 0049 * Scan the file or stream to obtain information about cross section 0050 * weights and particles etc. This function should fill the 0051 * variables corresponding to the /HEPRUP/ common block. The 0052 * function returns the number of events scanned. This version calls 0053 * the base class function and the readjusts the values in HEPRUP to 0054 * cure some inconsistencies in the MadGraph files. 0055 */ 0056 virtual long scan(); 0057 0058 /** 0059 * Read the next event form the file or stream into the 0060 * corresponding protected variables. Return false if there is no 0061 * more events. 0062 */ 0063 virtual bool doReadEvent(); 0064 //@} 0065 0066 public: 0067 0068 /** @name Functions used by the persistent I/O system. */ 0069 //@{ 0070 /** 0071 * Function used to write out object persistently. 0072 * @param os the persistent output stream written to. 0073 */ 0074 void persistentOutput(PersistentOStream & os) const; 0075 0076 /** 0077 * Function used to read in object persistently. 0078 * @param is the persistent input stream read from. 0079 * @param version the version number of the object when written. 0080 */ 0081 void persistentInput(PersistentIStream & is, int version); 0082 //@} 0083 0084 /** 0085 * Standard Init function used to initialize the interfaces. 0086 */ 0087 static void Init(); 0088 0089 protected: 0090 0091 /** @name Clone Methods. */ 0092 //@{ 0093 /** 0094 * Make a simple clone of this object. 0095 * @return a pointer to the new object. 0096 */ 0097 virtual IBPtr clone() const; 0098 0099 /** Make a clone of this object, possibly modifying the cloned object 0100 * to make it sane. 0101 * @return a pointer to the new object. 0102 */ 0103 virtual IBPtr fullclone() const; 0104 //@} 0105 0106 protected: 0107 0108 /** @name Standard Interfaced functions. */ 0109 //@{ 0110 0111 /** 0112 * Initialize this object after the setup phase before saving an 0113 * EventGenerator to disk. 0114 * @throws InitException if object could not be initialized properly. 0115 */ 0116 virtual void doinit(); 0117 0118 /** 0119 * Called from doinit() to extract cuts from the event file and add 0120 * the corresponding objects to the current EventGenerator. 0121 */ 0122 CutsPtr initCuts(); 0123 0124 /** 0125 * Called from LesHouchesReader::doinit() to extract PDFs from the 0126 * event file and add the corresponding objects to the current 0127 * EventGenerator. 0128 */ 0129 virtual void initPDFs(); 0130 0131 /** 0132 * Return true if this object needs to be initialized before all 0133 * other objects because it needs to extract cuts from the event file. 0134 */ 0135 virtual bool preInitialize() const; 0136 0137 /** 0138 * Finalize this object. Called in the run phase just after a 0139 * run has ended. Used eg. to write out statistics. 0140 */ 0141 virtual void dofinish() { 0142 LesHouchesFileReader::dofinish(); 0143 if ( stats.accepted() > 0 ) useMe(); 0144 } 0145 //@} 0146 0147 protected: 0148 0149 /** 0150 * Interface function to scan a madgraph file and extract 0151 * information about used cuts. The corresponding cut objects are 0152 * created in the Repository and assigned to this reader. 0153 */ 0154 string scanCuts(string); 0155 0156 /** 0157 * Function to extract the number of events from a string 0158 */ 0159 long numberOfEvents(string); 0160 0161 protected: 0162 0163 /** 0164 * Fixed scale. Old MadGraph files do not necessarily contain 0165 * information about the factorization (or renormalization) 0166 * scale. In this case this is used instead. 0167 */ 0168 Energy fixedScale; 0169 0170 /** 0171 * Fixed \f$\alpha_{EM}\f$. Old MadGraph files do not necessarily 0172 * contain information about the value of \f$\alpha_{EM}\f$. In this 0173 * case this is used instead. 0174 */ 0175 double fixedAEM; 0176 0177 /** 0178 * Fixed \f$\alpha_S\f$. Old MadGraph files do not necessarily 0179 * contain information about the value of \f$\alpha_S\f$. In this 0180 * case this is used instead. 0181 */ 0182 double fixedAS; 0183 0184 /** 0185 * New MadGraph files contain suitable information about cuts used 0186 * in the generation. The non-zero ones are stored in this map. 0187 */ 0188 map<string,double> cuts; 0189 0190 /** 0191 * If true, cuts may be extracted from the event file during initialization. 0192 */ 0193 bool doInitCuts; 0194 0195 public: 0196 0197 /** 0198 * Exception class used to inform about inability to work with some 0199 * weighted event files. 0200 */ 0201 struct WeightedException: public Exception {}; 0202 0203 private: 0204 0205 /** 0206 * Describe a concrete class with persistent data. 0207 */ 0208 static ClassDescription<MadGraphReader> initMadGraphReader; 0209 0210 /** 0211 * Private and non-existent assignment operator. 0212 */ 0213 MadGraphReader & operator=(const MadGraphReader &) = delete; 0214 0215 }; 0216 0217 } 0218 0219 0220 #include "ThePEG/Utilities/ClassTraits.h" 0221 0222 namespace ThePEG { 0223 0224 /** @cond TRAITSPECIALIZATIONS */ 0225 0226 /** 0227 * This template specialization informs ThePEG about the 0228 * base class of MadGraphReader. 0229 */ 0230 template <> 0231 struct BaseClassTrait<MadGraphReader,1>: public ClassTraitsType { 0232 /** Typedef of the base class of MadGraphReader. */ 0233 typedef LesHouchesFileReader NthBase; 0234 }; 0235 0236 /** 0237 * This template specialization informs ThePEG about the name of the 0238 * MadGraphReader class and the shared object where it is 0239 * defined. 0240 */ 0241 template <> 0242 struct ClassTraits<MadGraphReader> 0243 : public ClassTraitsBase<MadGraphReader> { 0244 /** Return the class name. */ 0245 static string className() { return "ThePEG::MadGraphReader"; } 0246 /** Return the name of the shared library to be loaded to get 0247 * access to the MadGraphReader class and every other class it uses 0248 * (except the base class). */ 0249 static string library() { return "MadGraphReader.so"; } 0250 0251 }; 0252 0253 /** @endcond */ 0254 0255 } 0256 0257 #endif /* THEPEG_MadGraphReader_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|