00001 // $Id: BaseApp.h,v 1.1 2000/09/01 20:25:11 burnett Exp $ 00002 // 00003 // BaseApp.h, a part of the Gismo project 00004 // 00005 // This defines BaseApp, the base class for Gismo applications. To use, one 00006 // must specify a World, and a Generator. There are no default interactions, which 00007 // must be added (before creating the World!) by addInteractor 00008 00009 #ifndef __BaseApp_H 00010 #define __BaseApp_H 00011 00012 #include "gismo/World.h" 00013 #include "gismo/Generator.h" 00014 #include "gismo/Interactor.h" 00015 #include "gismo/Material.h" 00016 #include "gismo/Detector.h" 00017 #include "facilities/error.h" 00018 00019 #ifdef HAVE_NAMESPACE_STD 00020 using std::ostream; 00021 using std::cout; 00022 #endif 00023 00024 class BaseApp 00025 { 00026 public: 00027 00028 BaseApp(); 00029 virtual ~BaseApp(); 00030 // constructor, destructor 00031 00032 BaseApp& addInteractor(Interactor*); 00033 // add an (optional) interactor 00034 00035 BaseApp& setWorld(World* w); 00036 // define the known world 00037 00038 BaseApp& setGenerator( Generator* g); 00039 // specify an event genertory 00040 00041 00042 World& world(); 00043 Generator& generator(); 00044 // the known world, a box containing the detector, and the current Generator 00045 // use of these is an error if the pointer is zero 00046 00047 BaseApp& setBeam(const char* name, const Vector& p, const Point& r); 00048 // define a monochromatic beam 00049 00050 const char * run(unsigned long events=1); 00051 // call trigger for event 00052 00053 void stop(); 00054 // will stop a run 00055 00056 00057 unsigned long eventNumber; 00058 // number of current event 00059 00060 const char * trigger(); 00061 // trigger a MC event 00062 00063 virtual void endEvent(){}; 00064 // (user) processing at end of an event 00065 00066 virtual void beginEvent(){}; 00067 // (user) processing before a trigger 00068 00069 void clearResponse(){if(_world) _world->clear();} 00070 // remove response of detectors 00071 00072 void clearEvent(); 00073 // clear out the current event & tracks 00074 00075 void printEvent(std::ostream& = std::cout); 00076 void printPDT(std::ostream& = std::cout); 00077 void printMaterials(std::ostream& = std::cout); 00078 void printResponse(std::ostream& = std::cout); 00079 void printDetector(std::ostream& = std::cout); 00080 // printout the various things 00081 00082 private: 00083 World* _world; 00084 Generator* _generator; 00085 00086 00087 }; 00088 00089 #endif 00090
1.2.3 written by Dimitri van Heesch,
© 1997-2000