Back to home page

EIC code displayed by LXR

 
 

    


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

0001   // -*- C++ -*-
0002 #ifndef Herwig_Node_H
0003 #define Herwig_Node_H
0004   //
0005   // This is the declaration of the Node class.
0006   //
0007 #include "Node.fh"
0008 #include "MergingFactory.fh"
0009 #include "Merger.h"
0010 
0011 
0012 
0013 #include "ThePEG/Config/ThePEG.h"
0014 #include "ThePEG/Config/std.h"
0015 #include "ThePEG/Interface/Interfaced.h"
0016 #include "Herwig/MatrixElement/Matchbox/Base/MatchboxMEBase.fh"
0017 #include "Herwig/MatrixElement/Matchbox/Dipoles/SubtractionDipole.fh"
0018 #include "Herwig/Shower/Dipole/Base/DipoleEventRecord.h"
0019 #include "ThePEG/MatrixElement/MEBase.h"
0020 
0021 #include <vector>
0022 
0023 
0024 
0025 namespace Herwig {
0026     
0027     
0028     using namespace ThePEG;
0029   
0030   /**
0031    * The Node class represents a part of the shower history
0032    * in the merging procedure.
0033    * Each node can search for its "childen" in the "birth" step.
0034    * The children processes that can be created by clustering two legs
0035    * with a given spectator -- just like in the shower.
0036    * To perform the "birth" a vector of processes is given to the node
0037    * and the possible dipoles are given by the factory object.
0038    *
0039    *
0040    * @see \ref NodeInterfaces "The interfaces"
0041    * defined for Node.
0042    */
0043   
0044   
0045   class Node : public Interfaced {
0046         public:
0047     
0048     /** @name Standard constructors and destructors. */
0049       //@{
0050     
0051     Node (){};
0052     
0053       // constructor for first nodes
0054     Node(MatchboxMEBasePtr nodeME , int cutstage , MergerPtr mh );
0055       // another constructor for underlying nodes
0056     Node(NodePtr deephead, 
0057          NodePtr head, 
0058          SubtractionDipolePtr dipol, 
0059          MatchboxMEBasePtr nodeME, 
0060          int cutstage);
0061       //@}
0062     
0063   public:
0064       // get children from vector<MatchboxMEBasePtr>
0065     void birth(const vector<MatchboxMEBasePtr> & vec);
0066       /// recursive setXComb. proStage is the number of clusterings
0067       /// before the projectors get filled.
0068     void setXComb(tStdXCombPtr xc);
0069       /// calculate the dipole and ps approximation
0070     pair<CrossSection, CrossSection> calcDipandPS(Energy scale)const;
0071       /// calculate the ps approximation
0072     CrossSection calcPs(Energy scale)const;
0073       /// calculate the dipole
0074     CrossSection calcDip(Energy scale)const;
0075       /// recursive flush caches and clean up XCombs.
0076     void flushCaches();
0077       /// recursive clearKinematics
0078     void clearKinematics();
0079       /// recursive setKinematics
0080     void setKinematics();
0081       /// recursive generateKinematics using tilde kinematics of the dipoles
0082     bool generateKinematics(const double *r, bool directCut);
0083       /// generate the kinamatics of the first node
0084     bool firstgenerateKinematics(const double *r, bool directCut);
0085       //return the ME
0086     const MatchboxMEBasePtr nodeME() const;
0087       //return the node ME
0088     MatchboxMEBasePtr nodeME();
0089       //return the parent Node
0090     NodePtr parent() const {return theparent;}
0091       /// vector of children nodes created in birth
0092     vector< NodePtr > children() const {return thechildren;}
0093       //pick a random child (flat)
0094     NodePtr  randomChild();
0095       /// true if all children show scales above pt
0096     bool allAbove(Energy pt);
0097       /// return maximum of all child pts.
0098     Energy maxChildPt();  
0099       /// true if the node is in the history of other.
0100     bool isInHistoryOf(NodePtr other);
0101       /// legsize of the node ME
0102     int legsize() const;
0103       /// set the first node (first men). only use in factory
0104     void deepHead(NodePtr deephead) {theDeepHead = deephead;}
0105       /// return the first node
0106     NodePtr deepHead() const {return theDeepHead;}
0107       /// returns the dipol of the node.
0108     SubtractionDipolePtr dipole() const;
0109       /// return the xcomb
0110     StdXCombPtr xcomb() const;
0111       /// return the xcomb (if not created, create one from head)
0112     StdXCombPtr xcomb() ;
0113       /// return the current running pt
0114     Energy runningPt() const { return theRunningPt; }
0115       /// set the current running pt
0116     void runningPt(Energy x) { theRunningPt=x; }
0117       /// return the cut stage to cut on merging pt in generate kinematics
0118     int cutStage() const { return theCutStage; }
0119       /// get a vector of the next nodes, ordered in pt (and in parton shower phace space)
0120     vector<NodePtr> getNextOrderedNodes(bool normal=true, double hardscalefactor=1.) const;
0121       //true if the node is in shower history for a given pt
0122     bool inShowerPS(Energy hardpt)const;
0123       //get the history
0124     NodePtr getHistory(bool normal=true, double hardscalefactor=1.);
0125       //true if node correspond to a subtracted real.
0126     bool subtractedReal() const {return theSubtractedReal;}
0127       /// set if node correspont to a subtracted real.
0128     void subtractedReal(bool x) { theSubtractedReal = x;}
0129       //true if node correspond to a virtual contribution.
0130     bool virtualContribution() const { return theVirtualContribution ;}
0131       /// set if node correspont to a virtual contribution.
0132     void virtualContribution(bool x) {theVirtualContribution = x;}
0133       //pointer to the merging helper
0134     MergerPtr MH()const{return theMergingHelper;}
0135       /// set the merging helper
0136     void MH(MergerPtr a){theMergingHelper=a;}
0137       ///  pT of the dipole
0138     Energy pT()const{return dipole()->lastPt();}
0139       /// get incoming and outgoing particles (TODO: expensive)
0140     pair<PVector , PVector> getInOut();
0141     
0142   private:
0143       /// the Matrixelement representing this node.
0144     MatchboxMEBasePtr thenodeMEPtr;
0145       /// the dipol used to substract
0146       /// and generate kinematics using tilde kinematics
0147     SubtractionDipolePtr thedipol;
0148       /// the parent node
0149     NodePtr theparent;
0150       /// The godfather node of whole tree.(Firstnode)
0151     NodePtr theDeepHead;
0152       /**
0153        * The CutStage is number of clusterings which are possible without
0154        * introducing a merging scale to cut away singularities.
0155        * -> subtracted MEs have the CutStage 1.
0156        * -> virtual and normal tree level ME get 0.
0157        */
0158     int theCutStage;
0159       /// flag to tell if node is subtracted real
0160     bool theSubtractedReal;
0161       /// flag to tell if node is virtual contribution
0162     bool theVirtualContribution;
0163       /// the merging helper (should be static)
0164     MergerPtr theMergingHelper;
0165       //the xcomb of the node
0166     StdXCombPtr thexcomb;
0167       /// vector of the children node
0168     vector< NodePtr > thechildren;
0169       /// the current running pt
0170     Energy theRunningPt;
0171       /// The nodes of the projection stage.
0172     NodePtr theProjector;
0173       /// flag not to enter infinite loop. (There should be a better solution...)
0174     bool didflush=false;
0175     
0176   public:
0177     /** @name Functions used by the persistent I/O system. */
0178       //@{
0179     /**
0180      * Function used to write out object persistently.
0181      * @param os the persistent output stream written to.
0182      */
0183     void persistentOutput(PersistentOStream & os) const;
0184     
0185     /**
0186      * Function used to read in object persistently.
0187      * @param is the persistent input stream read from.
0188      * @param version the version number of the object when written.
0189      */
0190     void persistentInput(PersistentIStream & is, int version);
0191       //@}
0192     
0193     /**
0194      * The standard Init function used to initialize the interfaces.
0195      * Called exactly once for each class by the class description system
0196      * before the main function starts or
0197      * when this class is dynamically loaded.
0198      */
0199     static void Init();
0200     
0201     
0202   protected:
0203     /** @name Clone Methods. */
0204       //@{
0205     /**
0206      * Make a simple clone of this object.
0207      * @return a pointer to the new object.
0208      */
0209     virtual IBPtr clone() const;
0210     
0211     /** Make a clone of this object, possibly modifying the cloned object
0212      * to make it sane.
0213      * @return a pointer to the new object.
0214      */
0215     virtual IBPtr fullclone() const;
0216       //@}
0217     
0218     
0219       // If needed, insert declarations of virtual function defined in the
0220       // InterfacedBase class here (using ThePEG-interfaced-decl in Emacs).
0221     
0222     
0223     
0224   private:
0225     /**
0226      * The assignment operator is private and must never be called.
0227      * In fact, it should not even be implemented.
0228      */
0229     Node & operator=(const Node &) = delete;
0230     
0231   };
0232   
0233 }
0234 
0235 #endif /* Herwig_Node_H */
0236 
0237 
0238 
0239 
0240