00001 // -*- C++ -*- 00002 // 00003 // LesHouchesFileReader.h is a part of ThePEG - Toolkit for HEP Event Generation 00004 // Copyright (C) 1999-2007 Leif Lonnblad 00005 // 00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details. 00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details. 00008 // 00009 #ifndef THEPEG_LesHouchesFileReader_H 00010 #define THEPEG_LesHouchesFileReader_H 00011 // This is the declaration of the LesHouchesFileReader class. 00012 00013 #include "ThePEG/LesHouches/LesHouchesReader.h" 00014 #include "LesHouchesFileReader.fh" 00015 #include "ThePEG/Utilities/CFileLineReader.h" 00016 #include <stdio.h> 00017 00018 namespace ThePEG { 00019 00036 class LesHouchesFileReader: public LesHouchesReader { 00037 00038 public: 00039 00045 LesHouchesFileReader() : neve(0), ieve(0), theFile(NULL) {} 00046 00051 LesHouchesFileReader(const LesHouchesFileReader &); 00052 00056 virtual ~LesHouchesFileReader(); 00058 00059 public: 00060 00067 virtual void initialize(LesHouchesEventHandler & eh); 00068 00074 virtual void open(); 00075 00079 virtual void close(); 00080 00086 virtual bool doReadEvent(); 00088 00092 string filename() const { return theFileName; } 00093 00097 FILE * file() { return theFile; } 00098 00099 public: 00100 00107 void persistentOutput(PersistentOStream & os) const; 00108 00114 void persistentInput(PersistentIStream & is, int version); 00116 00120 static void Init(); 00121 00122 protected: 00123 00130 virtual IBPtr clone() const; 00131 00136 virtual IBPtr fullclone() const; 00138 00139 protected: 00140 00144 CFileLineReader cfile; 00145 00146 protected: 00147 00151 long neve; 00152 00156 long ieve; 00157 00163 string LHFVersion; 00164 00169 string outsideBlock; 00170 00174 string headerBlock; 00175 00179 string initComments; 00180 00185 map<string,string> initAttributes; 00186 00190 string eventComments; 00191 00196 map<string,string> eventAttributes; 00197 00198 private: 00199 00203 FILE * theFile; 00204 00208 string theFileName; 00209 00210 private: 00211 00215 static ClassDescription<LesHouchesFileReader> initLesHouchesFileReader; 00216 00220 LesHouchesFileReader & operator=(const LesHouchesFileReader &); 00221 00222 public: 00223 00227 class LesHouchesFileError: public Exception {}; 00230 }; 00231 00232 } 00233 00234 00235 #include "ThePEG/Utilities/ClassTraits.h" 00236 00237 namespace ThePEG { 00238 00245 template <> 00246 struct BaseClassTrait<LesHouchesFileReader,1>: public ClassTraitsType { 00248 typedef LesHouchesReader NthBase; 00249 }; 00250 00256 template <> 00257 struct ClassTraits<LesHouchesFileReader> 00258 : public ClassTraitsBase<LesHouchesFileReader> { 00262 static string className() { return "ThePEG::LesHouchesFileReader"; } 00268 static string library() { return "LesHouches.so"; } 00269 00270 }; 00271 00274 } 00275 00276 #endif /* THEPEG_LesHouchesFileReader_H */