herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
FxFxEventHandler.h
1// -*- C++ -*-
2//
3// FxFxEventHandler.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_FxFxEventHandler_H
10#define THEPEG_FxFxEventHandler_H
11//
12// This is the declaration of the FxFxEventHandler class.
13//
14
15#include "ThePEG/Handlers/EventHandler.h"
16#include "FxFxEventHandler.fh"
17#include "FxFxReader.fh"
18#include "ThePEG/Utilities/CompSelector.h"
19#include "ThePEG/Utilities/XSecStat.h"
20
21namespace ThePEG {
22
41
42public:
43
47 typedef vector<FxFxReaderPtr> ReaderVector;
48
53
57 enum WeightOpt {
61 varnegweight = -2
62 };
63
64 friend class FxFxHandler;
65
66
67public:
68
74 {
76 }
77
78public:
79
86 virtual void initialize();
87
92 virtual void statistics(ostream &) const;
93
99 virtual CrossSection histogramScale() const;
100
106 virtual CrossSection integratedXSec() const;
107
108 virtual int ntriesinternal() const;
109
115 virtual CrossSection integratedXSecErr() const;
116
117 virtual map<string,CrossSection> optintegratedXSecMap() const;
118
120
127
133
140
149 void select(double weight);
150
155 void accept();
156
161 void reject(double weight);
162
166 void increaseMaxXSec(CrossSection maxxsec);
167
173
175
182
187 double unitTolerance() const { return theUnitTolerance; }
188
192 const ReaderVector & readers() const { return theReaders; }
193
198 const ReaderSelector & selector() const { return theSelector; }
199
203 tFxFxReaderPtr currentReader() const { return theCurrentReader; }
204
205
209 void currentReader(tFxFxReaderPtr x) { theCurrentReader = x; }
210
212
213public:
214
222
228 void persistentInput(PersistentIStream & is, int version);
230
237 static void Init();
238
242 tFxFxReaderPtr theCurrentReader;
243
244
245
246protected:
247
254 virtual IBPtr clone() const;
255
260 virtual IBPtr fullclone() const;
262
263protected:
264
272 virtual void doinit();
273
278 virtual void doinitrun();
279
284 virtual void dofinish();
286
287protected:
288
293
299
303 void setUnitTolerance(double);
304
309
310 map<string,XSecStat> optstats;
311
312 map<string,CrossSection> optxs;
313
314 int ntries;
315
316 map<string,XSecStat> OptStatsFunc() { return optstats; }
317
318 map<string,CrossSection> OptXsFunc() { return optxs; }
319
320
326
327 map<string,XSecStat> opthistStats;
328
329
330 /*
331 * The weight identifiers for the events
332 */
333
334 vector<string> weightnames;
335
336private:
337
342
348
353
359
360
366
370 unsigned int theNormWeight;
371
375 unsigned int UseLHEEvent;
376
377
378public:
379
384 class FxFxInitError: public InitException {};
385
390 class FxFxPNumException: public InitException {};
393private:
394
400
406
407};
408
409}
410
411// CLASSDOC OFF
412
413#include "ThePEG/Utilities/ClassTraits.h"
414
415namespace ThePEG {
416
421template <>
422struct BaseClassTrait<FxFxEventHandler,1> {
424 typedef EventHandler NthBase;
425};
426
429template <>
430struct ClassTraits<FxFxEventHandler>
431 : public ClassTraitsBase<FxFxEventHandler> {
433 static string className() { return "Herwig::FxFxEventHandler"; }
437 static string library() { return "HwFxFx.so"; }
438};
439
442}
443
444#endif /* THEPEG_FxFxEventHandler_H */
void tolerance(double t)
The FxFxEventHandler inherits from the general EventHandler class and administers the reading of even...
virtual void statistics(ostream &) const
Write out accumulated statistics about intergrated cross sections and stuff.
unsigned int UseLHEEvent
How to number the events.
double unitTolerance() const
If the weight option is set to unit weight, do not start compensating unless the weight is this much ...
void currentReader(tFxFxReaderPtr x)
Set the currently selected reader object.
void select(double weight)
An event has been selected.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
void increaseMaxXSec(CrossSection maxxsec)
Increase the overestimated cross section for the selected reader.
XSecStat stats
Collect statistics for this event handler.
virtual CrossSection histogramScale() const
Histogram scale.
WeightOpt
Enumerate the weighting options.
@ unitweight
All events have unit weight.
@ varweight
Varying positive weights.
@ unitnegweight
All events have wight +/- 1.
@ varnegweight
Varying positive or negative weights.
static void Init()
The standard Init function used to initialize the interfaces.
virtual CrossSection integratedXSec() const
The estimated total integrated cross section of the processes generated in this run.
XSecStat histStats
Collect statistics for this event handler.
void reject(double weight)
Reject the current event, taking care of the statistics collection of the corresponding reader object...
FxFxEventHandler()
The default constructor.
double theUnitTolerance
If the weight option is set to unit weight, do not start compensating unless the weight is this much ...
const ReaderSelector & selector() const
The selector to choose readers according to their overestimated cross section.
bool warnPNum
Warn if the same process number is used in more than one FxFxReader.
static ClassDescription< FxFxEventHandler > initFxFxEventHandler
The static object used to initialize the description of this class.
virtual void initialize()
Initialize this event handler and all related objects needed to generate events.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
virtual void dofinish()
Finalize this object.
ReaderSelector theSelector
The selector to choose readers according to their overestimated cross section.
virtual EventPtr continueEvent()
Continue generating an event if the generation has been stopped before finishing.
const ReaderVector & readers() const
Access the list of readers.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
virtual CrossSection integratedXSecErr() const
The estimated error in the total integrated cross section of the processes generated in this run.
tFxFxReaderPtr theCurrentReader
The currently selected reader object.
ReaderVector theReaders
The list of readers.
unsigned int theNormWeight
How to normalize the weights.
ReaderVector & readers()
Access the list of readers.
vector< FxFxReaderPtr > ReaderVector
A vector of FxFxReader objects.
void accept()
Accept the current event, taking care of the statistics collection of the corresponding reader object...
void setUnitTolerance(double)
Helper function for the interface;.
ReaderSelector & selector()
The selector to choose readers according to their overestimated cross section.
void skipEvents()
Skip some events.
WeightOpt weightOption() const
The way weights are to be treated.
virtual IBPtr clone() const
Make a simple clone of this object.
virtual tCollPtr performCollision()
Create the Event and Collision objects.
virtual void doinitrun()
Initialize this object.
tFxFxReaderPtr currentReader() const
The currently selected reader object.
virtual EventPtr generateEvent()
Generate an event.
CompSelector< int, CrossSection > ReaderSelector
A selector of readers.
FxFxEventHandler & operator=(const FxFxEventHandler &)=delete
The assignment operator is private and must never be called.
WeightOpt theWeightOption
The way weights are to be treated.
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
ThePEG::Ptr< Collision >::transient_pointer tCollPtr
ThePEG::Ptr< Event >::pointer EventPtr
static string className()
static string library()