thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
EventHandler.h
1// -*- C++ -*-
2//
3// EventHandler.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 Leif Lonnblad
5//
6// ThePEG is licenced under version 3 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
22namespace ThePEG {
23
63class EventHandler: public HandlerBase, public LastXCombInfo<> {
64
65public:
66
74 };
75
77 typedef vector<HandlerGroupBase *> GroupVector;
78
79public:
80
86 EventHandler(bool warnincomplete = true);
87
92
96 virtual ~EventHandler();
98
99public:
100
107 virtual void initialize();
108
116
123
130
136
142
147
151 virtual void select(tXCombPtr newXComb);
152
157 virtual bool empty() const;
158
163 virtual void statistics(ostream &) const;
164
174
183
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
239
245
250
255
260
264 bool weighted() const { return weightedEvents; }
265
271 int statLevel() const { return theStatLevel; }
272
278
284 double consistencyEpsilon() const { return theConsistencyEpsilon; }
285
287
294 void performStep(tStepHdlPtr handler, tHintPtr hint);
295
302
310 return currentStep();
311 }
312
316 void popStep() {
317 currentCollision()->popStep();
318 currentStep(currentCollision()->finalStep());
319 }
320
324 virtual void initGroups();
325
330
335
340
345
350
355
359 virtual void clean();
360
366 virtual void checkConsistency() const;
367
369
370public:
371
379
385 void persistentInput(PersistentIStream & is, int version);
387
391 static void Init();
392
393protected:
394
401 virtual IBPtr clone() const;
402
407 virtual IBPtr fullclone() const;
409
416 virtual void dofinish() {
417 clean();
419 }
420
430 virtual void rebind(const TranslationMap & trans);
431
439
440
441protected:
442
447
452
457
461 const GroupVector & groups() const { return theGroups; }
462
463
464protected:
465
470
471private:
472
478
483
489
495
502
507
512 CutsPtr theCuts;
513
519
524
529
534
539
544
549
554
559
564
569
570protected:
571
576
581
586
591
596
597protected:
598
603
604protected:
605
610
616
617protected:
618
624 class EventHandlerStepError: public Exception {};
625
630 class EventHandlerHistError: public Exception {};
631
636 class EventHandlerIncompleteError: public Exception {};
637
640 struct EventLoopException: public Exception {
642 EventLoopException(const EventHandler &);
643 };
644
649 struct LumiFuncError: public Exception {};
650
654 struct ConsistencyException: public Exception {};
655
658private:
659
660 ThePEG_DECLARE_PREPOST_GROUP(SubProcessHandler,Post);
661 ThePEG_DECLARE_GROUPINTERFACE(CascadeHandler,CascHdlPtr);
662 ThePEG_DECLARE_GROUPINTERFACE(MultipleInteractionHandler,MIHdlPtr);
663 ThePEG_DECLARE_GROUPINTERFACE(HadronizationHandler,HadrHdlPtr);
664 ThePEG_DECLARE_GROUPINTERFACE(DecayHandler,DecayHdlPtr);
665
666 ThePEG_DECLARE_CLASS_DESCRIPTION(EventHandler);
667
672
673};
674
676ThePEG_DECLARE_CLASS_TRAITS(EventHandler,HandlerBase);
679}
680
681#endif /* ThePEG_EventHandler_H */
The CascadeHandler is the base class of all handlers implementing perturbative partonic cascade model...
The DecayHandler is the base class of all handlers implementing the administration of decays of unsta...
Definition: DecayHandler.h:31
The EventHandler is the base class used to implement event handlers in ThePEG.
Definition: EventHandler.h:63
ConsistencyLevel theConsistencyLevel
Determines how often the event handler should check for charge and energy-momentum conservation.
Definition: EventHandler.h:494
tStepPtr currentStep() const
Get current step.
Definition: EventHandler.h:259
void throwCurrent()
Throw away the current event/collision.
virtual bool empty() const
Returns true if there are no step handlers left to apply to the current event;.
virtual CrossSection integratedXSec() const
The total integrated cross section of the processes generated in this run.
HandlerGroup< DecayHandler > optDecayGroup
Utility object to facilitate default selection of step handlers.
Definition: EventHandler.h:595
StepHdlPtr theCurrentStepHandler
The current StepHandler.
Definition: EventHandler.h:568
virtual EventPtr continueEvent()
Continue generating an event if the generation has been stopped before finishing.
GroupVector optGroups
Utility object to facilitate default selection of step handlers.
Definition: EventHandler.h:602
double theConsistencyEpsilon
The maximum fraction of the total invariant mass of a collision that any of the components of the sum...
Definition: EventHandler.h:501
virtual ~EventHandler()
Destructor.
static void Init()
Standard Init function used to initialize the interface.
HandlerGroup< HadronizationHandler > theHadronizationGroup
The HadronizationHandler group.
Definition: EventHandler.h:538
void addStep(Group::Level, Group::Handler, tStepHdlPtr=tStepHdlPtr(), tHintPtr=tHintPtr())
In the curresnt list of step handlers to go through, add another step handler and/or hint.
virtual void clean()
Throw away the last generated event before generating a new one.
void lumiFn(LumiFnPtr)
Set the luminosity function.
void popStep()
Remove the last step.
Definition: EventHandler.h:316
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
tCutsPtr cuts() const
The kinematical cuts to used by subclasses which do not provide their own.
Definition: EventHandler.h:226
int statLevel() const
The level of statistics.
Definition: EventHandler.h:271
virtual void initGroups()
Initialize the groups of step handlers.
cPDPair theIncoming
The pair of incoming particle types.
Definition: EventHandler.h:615
void currentStep(tStepPtr s)
Set current step.
Definition: EventHandler.h:339
tCascHdlPtr CKKWHandler() const
Return a pointer (possibly null) to the assigned main CascadeHandler to be used as CKKW-reweighter.
Definition: EventHandler.h:244
virtual void rebind(const TranslationMap &trans)
Rebind pointer to other Interfaced objects.
virtual void dofinish()
Finalize this object.
Definition: EventHandler.h:416
HandlerGroup< CascadeHandler > optCascadeGroup
Utility object to facilitate default selection of step handlers.
Definition: EventHandler.h:580
GroupVector theGroups
The step handler groups.
Definition: EventHandler.h:548
LuminosityFunction & lumiFn()
Access to the luminosity function.
Definition: EventHandler.h:446
bool weightedEvents
True if this event handler should produce weightes events.
Definition: EventHandler.h:482
tCollPtr continueCollision()
Continue the generation of a Collision.
virtual EventPtr generateEvent()
Generate an event.
HandlerGroup< SubProcessHandler > theSubprocessGroup
The SubProcessHandler group.
Definition: EventHandler.h:523
StepPtr theCurrentStep
The current Step.
Definition: EventHandler.h:563
virtual void checkConsistency() const
Check that the charge and energy-momentum in the last step of the current collision is consistent wit...
void currentEvent(tEventPtr e)
Set current event.
Definition: EventHandler.h:329
virtual void initialize()
Initialize this event handler and all related objects needed to generate events.
bool weighted() const
Return true if this event handler should produce weightes events.
Definition: EventHandler.h:264
long maxLoop() const
Return the maximum number attemts allowed to select a sub-process for each event.
Definition: EventHandler.h:200
void currentStepHandler(tStepHdlPtr sh)
Set current StepHandler.
Definition: EventHandler.h:349
virtual void statistics(ostream &) const
Write out accumulated statistics about intergrated cross sections and stuff.
const GroupVector & groups() const
Access the step handler groups.
Definition: EventHandler.h:461
long theMaxLoop
The maximum number of attempts to select a sub-process allowed per event.
Definition: EventHandler.h:477
virtual CrossSection histogramScale() const
Histogram scale.
virtual CrossSection integratedXSecErr() const
The estimated error in the total integrated cross section of the processes generated in this run.
double consistencyEpsilon() const
The maximum fraction of the total invariant mass of a collision that any of the components of the sum...
Definition: EventHandler.h:284
tStepPtr newStep(tcStepHdlPtr sh)
Create a new step and make it current.
Definition: EventHandler.h:308
tLumiFnPtr lumiFnPtr()
Access to the luminosity function.
Definition: EventHandler.h:221
CollPtr theCurrentCollision
The current Collision.
Definition: EventHandler.h:558
const LuminosityFunction & lumiFn() const
Access the luminosity function.
Definition: EventHandler.h:211
void clearEvent()
Clear all step handlers, making the handler ready for a new event.
bool warnIncomplete
Emit warning that this EventHandler is incomplete.
Definition: EventHandler.h:609
virtual IBPtr clone() const
Make a simple clone of this object.
void currentCollision(tCollPtr c)
Set current collision.
Definition: EventHandler.h:334
int theStatLevel
Controlls the amount of statistics written out after each run to the EventGenerators ....
Definition: EventHandler.h:488
EventHandler(bool warnincomplete=true)
Default constructor.
tCollPtr currentCollision() const
Get current collision.
Definition: EventHandler.h:254
CutsPtr theCuts
The kinematical cuts to used by subclasses which do not provide their own.
Definition: EventHandler.h:512
tEventPtr currentEvent() const
Gget current event.
Definition: EventHandler.h:249
HandlerGroup< HadronizationHandler > optHadronizationGroup
Utility object to facilitate default selection of step handlers.
Definition: EventHandler.h:590
virtual void select(tXCombPtr newXComb)
Change the XComb object.
tStepHdlPtr currentStepHandler() const
Get current StepHandler.
Definition: EventHandler.h:344
tcLumiFnPtr lumiFnPtr() const
Access the luminosity function.
Definition: EventHandler.h:216
tCascHdlPtr cascadeHandler() const
Return a pointer (possibly null) to the assigned main CascadeHandler.
virtual IVector getReferences()
Return a vector of all pointers to Interfaced objects used in this object.
ConsistencyLevel consistencyLevel() const
Determines how often the event handler should check for charge and energy-momentum conservation.
Definition: EventHandler.h:277
HandlerGroup< CascadeHandler > theCascadeGroup
The CascadeHandler group.
Definition: EventHandler.h:528
void performStep(tStepHdlPtr handler, tHintPtr hint)
Perform a given step using a handler and a hint.
HandlerGroup< SubProcessHandler > optSubprocessGroup
Utility object to facilitate default selection of step handlers.
Definition: EventHandler.h:575
PExtrPtr thePartonExtractor
A PartonExtractor object to be used by sub classes which do not provide their own.
Definition: EventHandler.h:518
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
LumiFnPtr theLumiFn
Pointer to a luminosity function tobe used by subclasses.
Definition: EventHandler.h:506
tPExtrPtr partonExtractor() const
A PartonExtractor object to be used by sub classes which do not provide their own.
Definition: EventHandler.h:232
HandlerGroup< MultipleInteractionHandler > optMultiGroup
Utility object to facilitate default selection of step handlers.
Definition: EventHandler.h:585
tEventPtr generateEvent(tEventPtr e)
Generate an Event, where the initial state is supplied from the outside.
GroupVector & groups()
Access the step handler groups.
Definition: EventHandler.h:456
tEventPtr generateEvent(tStepPtr s)
Generate an Event, where the initial state is supplied as a single step from the outside.
EventHandler(const EventHandler &)
Copy-constructor.
HandlerGroup< DecayHandler > theDecayGroup
The DecayHandler group.
Definition: EventHandler.h:543
ConsistencyLevel
Enumerate the different levels of consistency checking.
Definition: EventHandler.h:68
@ clStep
Check every Step.
Definition: EventHandler.h:71
@ clCollision
Check every Collision.
Definition: EventHandler.h:70
@ clPrintStep
Check every Step.
Definition: EventHandler.h:73
@ clPrintCollision
Check every Collision.
Definition: EventHandler.h:72
@ clNoCheck
Do not perform consistency checks.
Definition: EventHandler.h:69
void setupGroups()
Setup the step handler groups.
EventHandler & operator=(const EventHandler &)=delete
Private and non-existent assignment operator.
HandlerGroup< MultipleInteractionHandler > theMultiGroup
The MultipleInteractionHandler group.
Definition: EventHandler.h:533
const cPDPair & incoming() const
The pair of incoming particle types.
Definition: EventHandler.h:206
EventPtr theCurrentEvent
The current Event.
Definition: EventHandler.h:553
vector< HandlerGroupBase * > GroupVector
A vector of HandlerGroups.
Definition: EventHandler.h:77
Exception is the base class for all exceptions to be used in ThePEG.
Definition: Exception.h:44
The HadronizationHandler is the base class of all handlers implementing models for hadronization of c...
HandlerBase is an abstract base class derived from the Interfaced class via the HandlerBaseT class ad...
Definition: HandlerBase.h:151
HandlerGroup is a templated utility class to manage a group of StepHandlers.
Definition: HandlerGroup.h:321
virtual void dofinish()
Finalize this object.
LastXCombInfo is a templated class giving easy access to the information in an XComb object.
Definition: LastXCombInfo.h:32
The LuminosityFunction describes the momentum distribution of the incoming beams in an experiment.
The MultipleInteractionHandler is the base class of all handlers implementing models for multiple int...
PersistentIStream is used to read persistent objects from a stream where they were previously written...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
Rebinder is a class associating pairs of pointers to objects.
Definition: Rebinder.h:27
The SubProcessHandler class is used to handle a set of MEBase objects together with a PartonExtractor...
Handler
Enumeration for the type of HandlerGroups.
Definition: HandlerGroup.h:433
Level
Enumeration for the type of step handler.
Definition: HandlerGroup.h:442
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
pair< cPDPtr, cPDPtr > cPDPair
A pair of pointers to const ParticleData objects.
Definition: Containers.h:118
ThePEG::Ptr< Hint >::transient_pointer tHintPtr
Alias for a transient pointer to Hint .
Definition: Pointers.h:71
ThePEG::Ptr< StepHandler >::transient_pointer tStepHdlPtr
Alias for a transient pointer to StepHandler .
Definition: Pointers.h:70
vector< IBPtr > IVector
A vector of pointers to InterfacedBase objects.
Definition: Containers.h:67