herwig is hosted by Hepforge, IPPP Durham
Herwig 7.3.0
SubtractedME.h
1// -*- C++ -*-
2//
3// SubtractedME.h is a part of Herwig - A multi-purpose Monte Carlo event generator
4// Copyright (C) 2002-2019 The Herwig Collaboration
5//
6// Herwig 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 HERWIG_SubtractedME_H
10#define HERWIG_SubtractedME_H
11//
12// This is the declaration of the SubtractedME class.
13//
14
15#include "ThePEG/MatrixElement/MEGroup.h"
16#include "Herwig/MatrixElement/Matchbox/Base/MatchboxMEBase.h"
17#include "Herwig/MatrixElement/Matchbox/Dipoles/SubtractionDipole.h"
18#include "Herwig/MatrixElement/Matchbox/Utility/LastMatchboxXCombInfo.h"
19#include "Herwig/MatrixElement/Matchbox/MatchboxFactory.fh"
20
21namespace Herwig {
22
23using namespace ThePEG;
24
35 public MEGroup,
37
38public:
39
44
45public:
46
50 Ptr<MatchboxFactory>::tcptr factory() const;
51
54
59 virtual StdXCombPtr makeXComb(Energy newMaxEnergy, const cPDPair & inc,
60 tEHPtr newEventHandler,tSubHdlPtr newSubProcessHandler,
61 tPExtrPtr newExtractor, tCascHdlPtr newCKKW,
62 const PBPair & newPartonBins, tCutsPtr newCuts,
63 const DiagramVector & newDiagrams, bool mir,
64 const PartonPairVec& allPBins,
65 tStdXCombPtr newHead = tStdXCombPtr(),
66 tMEPtr newME = tMEPtr());
67
72 virtual void setXComb(tStdXCombPtr);
73
79 virtual bool uniformAdditional() const { return true; }
80
86 virtual bool keepRandomNumbers() const { return true; }
87
94 tMEPtr depME) const;
95
102 virtual bool subProcessGroups() const;
103
109 virtual bool selectDependentSubProcess() const { return false; }
110
115 virtual void fillProjectors();
116
120 virtual bool willProject() const {
122 }
123
128 virtual bool groupReweighted() const {
129 return showerApproximation();
130 }
131
135 virtual double reweightHead(const vector<tStdXCombPtr>&);
136
140 virtual double reweightDependent(tStdXCombPtr, const vector<tStdXCombPtr>&);
141
146
148
151
157 virtual void flushCaches() {
159 if ( showerApproximation() )
160 showerApproximation()->resetBelowCutoff();
161 }
162
166 Ptr<ShowerApproximation>::tptr showerApproximation() const;
167
172
177
182
187
192
197
204 virtual bool discard(const CrossSection&, const CrossSection&) const { return false; }
205
207
210
214 vector<Ptr<SubtractionDipole>::ptr> dipoles();
215
219 const vector<Ptr<MatchboxMEBase>::ptr>& borns() const;
220
225 void setBorns(const vector<Ptr<MatchboxMEBase>::ptr>& newBorns) { theBorns = newBorns; }
226
231
235 void cloneDipoles(const string& prefix = "");
236
240 void cloneRealME(const string& prefix = "");
241
245 void cloneDependencies(const string& prefix = "") {
246 cloneDipoles(prefix);
247 cloneRealME(prefix);
248 }
249
253 vector<Ptr<SubtractionDipole>::ptr> splitDipoles(const cPDVector&);
254
256
264 virtual void setVetoScales(tSubProPtr) const;
266
269
273 void print(ostream&) const;
274
281 virtual void lastEventStatistics();
282
286 void printLastEvent(ostream&) const;
287
292
296 bool verbose() const;
297
301 bool initVerbose() const;
302
304
307
314 virtual bool preInitialize() const { return true; }
315
320
324 double lower;
325
329 map<double,pair<double,double> > bins;
330
334 SubtractionHistogram(double low = 0.001,
335 double up = 10.,
336 unsigned int nbins = 100);
337
341 void book(double inv, double diff) {
342 map<double,pair<double,double> >::iterator b =
343 bins.upper_bound(inv);
344 if ( b == bins.end() ) return;
345 b->second.first = min(b->second.first,diff);
346 b->second.second = max(b->second.second,diff);
347 }
348
352 void dump(const std::string& prefix,
353 const int& plottype,
354 const bool& scatterplot,
355 const cPDVector& proc,
356 int i, int j) const;
357
362
367
368 };
369
371
372public:
373
381
387 void persistentInput(PersistentIStream & is, int version);
389
396 static void Init();
397
398protected:
399
406 virtual IBPtr clone() const;
407
412 virtual IBPtr fullclone() const;
414
415
416// If needed, insert declarations of virtual function defined in the
417// InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
418
419
420protected:
421
429 virtual void doinit();
430
435 virtual void doinitrun();
436
441 virtual void dofinish();
442
444
445private:
446
451 vector<Ptr<MatchboxMEBase>::ptr> theBorns;
452
457 Ptr<MatchboxMEBase>::ptr theReal;
458
462 typedef pair<cPDVector,pair<size_t, size_t> > CollinearSubtractionIndex;
463
467 map<CollinearSubtractionIndex,SubtractionHistogram> collinearHistograms;
468
472 map<CollinearSubtractionIndex,string> fnamesCollinearSubtraction;
473
477 typedef pair<cPDVector,size_t> SoftSubtractionIndex;
478
482 map<SoftSubtractionIndex,SubtractionHistogram> softHistograms;
483
487 map<SoftSubtractionIndex,string> fnamesSoftSubtraction;
488
493
498
503
504private:
505
511
512};
513
516 h.persistentOutput(os);
517 return os;
518}
519
521 SubtractedME::SubtractionHistogram& h) {
522 h.persistentInput(is);
523 return is;
524}
525
526}
527
528#endif /* HERWIG_SubtractedME_H */
Provide easy access to MatchboxXComb XComb extensions.
SubtractedME represents a subtracted real emission matrix element.
Definition: SubtractedME.h:36
virtual bool willProject() const
Return true, if projectors will be used.
Definition: SubtractedME.h:120
virtual bool subProcessGroups() const
Return true, if SubProcessGroups should be setup from this MEGroup.
virtual void fillProjectors()
Fill the projectors object of xcombs to choose subprocesses different than the one currently integrat...
virtual void lastEventStatistics()
Collect information on the last evaluated phasespace point for verification or debugging purposes.
pair< cPDVector, pair< size_t, size_t > > CollinearSubtractionIndex
Define the key for the collinear subtraction data.
Definition: SubtractedME.h:462
virtual bool selectDependentSubProcess() const
Return true, if one of the dependent subprocesses should be constructed in place of the one driven by...
Definition: SubtractedME.h:109
virtual void setVetoScales(tSubProPtr) const
Set veto scales on the particles at the given SubProcess which has been generated using this matrix e...
void doRealEmissionScales()
Switch on or off that scales should be calculated from real emission kinematics.
SubtractedME()
The default constructor.
Ptr< MatchboxMEBase >::ptr theReal
Pointer to the head real emission ME casted to a MatchboxMEBase object.
Definition: SubtractedME.h:457
virtual double reweightHead(const vector< tStdXCombPtr > &)
Reweight the head cross section.
virtual void setXComb(tStdXCombPtr)
Set the XComb object to be used in the next call to generateKinematics() and dSigHatDR().
static void Init()
The standard Init function used to initialize the interfaces.
bool theRealShowerSubtraction
True, if the shower real emission contribution should be subtracted.
Definition: SubtractedME.h:492
map< SoftSubtractionIndex, string > fnamesSoftSubtraction
names of files to which subtraction data is written for all phase space points individually
Definition: SubtractedME.h:487
virtual double reweightDependent(tStdXCombPtr, const vector< tStdXCombPtr > &)
Reweight the dependent cross section.
virtual bool uniformAdditional() const
Return true, if the same additional random numbers should be presented to any of the dependent matrix...
Definition: SubtractedME.h:79
map< CollinearSubtractionIndex, string > fnamesCollinearSubtraction
names of files to which subtraction data is written for all phase space points individually
Definition: SubtractedME.h:472
bool initVerbose() const
Return true, if verbose.
void setBorns(const vector< Ptr< MatchboxMEBase >::ptr > &newBorns)
Access the underlying born matrix elements, overriding the ones contained in the factory object.
Definition: SubtractedME.h:225
virtual bool groupReweighted() const
Return true, if this MEGroup will reweight the contributing cross sections.
Definition: SubtractedME.h:128
map< SoftSubtractionIndex, SubtractionHistogram > softHistograms
subtraction data for soft limits.
Definition: SubtractedME.h:482
void cloneDipoles(const string &prefix="")
Clone all dipoles.
bool theLoopSimSubtraction
True, if the loopsim matched virtual contribution should be subtracted.
Definition: SubtractedME.h:502
void cloneDependencies(const string &prefix="")
Clone all dependencies.
Definition: SubtractedME.h:245
virtual bool discard(const CrossSection &, const CrossSection &) const
Return true, if this configuration of cross sections should not be included due to their relative mag...
Definition: SubtractedME.h:204
virtual void doinitrun()
Initialize this object.
void lastEventSubtraction()
Check the subtraction for the last event.
virtual void flushCaches()
Inform this matrix element that a new phase space point is about to be generated, so all caches shoul...
Definition: SubtractedME.h:157
void print(ostream &) const
Dump the setup to an ostream.
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
void doLoopSimSubtraction()
Indicate that the loopsim matched virtual contribution should be subtracted.
void doVirtualShowerSubtraction()
Indicate that the shower virtual contribution should be subtracted.
virtual IBPtr clone() const
Make a simple clone of this object.
vector< Ptr< MatchboxMEBase >::ptr > theBorns
The underlying born matrix elements, overriding the ones contained in the factory object.
Definition: SubtractedME.h:451
pair< cPDVector, size_t > SoftSubtractionIndex
Define the key for the soft subtraction data.
Definition: SubtractedME.h:477
SubtractedME & operator=(const SubtractedME &)=delete
The assignment operator is private and must never be called.
vector< Ptr< SubtractionDipole >::ptr > splitDipoles(const cPDVector &)
Return all dipoles matching the given Born process.
bool theVirtualShowerSubtraction
True, if the shower virtual contribution should be subtracted.
Definition: SubtractedME.h:497
virtual bool preInitialize() const
Return true if this object needs to be initialized before all other objects (except those for which t...
Definition: SubtractedME.h:314
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
void getDipoles()
Build up dipoles needed.
virtual bool keepRandomNumbers() const
Return true, if the XComb steering this matrix element should keep track of the random numbers used t...
Definition: SubtractedME.h:86
virtual void dofinish()
Finalize this object.
bool virtualShowerSubtraction() const
Return true, if the shower virtual contribution should be subtracted.
Definition: SubtractedME.h:186
bool verbose() const
Return true, if verbose.
virtual MEBase::DiagramVector dependentDiagrams(const cPDVector &proc, tMEPtr depME) const
Given a process from the head matrix element, return a list of diagrams which should be considered fo...
const vector< Ptr< MatchboxMEBase >::ptr > & borns() const
Return the underlying born matrix elements.
virtual void doinit()
Initialize this object after the setup phase before saving an EventGenerator to disk.
map< CollinearSubtractionIndex, SubtractionHistogram > collinearHistograms
subtraction data for collinear limits.
Definition: SubtractedME.h:467
vector< Ptr< SubtractionDipole >::ptr > dipoles()
Return the subtraction dipoles.
Ptr< MatchboxFactory >::tcptr factory() const
Return the factory which produced this matrix element.
bool realShowerSubtraction() const
Return true, if the shower real emission contribution should be subtracted.
Definition: SubtractedME.h:176
Ptr< ShowerApproximation >::tptr showerApproximation() const
Return the shower approximation.
virtual StdXCombPtr makeXComb(Energy newMaxEnergy, const cPDPair &inc, tEHPtr newEventHandler, tSubHdlPtr newSubProcessHandler, tPExtrPtr newExtractor, tCascHdlPtr newCKKW, const PBPair &newPartonBins, tCutsPtr newCuts, const DiagramVector &newDiagrams, bool mir, const PartonPairVec &allPBins, tStdXCombPtr newHead=tStdXCombPtr(), tMEPtr newME=tMEPtr())
For the given event generation setup return an xcomb object appropriate to this matrix element.
void doRealShowerSubtraction()
Indicate that the shower real emission contribution should be subtracted.
bool loopSimSubtraction() const
Return true, if the loopsim matched virtual contribution should be subtracted.
Definition: SubtractedME.h:196
void cloneRealME(const string &prefix="")
Clone the real emission matrix element.
virtual IBPtr fullclone() const
Make a clone of this object, possibly modifying the cloned object to make it sane.
void printLastEvent(ostream &) const
Print debug information on the last event.
vector< DiagPtr > DiagramVector
virtual void flushCaches()
-*- C++ -*-
PersistentIStream & operator>>(PersistentIStream &is, HandlerGroup< HDLR > &hg)
ThePEG::Ptr< InterfacedBase >::pointer IBPtr
pair< cPDPtr, cPDPtr > cPDPair
ThePEG::Ptr< PartonExtractor >::transient_pointer tPExtrPtr
ThePEG::Ptr< SubProcess >::transient_pointer tSubProPtr
ThePEG::Ptr< CascadeHandler >::transient_pointer tCascHdlPtr
ostream & operator<<(ostream &, const Collision &)
ThePEG::Ptr< EventHandler >::transient_pointer tEHPtr
vector< cPDPtr > cPDVector
Simple envelope histogram to keep track of subtraction.
Definition: SubtractedME.h:319
void dump(const std::string &prefix, const int &plottype, const bool &scatterplot, const cPDVector &proc, int i, int j) const
Write to file given name and invariant.
SubtractionHistogram(double low=0.001, double up=10., unsigned int nbins=100)
Constructor.
void persistentOutput(PersistentOStream &) const
Write to persistent ostream.
void persistentInput(PersistentIStream &)
Read from persistent istream.
map< double, pair< double, double > > bins
The bins, indexed by upper bound.
Definition: SubtractedME.h:329
void book(double inv, double diff)
Book an event.
Definition: SubtractedME.h:341