herwig is hosted by Hepforge, IPPP Durham
Herwig++  2.7.0
BasicLesHouchesFileReader.h
00001 // -*- C++ -*-
00002 //
00003 // BasicLesHouchesFileReader.h is a part of Herwig++ - A multi-purpose
00004 // Monte Carlo event generator.
00005 // Copyright (C) 2002-2011 The Herwig Collaboration
00006 //
00007 // Herwig++ is licenced under version 2 of the GPL, see COPYING for details.
00008 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
00009 //
00010 //
00011 // This is the implementation of the non-inlined, non-templated member
00012 // functions of the BasicLesHouchesFileReader class.
00013 //
00014 #ifndef HERWIG_BasicLesHouchesFileReader_H
00015 #define HERWIG_BasicLesHouchesFileReader_H
00016 // This is the declaration of the BasicLesHouchesFileReader class.
00017 
00018 #include "ThePEG/LesHouches/LesHouchesReader.h"
00019 #include "BasicLesHouchesFileReader.fh"
00020 #include "ThePEG/PDT/Decayer.h"
00021 #include "ThePEG/Utilities/CFileLineReader.h"
00022 #include <stdio.h>
00023 
00024 namespace Herwig {
00025 
00026 using namespace ThePEG;
00027 
00044 class BasicLesHouchesFileReader: public LesHouchesReader {
00045 
00046 public:
00047 
00053   BasicLesHouchesFileReader() : neve(0), ieve(0) {}
00054 
00059   BasicLesHouchesFileReader(const BasicLesHouchesFileReader &);
00060 
00064   virtual ~BasicLesHouchesFileReader();
00066 
00067 public:
00068 
00075   virtual void initialize(LesHouchesEventHandler & eh);
00076 
00089   virtual double getEvent();
00090 
00096   virtual bool readEvent();
00097 
00103   virtual void skip(long n);
00104 
00111   virtual long scan();
00112 
00118   virtual void open();
00119 
00123   virtual void close();
00124 
00130   virtual bool doReadEvent();
00132 
00136   string filename() const { return theFileName; }
00137 
00138 public:
00139 
00146   void persistentOutput(PersistentOStream & os) const;
00147 
00153   void persistentInput(PersistentIStream & is, int version);
00155 
00159   static void Init();
00160 
00161 protected:
00162 
00169   virtual IBPtr clone() const;
00170 
00175   virtual IBPtr fullclone() const;
00177 
00185   virtual void doinit();
00186 
00191   virtual bool preInitialize() const;
00192   //@
00193 
00194 protected:
00195 
00199   CFileLineReader cfile;
00200 
00201 protected:
00202 
00206   long neve;
00207 
00211   long ieve;
00212 
00218   string LHFVersion;
00219 
00224   string outsideBlock;
00225 
00229   string headerBlock;
00230 
00234   string initComments;
00235 
00240   map<string,string> initAttributes;
00241 
00245   string eventComments;
00246 
00251   map<string,string> eventAttributes;
00252 
00253 private:
00254 
00258   string theFileName;
00259 
00265   bool overSampling_;
00266 
00267 private:
00268 
00272   static ClassDescription<BasicLesHouchesFileReader> initBasicLesHouchesFileReader;
00273 
00277   BasicLesHouchesFileReader & operator=(const BasicLesHouchesFileReader &);
00278 
00279 public:
00280 
00284   class LesHouchesFileError: public Exception {};
00287 };
00288 
00289 }
00290 
00291 
00292 #include "ThePEG/Utilities/ClassTraits.h"
00293 
00294 namespace ThePEG {
00295 
00302 template <>
00303 struct BaseClassTrait<Herwig::BasicLesHouchesFileReader,1> {
00305   typedef LesHouchesReader NthBase;
00306 };
00307 
00313 template <>
00314 struct ClassTraits<Herwig::BasicLesHouchesFileReader>
00315   : public ClassTraitsBase<Herwig::BasicLesHouchesFileReader> {
00319   static string className() { return "Herwig::BasicLesHouchesFileReader"; }
00325   static string library() { return "BasicLesHouchesFileReader.so"; }
00326 
00327 };
00328 
00331 }
00332 
00333 #endif /* HERWIG_BasicLesHouchesFileReader_H */