ThePEG  1.8.0
EventHandler.h
1 // -*- C++ -*-
2 //
3 // EventHandler.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_EventHandler_H
10 #define ThePEG_EventHandler_H
11 // This is the declaration of the EventHandler class.
12 
13 #include "ThePEG/Handlers/HandlerBase.h"
14 #include "ThePEG/Handlers/HandlerGroup.h"
15 #include "ThePEG/Handlers/StepHandler.h"
16 #include "ThePEG/EventRecord/Event.h"
17 #include "ThePEG/Handlers/LastXCombInfo.h"
18 #include "ThePEG/Handlers/SubProcessHandler.fh"
19 #include "ThePEG/Cuts/Cuts.fh"
20 #include "EventHandler.fh"
21 
22 namespace ThePEG {
23 
63 class EventHandler: public HandlerBase, public LastXCombInfo<> {
64 
65 public:
66 
74  };
75 
77  typedef vector<HandlerGroupBase *> GroupVector;
78 
79 public:
80 
86  EventHandler(bool warnincomplete = true);
87 
91  EventHandler(const EventHandler &);
92 
96  virtual ~EventHandler();
98 
99 public:
100 
107  virtual void initialize();
108 
115  virtual EventPtr generateEvent();
116 
123 
130 
135  virtual EventPtr continueEvent();
136 
142 
146  void clearEvent();
147 
151  virtual void select(tXCombPtr newXComb);
152 
157  virtual bool empty() const;
158 
163  virtual void statistics(ostream &) const;
164 
173  virtual CrossSection histogramScale() const;
174 
182  virtual CrossSection integratedXSec() const;
183 
191  virtual CrossSection integratedXSecErr() const;
193 
200  long maxLoop() const { return theMaxLoop; }
201 
206  const cPDPair & incoming() const { return theIncoming; }
207 
211  const LuminosityFunction & lumiFn() const { return *theLumiFn; }
212 
216  tcLumiFnPtr lumiFnPtr() const{ return theLumiFn; }
217 
222 
226  tCutsPtr cuts() const { return theCuts; }
227 
233 
234 
239  tCascHdlPtr CKKWHandler() const;
240 
245 
250 
254  tStepPtr currentStep() const { return theCurrentStep; }
260  int statLevel() const { return theStatLevel; }
261 
267 
273  double consistencyEpsilon() const { return theConsistencyEpsilon; }
274 
276 
283  void performStep(tStepHdlPtr handler, tHintPtr hint);
284 
291 
299  return currentStep();
300  }
301 
305  void popStep() {
306  currentCollision()->popStep();
307  currentStep(currentCollision()->finalStep());
308  }
309 
313  virtual void initGroups();
314 
319 
324 
329 
334 
339 
343  void throwCurrent();
344 
348  virtual void clean();
349 
355  virtual void checkConsistency() const;
356 
358 
359 public:
360 
367  void persistentOutput(PersistentOStream & os) const;
368 
374  void persistentInput(PersistentIStream & is, int version);
376 
380  static void Init();
381 
382 protected:
383 
390  virtual IBPtr clone() const;
391 
396  virtual IBPtr fullclone() const;
398 
405  virtual void dofinish() {
410  }
411 
421  virtual void rebind(const TranslationMap & trans);
422 
428  virtual IVector getReferences();
430 
431 
432 protected:
433 
438 
442  void setupGroups();
443 
447  GroupVector & groups() { return theGroups; }
448 
452  const GroupVector & groups() const { return theGroups; }
453 
454 
455 protected:
456 
460  void lumiFn(LumiFnPtr);
461 
462 private:
463 
469 
475 
481 
488 
493 
499 
505 
510 
515 
520 
525 
530 
535 
540 
545 
550 
555 
556 protected:
557 
562 
567 
572 
577 
582 
583 protected:
584 
589 
590 protected:
591 
596 
602 
603 protected:
604 
610  class EventHandlerStepError: public Exception {};
611 
616  class EventHandlerHistError: public Exception {};
617 
622  class EventHandlerIncompleteError: public Exception {};
623 
626  struct EventLoopException: public Exception {
628  EventLoopException(const EventHandler &);
629  };
630 
635  struct LumiFuncError: public Exception {};
636 
640  struct ConsistencyException: public Exception {};
641 
644 private:
645 
646  ThePEG_DECLARE_PREPOST_GROUP(SubProcessHandler,Post);
647  ThePEG_DECLARE_GROUPINTERFACE(CascadeHandler,CascHdlPtr);
648  ThePEG_DECLARE_GROUPINTERFACE(MultipleInteractionHandler,MIHdlPtr);
649  ThePEG_DECLARE_GROUPINTERFACE(HadronizationHandler,HadrHdlPtr);
650  ThePEG_DECLARE_GROUPINTERFACE(DecayHandler,DecayHdlPtr);
651 
652  ThePEG_DECLARE_CLASS_DESCRIPTION(EventHandler);
653 
658 
659 };
660 
662 ThePEG_DECLARE_CLASS_TRAITS(EventHandler,HandlerBase);
665 }
666 
667 #endif /* ThePEG_EventHandler_H */