00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_EventHandler_H
00010 #define ThePEG_EventHandler_H
00011
00012
00013 #include "ThePEG/Handlers/HandlerBase.h"
00014 #include "ThePEG/Handlers/HandlerGroup.h"
00015 #include "ThePEG/Handlers/StepHandler.h"
00016 #include "ThePEG/EventRecord/Event.h"
00017 #include "ThePEG/Handlers/LastXCombInfo.h"
00018 #include "ThePEG/Handlers/SubProcessHandler.fh"
00019 #include "ThePEG/Cuts/Cuts.fh"
00020 #include "EventHandler.fh"
00021
00022 namespace ThePEG {
00023
00063 class EventHandler: public HandlerBase, public LastXCombInfo<> {
00064
00065 public:
00066
00068 enum ConsistencyLevel {
00069 clNoCheck,
00070 clCollision,
00071 clStep,
00072 clPrintCollision,
00073 clPrintStep
00074 };
00075
00077 typedef vector<HandlerGroupBase *> GroupVector;
00078
00079 public:
00080
00086 EventHandler(bool warnincomplete = true);
00087
00091 EventHandler(const EventHandler &);
00092
00096 virtual ~EventHandler();
00098
00099 public:
00100
00107 virtual void initialize();
00108
00115 virtual EventPtr generateEvent();
00116
00122 tEventPtr generateEvent(tEventPtr e);
00123
00129 tEventPtr generateEvent(tStepPtr s);
00130
00135 virtual EventPtr continueEvent();
00136
00141 tCollPtr continueCollision();
00142
00146 void clearEvent();
00147
00152 virtual bool empty() const;
00153
00158 virtual void statistics(ostream &) const;
00159
00168 virtual CrossSection histogramScale() const;
00169
00177 virtual CrossSection integratedXSec() const;
00178
00186 virtual CrossSection integratedXSecErr() const;
00188
00195 long maxLoop() const { return theMaxLoop; }
00196
00201 const cPDPair & incoming() const { return theIncoming; }
00202
00206 const LuminosityFunction & lumiFn() const { return *theLumiFn; }
00207
00211 tcLumiFnPtr lumiFnPtr() const{ return theLumiFn; }
00212
00216 tLumiFnPtr lumiFnPtr(){ return theLumiFn; }
00217
00221 tCutsPtr cuts() const { return theCuts; }
00222
00227 tPExtrPtr partonExtractor() const { return thePartonExtractor; }
00228
00229
00234 tCascHdlPtr CKKWHandler() const;
00235
00239 tEventPtr currentEvent() const { return theCurrentEvent; }
00240
00244 tCollPtr currentCollision() const { return theCurrentCollision; }
00245
00249 tStepPtr currentStep() const { return theCurrentStep; }
00255 int statLevel() const { return theStatLevel; }
00256
00261 ConsistencyLevel consistencyLevel() const { return theConsistencyLevel; }
00262
00268 double consistencyEpsilon() const { return theConsistencyEpsilon; }
00269
00271
00278 void performStep(tStepHdlPtr handler, tHintPtr hint);
00279
00284 void addStep(Group::Level, Group::Handler,
00285 tStepHdlPtr = tStepHdlPtr(), tHintPtr = tHintPtr());
00286
00292 tStepPtr newStep(tcStepHdlPtr sh) {
00293 currentStep(currentCollision()->newStep(sh));
00294 return currentStep();
00295 }
00296
00300 void popStep() {
00301 currentCollision()->popStep();
00302 currentStep(currentCollision()->finalStep());
00303 }
00304
00308 virtual void initGroups();
00309
00313 void currentEvent(tEventPtr e) { theCurrentEvent = e; }
00314
00318 void currentCollision(tCollPtr c) { theCurrentCollision = c; }
00319
00323 void currentStep(tStepPtr s) { theCurrentStep = s; }
00324
00328 tStepHdlPtr currentStepHandler() const { return theCurrentStepHandler; }
00329
00333 void currentStepHandler(tStepHdlPtr sh) { theCurrentStepHandler = sh; }
00334
00338 void throwCurrent();
00339
00343 virtual void clean();
00344
00350 virtual void checkConsistency() const;
00351
00353
00354 public:
00355
00362 void persistentOutput(PersistentOStream & os) const;
00363
00369 void persistentInput(PersistentIStream & is, int version);
00371
00375 static void Init();
00376
00377 protected:
00378
00385 virtual IBPtr clone() const;
00386
00391 virtual IBPtr fullclone() const;
00393
00400 virtual void dofinish() {
00401 currentEvent(tEventPtr());
00402 currentCollision(tCollPtr());
00403 currentStep(tStepPtr());
00404 HandlerBase::dofinish();
00405 }
00406
00416 virtual void rebind(const TranslationMap & trans);
00417
00423 virtual IVector getReferences();
00425
00426
00427 protected:
00428
00432 LuminosityFunction & lumiFn() { return *theLumiFn; }
00433
00437 void setupGroups();
00438
00442 GroupVector & groups() { return theGroups; }
00443
00447 const GroupVector & groups() const { return theGroups; }
00448
00449
00450 protected:
00451
00455 void lumiFn(LumiFnPtr);
00456
00457 private:
00458
00463 long theMaxLoop;
00464
00469 int theStatLevel;
00470
00475 ConsistencyLevel theConsistencyLevel;
00476
00482 double theConsistencyEpsilon;
00483
00487 LumiFnPtr theLumiFn;
00488
00493 CutsPtr theCuts;
00494
00499 PExtrPtr thePartonExtractor;
00500
00504 HandlerGroup<SubProcessHandler> theSubprocessGroup;
00505
00509 HandlerGroup<CascadeHandler> theCascadeGroup;
00510
00514 HandlerGroup<MultipleInteractionHandler> theMultiGroup;
00515
00519 HandlerGroup<HadronizationHandler> theHadronizationGroup;
00520
00524 HandlerGroup<DecayHandler> theDecayGroup;
00525
00529 GroupVector theGroups;
00530
00534 EventPtr theCurrentEvent;
00535
00539 CollPtr theCurrentCollision;
00540
00544 StepPtr theCurrentStep;
00545
00549 StepHdlPtr theCurrentStepHandler;
00550
00551 protected:
00552
00556 HandlerGroup<SubProcessHandler> optSubprocessGroup;
00557
00561 HandlerGroup<CascadeHandler> optCascadeGroup;
00562
00566 HandlerGroup<MultipleInteractionHandler> optMultiGroup;
00567
00571 HandlerGroup<HadronizationHandler> optHadronizationGroup;
00572
00576 HandlerGroup<DecayHandler> optDecayGroup;
00577
00578 protected:
00579
00583 GroupVector optGroups;
00584
00585 protected:
00586
00590 bool warnIncomplete;
00591
00596 cPDPair theIncoming;
00597
00598 protected:
00599
00605 class EventHandlerStepError: public Exception {};
00606
00611 class EventHandlerHistError: public Exception {};
00612
00617 class EventHandlerIncompleteError: public Exception {};
00618
00621 struct EventLoopException: public Exception {
00623 EventLoopException(const EventHandler &);
00624 };
00625
00630 struct LumiFuncError: public Exception {};
00631
00635 struct ConsistencyException: public Exception {};
00636
00639 private:
00640
00641 ThePEG_DECLARE_PREPOST_GROUP(SubProcessHandler,Post);
00642 ThePEG_DECLARE_GROUPINTERFACE(CascadeHandler,CascHdlPtr);
00643 ThePEG_DECLARE_GROUPINTERFACE(MultipleInteractionHandler,MIHdlPtr);
00644 ThePEG_DECLARE_GROUPINTERFACE(HadronizationHandler,HadrHdlPtr);
00645 ThePEG_DECLARE_GROUPINTERFACE(DecayHandler,DecayHdlPtr);
00646
00647 ThePEG_DECLARE_CLASS_DESCRIPTION(EventHandler);
00648
00652 EventHandler & operator=(const EventHandler &);
00653
00654 };
00655
00657 ThePEG_DECLARE_CLASS_TRAITS(EventHandler,HandlerBase);
00660 }
00661
00662 #endif