Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:26

0001 // -*- C++ -*-
0002 //
0003 // PowhegShowerHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator
0004 // Copyright (C) 2002-2019 The Herwig Collaboration
0005 //
0006 // Herwig is licenced under version 3 of the GPL, see COPYING for details.
0007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0008 //
0009 #ifndef HERWIG_PowhegShowerHandler_H
0010 #define HERWIG_PowhegShowerHandler_H
0011 //
0012 // This is the declaration of the PowhegShowerHandler class.
0013 //
0014 
0015 #include "Herwig/Shower/QTilde/QTildeShowerHandler.h"
0016 #include "Herwig/MatrixElement/Matchbox/MatchboxFactory.h"
0017 #include "Herwig/MatrixElement/HwMEBase.h"
0018 #include "Herwig/Shower/QTilde/Base/HardBranching.h"
0019 
0020 #include "Herwig/Shower/QTilde/Matching/CKKWTree.h"
0021 #include "Herwig/Shower/QTilde/Matching/ProtoTree.h"
0022 #include "Herwig/Shower/QTilde/Matching/ProtoBranching.h"
0023 #include "Herwig/Shower/QTilde/Matching/PotentialTree.h"
0024 
0025 #include "ThePEG/MatrixElement/DiagramBase.fh"
0026 #include "ThePEG/MatrixElement/MEBase.h"
0027 #include "ThePEG/PDF/PartonExtractor.h"
0028 #include "Herwig/Shower/QTilde/Base/HardTree.h"
0029 
0030 // #include "Herwig/Shower/QTilde/SplittingFunctions/SplittingGenerator.h"
0031 // #include "Herwig/Shower/QTilde/Base/ShowerModel.h"
0032 // #include "ThePEG/PDF/BeamParticleData.h"
0033 // #include "Herwig/Shower/QTilde/Base/ShowerTree.h"
0034 // #include "Herwig/Shower/QTilde/Base/ShowerProgenitor.fh"
0035 // #include "Herwig/Shower/QTilde/QTildeShowerHandler.fh"
0036 // #include "Herwig/Shower/QTilde/Base/Branching.h"
0037 // #include "Herwig/Shower/QTilde/Base/ShowerVeto.h"
0038 // #include "ThePEG/Handlers/XComb.h"
0039 // #include "Herwig/Decay/HwDecayerBase.h"
0040 
0041 
0042 namespace Herwig {
0043 
0044 using namespace ThePEG;
0045 
0046 class PowhegShowerHandler: public QTildeShowerHandler {
0047 
0048 public:
0049 
0050   /**
0051    * The default constructor.
0052    */
0053   PowhegShowerHandler() : subtractionIntegral_(false),
0054               enforceColourConsistency_(false),
0055               forcePartners_(false),
0056               decayRadiation_(0)
0057   {}
0058 
0059 public:
0060 
0061   Ptr<MatchboxFactory>::tptr Factory() const{return MatchboxFactory::currentFactory();}
0062 
0063   /**
0064    * Return true, if the shower handler can generate a truncated 
0065    * shower for POWHEG style events generated using Matchbox
0066    */
0067   virtual bool canHandleMatchboxTrunc() const { return true; }
0068 
0069 protected:
0070 
0071   /**
0072    *  Generate hard emissions for CKKW etc
0073    */
0074   virtual HardTreePtr generateCKKW(ShowerTreePtr tree) const;
0075 
0076 protected:
0077 
0078   /**
0079    *  Access to the core matrix element
0080    */
0081   MEPtr matrixElement() const {return matrixElement_;}
0082 
0083  /**
0084    * Creates all (ordered) cluster histories and selects one.
0085    */
0086   PotentialTree doClustering(tSubProPtr sub,ShowerTreePtr showerTree) const;
0087 
0088   /**
0089    *  Access to the select tree
0090    */
0091   PotentialTree & hardTree() {return hardTree_;}
0092   const PotentialTree & hardTree() const {return hardTree_;}
0093 
0094   /**
0095    *  Access to the select tree
0096    */
0097   void hardTree(PotentialTree in) const {hardTree_ = in;}
0098 
0099   /**
0100    * Check if two momenta are equal within 1%
0101    */
0102   bool fuzzyEqual(Lorentz5Momentum a, Lorentz5Momentum  b) const;
0103 
0104   /**
0105    *  Access to the potential branchings
0106    */
0107   set<ProtoBranchingPtr> & protoBranchings() const {return protoBranchings_;}
0108 
0109   /**
0110    * The ProtoTrees which will become CKKWTrees
0111    */
0112   set< ProtoTreePtr > & protoTrees() const {return protoTrees_;}
0113 
0114   /**
0115    * Recursive function to find all possible clustered trees.
0116    * Does not produce any repeated trees.
0117    */
0118   void fillProtoTrees( ProtoTreePtr , long id ) const;
0119 
0120  /**
0121    * Function looks to see if a cluster of the branchings already exists
0122    * in protoBranchings_ if so returns the pointer to that protoBranching
0123    * if not creates the hardBranchings, adds it
0124    * to protoBranchings and returns the pointer
0125    */
0126   tProtoBranchingPtr getCluster( tProtoBranchingPtr, tProtoBranchingPtr ) const;
0127 
0128   /**
0129    * Checks whether a ProtoTree containing the same branchings already 
0130    * exists in protoTrees_ in which case the current tree is a repeat 
0131    * and should be removed (and not recursed)
0132    */
0133   bool repeatProtoTree( ProtoTreePtr currentProtoTree ) const;
0134 
0135   /**
0136    * Returns the branching element for an FS-FS clustering
0137    */
0138   BranchingElement allowedFinalStateBranching( tProtoBranchingPtr &,
0139                            tProtoBranchingPtr &) const;
0140   
0141   /**
0142    * Returns the branching element for an IS-FS clustering
0143    */
0144   BranchingElement allowedInitialStateBranching( tProtoBranchingPtr & ,
0145                          tProtoBranchingPtr &) const;
0146 
0147   /**
0148    * Returns the diagram corresponding to the (leading-order) hardTree
0149    */
0150   bool checkDiagram(PotentialTree &,tcDiagPtr) const;
0151 
0152   bool subtractionIntegral() const {return subtractionIntegral_;}
0153 
0154   void setSubtractionIntegral(bool subInt) const { subtractionIntegral_=subInt;}
0155 
0156 
0157 private:
0158 
0159  /**
0160    *  The matrix element for the core process
0161    */
0162   mutable MEPtr matrixElement_;
0163 
0164   /**
0165    *  The chosen hard tree
0166    */
0167   mutable PotentialTree hardTree_;
0168 
0169  /**
0170    *  All the Protobranchings used in finding the shower histories
0171    */
0172   mutable set<ProtoBranchingPtr> protoBranchings_;
0173 
0174   /**
0175    * The ProtoTrees which will become CKKWTrees
0176    */
0177   mutable set< ProtoTreePtr > protoTrees_;
0178 
0179  /**
0180    * The possible shower configurations that are angular-ordered
0181    */
0182   mutable vector< pair< PotentialTree, double > > hardTrees_;
0183 
0184   /**
0185    *  Which branchings are allowed?
0186    */
0187   //@{
0188   /**
0189    *  The allowed final-state branchings
0190    */
0191   mutable map<pair<long,long>,BranchingElement > allowedFinal_;
0192 
0193   /**
0194    *  The allowed initial-state branchings
0195    */
0196   mutable multimap<long, BranchingElement > allowedInitial_;
0197   //@}
0198 
0199 public:
0200 
0201   /** @name Functions used by the persistent I/O system. */
0202   //@{
0203   /**
0204    * Function used to write out object persistently.
0205    * @param os the persistent output stream written to.
0206    */
0207   void persistentOutput(PersistentOStream & os) const;
0208 
0209   /**
0210    * Function used to read in object persistently.
0211    * @param is the persistent input stream read from.
0212    * @param version the version number of the object when written.
0213    */
0214   void persistentInput(PersistentIStream & is, int version);
0215   //@}
0216 
0217   /**
0218    * The standard Init function used to initialize the interfaces.
0219    * Called exactly once for each class by the class description system
0220    * before the main function starts or
0221    * when this class is dynamically loaded.
0222    */
0223   static void Init();
0224 
0225 protected:
0226 
0227   /** @name Clone Methods. */
0228   //@{
0229   /**
0230    * Make a simple clone of this object.
0231    * @return a pointer to the new object.
0232    */
0233   virtual IBPtr clone() const;
0234 
0235   /** Make a clone of this object, possibly modifying the cloned object
0236    * to make it sane.
0237    * @return a pointer to the new object.
0238    */
0239   virtual IBPtr fullclone() const;
0240   //@}
0241 
0242 protected:
0243 
0244   /** @name Standard Interfaced functions. */
0245   //@{
0246   /**
0247    * Initialize this object after the setup phase before saving an
0248    * EventGenerator to disk.
0249    * @throws InitException if object could not be initialized properly.
0250    */
0251   virtual void doinit();
0252   //@}
0253 
0254 private:
0255 
0256   /**
0257    * The assignment operator is private and must never be called.
0258    * In fact, it should not even be implemented.
0259    */
0260   PowhegShowerHandler & operator=(const PowhegShowerHandler &) = delete;
0261 
0262 private:
0263 
0264   /**
0265    *  Emitter particle from the original generation
0266    */
0267   mutable int emitter_;
0268 
0269   /**
0270    *  Spectator particle from the original generation
0271    */
0272   mutable int spectator_;
0273 
0274   /**
0275    *  Whether or not a subtraction integral
0276    */
0277   mutable bool subtractionIntegral_;
0278 
0279   /**
0280    * Whether or not do enforce consistency of the Born and real colour flows
0281    */
0282   bool enforceColourConsistency_;
0283 
0284   /**
0285    *  Force emitter and spectator partners
0286    */
0287   bool forcePartners_;
0288 
0289   /**
0290    *  Handling of radiation in decays
0291    */
0292   unsigned int decayRadiation_;
0293 
0294 };
0295 
0296 }
0297 
0298 #endif /* HERWIG_PowhegShowerHandler_H */