Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 #ifndef HERWIG_ProtoTree_H
0003 #define HERWIG_ProtoTree_H
0004 //
0005 // This is the declaration of the ProtoTree class.
0006 //
0007 
0008 #include "ProtoBranching.h"
0009 #include "CKKWTree.h"
0010 
0011 namespace Herwig {
0012 
0013 using namespace ThePEG;
0014 
0015 /**
0016  *  Declare the pointers
0017  */
0018 class ProtoTree;
0019 ThePEG_DECLARE_POINTERS(Herwig::ProtoTree,ProtoTreePtr);
0020 
0021 /**
0022  *  Class for a prototype tree
0023  */
0024 class ProtoTree:public Base {
0025 
0026 public:
0027 
0028   /**
0029    * Default constructor
0030    */  
0031   ProtoTree() {}
0032   
0033   /**
0034    *  Constructor
0035    */
0036   ProtoTree(const set<tProtoBranchingPtr> & newBranchings) :
0037     branchings_( newBranchings ) {}
0038   
0039   /**
0040    *  Add a branching
0041    */
0042   void addBranching( tProtoBranchingPtr Branching ){
0043     branchings_.insert( Branching );
0044   }
0045   
0046   const set< tProtoBranchingPtr > & branchings() const {
0047     return  branchings_;
0048   }
0049 
0050   /**
0051    *  Create the HardTree
0052    */
0053   CKKWTreePtr createHardTree() {
0054     vector<HardBranchingPtr> branchings,spacelike;
0055     map<ColinePtr,ColinePtr> cmap;
0056     for(set<tProtoBranchingPtr>::const_iterator it=branchings_.begin();
0057     it!=branchings_.end();++it) {
0058       if((**it).status()==HardBranching::Outgoing) {
0059     branchings.push_back(createTimeLikeBranching(*it,cmap));
0060       }
0061       else {
0062     HardBranchingPtr space;
0063     branchings.push_back(createSpaceLikeBranching(*it,space,cmap));
0064     spacelike.push_back(space);
0065       }
0066     }
0067     // Create the hard tree
0068     return new_ptr(CKKWTree( branchings, spacelike , ShowerInteraction::QCD));
0069   }
0070 
0071 protected:
0072 
0073   /**
0074    *  Create a timelike branching
0075    */
0076   HardBranchingPtr createTimeLikeBranching(tProtoBranchingPtr branch,map<ColinePtr,ColinePtr> & cmap) {
0077     ShowerParticlePtr particle = new_ptr( ShowerParticle( branch->particle() , true ) );
0078     particle->set5Momentum( branch->momentum() );
0079     HardBranchingPtr newBranch = new_ptr( HardBranching( particle, branch->sudakov(),
0080                              HardBranchingPtr(), 
0081                              HardBranching::Outgoing ) );
0082     if(branch->colourLine()) {
0083       if(cmap.find((branch->colourLine()))==cmap.end())
0084     cmap[branch->colourLine()] = new_ptr(ColourLine());
0085       cmap[branch->colourLine()]->addColoured(particle);
0086     }
0087     if(branch->antiColourLine()) {
0088       if(cmap.find((branch->antiColourLine()))==cmap.end())
0089     cmap[branch->antiColourLine()] = new_ptr(ColourLine());
0090       cmap[branch->antiColourLine()]->addAntiColoured(particle);
0091     }
0092     Lorentz5Momentum pnew;
0093     if(branch->children().empty()) {
0094       pnew = branch->momentum();
0095     }
0096     else {
0097       for(unsigned int ix=0;ix<branch->children().size();++ix) {
0098     HardBranchingPtr child = createTimeLikeBranching(branch->children()[ix],cmap);
0099     newBranch->addChild(child);
0100     child->parent(newBranch);
0101     pnew += child->branchingParticle()->momentum();
0102     pnew.setMass(branch->particle()->mass());
0103       }
0104     }
0105     particle->set5Momentum( pnew );
0106     if(branch->type()!=ShowerPartnerType::Undefined)
0107       newBranch->type(branch->type());
0108     return newBranch;
0109   }
0110 
0111   /**
0112    *  Create a spacelike branching
0113    */
0114   HardBranchingPtr createSpaceLikeBranching(tProtoBranchingPtr branch,
0115                         HardBranchingPtr & spacelike,
0116                         map<ColinePtr,ColinePtr> & cmap) {
0117     ShowerParticlePtr particle = new_ptr( ShowerParticle( branch->particle() , false ) );
0118     particle->set5Momentum( branch->momentum() );
0119     if(branch->colourLine()) {
0120       if(cmap.find((branch->colourLine()))==cmap.end())
0121     cmap[branch->colourLine()] = new_ptr(ColourLine());
0122       cmap[branch->colourLine()]->addColoured(particle);
0123     }
0124     if(branch->antiColourLine()) {
0125       if(cmap.find((branch->antiColourLine()))==cmap.end())
0126     cmap[branch->antiColourLine()] = new_ptr(ColourLine());
0127       cmap[branch->antiColourLine()]->addAntiColoured(particle);
0128     }
0129     HardBranchingPtr newBranch = new_ptr( HardBranching( particle, SudakovPtr(),
0130                              HardBranchingPtr(), 
0131                              HardBranching::Incoming ) );
0132     if(!branch->backChildren().empty()) {
0133       HardBranchingPtr newTimeLike  =  createTimeLikeBranching(branch->backChildren()[1],cmap);
0134       HardBranchingPtr newSpaceLike = createSpaceLikeBranching(branch->backChildren()[0],
0135                                    spacelike,cmap);
0136       newBranch  ->parent(newSpaceLike);
0137       newTimeLike->parent(newSpaceLike);
0138       newSpaceLike->addChild(newBranch);
0139       newSpaceLike->addChild(newTimeLike);
0140       newSpaceLike->sudakov(branch->sudakov());
0141     }
0142     else {
0143       spacelike = newBranch;
0144     }
0145     if(branch->type()!=ShowerPartnerType::Undefined)
0146       newBranch->type(branch->type());
0147     return newBranch;
0148   }
0149 
0150 
0151 private:
0152   
0153   /**
0154    *  The branchings in the tree
0155    */
0156   set< tProtoBranchingPtr > branchings_;
0157 
0158 };
0159 
0160 }
0161 
0162 #endif /* HERWIG_ProtoTree_H */