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