thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
LesHouchesEventHandler.h
1// -*- C++ -*-
2//
3// LesHouchesEventHandler.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_LesHouchesEventHandler_H
10#define THEPEG_LesHouchesEventHandler_H
11//
12// This is the declaration of the LesHouchesEventHandler class.
13//
14
15#include "ThePEG/Handlers/EventHandler.h"
16#include "LesHouchesEventHandler.fh"
17#include "LesHouchesReader.fh"
18#include "ThePEG/Utilities/CompSelector.h"
19#include "ThePEG/Utilities/XSecStat.h"
20
21namespace ThePEG {
22
23
42
43public:
44
48 typedef vector<LesHouchesReaderPtr> ReaderVector;
49
54
58 enum WeightOpt {
62 varnegweight = -2
63 };
64
65public:
66
75 {
77 }
78
84
85public:
86
93 virtual void initialize();
94
99 virtual void statistics(ostream &) const;
100
107
114
119 virtual int ntriesinternal() const;
120
127
132 virtual const map<string,CrossSection> & optintegratedXSecMap() const;
133
135
142
148
155
164 void select(double weight);
165
170 void accept();
171
176 void reject(double weight);
177
182
188
190
197
202 double unitTolerance() const { return theUnitTolerance; }
203
207 const ReaderVector & readers() const { return theReaders; }
208
213 const ReaderSelector & selector() const { return theSelector; }
214
218 tLesHouchesReaderPtr currentReader() const { return theCurrentReader; }
219
220
224 void currentReader(tLesHouchesReaderPtr x) { theCurrentReader = x; }
225
227
228public:
229
237
243 void persistentInput(PersistentIStream & is, int version);
245
252 static void Init();
253
257 tLesHouchesReaderPtr theCurrentReader;
258
259protected:
260
267 virtual IBPtr clone() const;
268
273 virtual IBPtr fullclone() const;
275
276protected:
277
285 virtual void doinit();
286
291 virtual void doinitrun();
292
297 virtual void dofinish();
299
300protected:
301
306
312
316 void setUnitTolerance(double);
317
322
328
333 vector<string> weightnames;
334
338 struct OptWeight {
339
344
349
355 };
356
358 map <string,OptWeight> opt;
359
365
370 const map<string,OptWeight> & optWeights() const { return opt; }
371
372private:
373
378
384
389
395
396
402
406 unsigned int theNormWeight;
407
411 unsigned int UseLHEEvent;
412
413public:
414
419 class LesHouchesInitError: public InitException {};
420
425 class LesHouchesPNumException: public InitException {};
428private:
429
435
441
442};
443
444}
445
446// CLASSDOC OFF
447
448#include "ThePEG/Utilities/ClassTraits.h"
449
450namespace ThePEG {
451
456template <>
457struct BaseClassTrait<LesHouchesEventHandler,1> {
459 typedef EventHandler NthBase;
460};
461
464template <>
465struct ClassTraits<LesHouchesEventHandler>
466 : public ClassTraitsBase<LesHouchesEventHandler> {
468 static string className() { return "ThePEG::LesHouchesEventHandler"; }
472 static string library() { return "LesHouches.so"; }
473};
474
477}
478
479#endif /* THEPEG_LesHouchesEventHandler_H */
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
The CompSelector class works like the Selector class in that it can be used to randomly select object...
Definition: CompSelector.h:47
void tolerance(double t)
Set the tolerance for how much a weight is allowed to be larger than unity before starting the compen...
Definition: CompSelector.h:166
The EventHandler is the base class used to implement event handlers in ThePEG.
Definition: EventHandler.h:63
The LesHouchesEventHandler inherits from the general EventHandler class and administers the reading o...
void skipEvents()
Skip some events.
static ClassDescription< LesHouchesEventHandler > initLesHouchesEventHandler
The static object used to initialize the description of this class.
vector< string > weightnames
The weight identifiers for the events.
WeightOpt weightOption() const
The way weights are to be treated.
virtual CrossSection histogramScale() const
Histogram scale.
unsigned int UseLHEEvent
How to number the events.
unsigned int theNormWeight
How to normalize the weights.
virtual void statistics(ostream &) const
Write out accumulated statistics about intergrated cross sections and stuff.
ReaderVector & readers()
Access the list of readers.
void currentReader(tLesHouchesReaderPtr x)
Set the currently selected reader object.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
const ReaderSelector & selector() const
The selector to choose readers according to their overestimated cross section.
virtual const map< string, CrossSection > & optintegratedXSecMap() const
Map to aid the calculation of the optional weights' integrated cross section.
virtual tCollPtr performCollision()
Create the Event and Collision objects.
ReaderSelector theSelector
The selector to choose readers according to their overestimated cross section.
LesHouchesEventHandler()
The default constructor.
virtual ~LesHouchesEventHandler()
The destructor.
void accept()
Accept the current event, taking care of the statistics collection of the corresponding reader object...
double unitTolerance() const
If the weight option is set to unit weight, do not start compensating unless the weight is this much ...
LesHouchesEventHandler & operator=(const LesHouchesEventHandler &)=delete
The assignment operator is private and must never be called.
virtual CrossSection integratedXSec() const
The estimated total integrated cross section of the processes generated in this run.
void select(double weight)
An event has been selected.
WeightOpt theWeightOption
The way weights are to be treated.
map< string, OptWeight > opt
Map statistics to weight name strings.
vector< LesHouchesReaderPtr > ReaderVector
A vector of LesHouchesReader objects.
virtual EventPtr generateEvent()
Generate an event.
virtual EventPtr continueEvent()
Continue generating an event if the generation has been stopped before finishing.
tLesHouchesReaderPtr currentReader() const
The currently selected reader object.
ReaderSelector & selector()
The selector to choose readers according to their overestimated cross section.
ReaderVector theReaders
The list of readers.
void increaseMaxXSec(CrossSection maxxsec)
Increase the overestimated cross section for the selected reader.
CompSelector< int, CrossSection > ReaderSelector
A selector of readers.
static void Init()
The standard Init function used to initialize the interfaces.
XSecStat histStats
Collect statistics for this event handler.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual void dofinish()
Finalize this object.
virtual int ntriesinternal() const
The number of attempts inside the statistics object.
virtual CrossSection integratedXSecErr() const
The estimated error in the total integrated cross section of the processes generated in this run.
double theUnitTolerance
If the weight option is set to unit weight, do not start compensating unless the weight is this much ...
virtual void doinitrun()
Initialize this object.
WeightOpt
Enumerate the weighting options.
@ unitnegweight
All events have wight +/- 1.
@ varweight
Varying positive weights.
@ varnegweight
Varying positive or negative weights.
@ unitweight
All events have unit weight.
const ReaderVector & readers() const
Access the list of readers.
void reject(double weight)
Reject the current event, taking care of the statistics collection of the corresponding reader object...
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
bool warnPNum
Warn if the same process number is used in more than one LesHouchesReader.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
virtual void initialize()
Initialize this event handler and all related objects needed to generate events.
tLesHouchesReaderPtr theCurrentReader
The currently selected reader object.
int ntries
Counter for the number of tries for the purpose of statistics.
XSecStat stats
Collect statistics for this event handler.
void setUnitTolerance(double)
Helper function for the interface;.
virtual IBPtr clone() const
Make a simple clone of this object.
const map< string, OptWeight > & optWeights() const
Return the optional weights' statistics.
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
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
XSecStat is a concrete helper class used to collect statistics about the cross section for a specific...
Definition: XSecStat.h:36
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
static string library()
The name of a file containing the dynamic library where the class T is implemented.
Definition: ClassTraits.h:85
Collect statistics for this event handler's optional weights.
XSecStat stats
Collect statistics for the optional weights.
XSecStat histStats
Collect statistics for this event handler's optional weights.
CrossSection xs
Calculate the cross section for the optional weights.