00001 // -*- C++ -*- 00002 // 00003 // StepHandler.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_StepHandler_H 00010 #define ThePEG_StepHandler_H 00011 // This is the declaration of the StepHandler class. 00012 00013 #include "ThePEG/Config/ThePEG.h" 00014 #include "ThePEG/Utilities/Exception.fh" 00015 #include "ThePEG/Handlers/HandlerBase.h" 00016 #include <stdexcept> 00017 00018 namespace ThePEG { 00019 00041 class StepHandler: public HandlerBase { 00042 00043 public: 00044 00050 virtual ~StepHandler(); 00052 00053 public: 00054 00071 virtual void handle(EventHandler & eh, const tPVector & tagged, 00072 const Hint & hint) = 0; 00074 00081 tEHPtr eventHandler() const { return theEventHandler; } 00082 00087 void eventHandler(tEHPtr); 00088 00093 tStepPtr newStep() { 00094 if ( !theNewStep ) createNewStep(); 00095 return theNewStep; 00096 } 00097 00102 tStepPtr currentStep() { 00103 if ( theNewStep ) return theNewStep; 00104 return theCurrentStep; 00105 } 00107 00108 public: 00109 00113 static void Init(); 00114 00115 protected: 00116 00120 void createNewStep(); 00121 00122 private: 00123 00128 tEHPtr theEventHandler; 00129 00133 tStepPtr theNewStep; 00134 00139 tStepPtr theCurrentStep; 00140 00141 private: 00142 00146 static AbstractNoPIOClassDescription<StepHandler> initStepHandler; 00147 00151 StepHandler & operator=(const StepHandler &); 00152 00153 }; 00154 00161 template <> 00162 struct BaseClassTrait<StepHandler,1>: public ClassTraitsType { 00164 typedef HandlerBase NthBase; 00165 }; 00166 00171 template <> 00172 struct ClassTraits<StepHandler>: public ClassTraitsBase<StepHandler> { 00174 static string className() { return "ThePEG::StepHandler"; } 00175 }; 00176 00179 } 00180 00181 #endif /* ThePEG_StepHandler_H */