Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // PartnerFinder.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_PartnerFinder_H
0010 #define HERWIG_PartnerFinder_H
0011 //
0012 // This is the declaration of the PartnerFinder class.
0013 //
0014 #include "Herwig/Shower/QTilde/ShowerConfig.h"
0015 #include "ThePEG/Interface/Interfaced.h"
0016 #include "PartnerFinder.fh"
0017 
0018 namespace Herwig {
0019 
0020 using namespace ThePEG;
0021 
0022 /**
0023  *  typedef of a pair of particle for calculating the evolution scales
0024  */
0025 typedef pair<tShowerParticlePtr,tShowerParticlePtr> ShowerPPair;
0026 
0027 /** \ingroup Shower
0028  *
0029  *  This class is responsible of two related tasks: 
0030  *  -  it finds the partners 
0031  *  -  for each pair of partners (and interaction therefore)
0032  *      it sets the initial evolution scales of both of them.
0033  *
0034  *  In general the finding of the partners is performed by this class but
0035  *  the calculation of the initial evolution scales should be implemented
0036  *  for different shower evolution models in classes inheriting from this one.
0037  *  Notice that a given particle has, in general, a different partner
0038  *  for each different interaction; however, given a partner, its 
0039  *  initial evolution scale, Q, is purely a kinematical relationship 
0040  *  between the pair, without dependence on the dynamics (i.e. type of interaction).
0041  *
0042  * @see \ref PartnerFinderInterfaces "The interfaces"
0043  * defined for PartnerFinder.
0044  */
0045 class PartnerFinder: public Interfaced {
0046 
0047 public:
0048 
0049   /**
0050    * The default constructor.
0051    */
0052   PartnerFinder() : partnerMethod_(0), QEDPartner_(0), scaleChoice_(0) {}
0053 
0054   /**
0055    * Given in input a collection of particles (ShowerParticle objects),
0056    * each of these methods set the initial evolution scales of those particles, 
0057    * between the ones given in input, that do not have yet their
0058    * evolution scale set. 
0059    * The input collection of particles can be either the full collection of 
0060    * showering particles (kept in the main class ShowerHandler,
0061    * in the case isDecayCase is false, or simply, in the case isDecayCase 
0062    * is true, the decaying particle and its decay products.    
0063    * The methods returns true, unless something wrong (inconsistencies,
0064    * or undefined values) happens.
0065    *
0066    * These methods are virtual but in most cases inheriting classes should not
0067    * need to overide them as they simply find the relevant partner and call
0068    * one of the calculateScale members to calculate the scale.
0069    */
0070   //@{
0071   /**
0072    * Set the initial scales
0073    * @param particles        The particles to be considered
0074    * @param isDecayCase      Whether or not this is a decay
0075    * @param setPartners Whether to set the colour partners or just the scales
0076    */
0077   virtual void setInitialEvolutionScales(const ShowerParticleVector &particles,
0078                      const bool isDecayCase,
0079                      ShowerInteraction,
0080                      const bool setPartners=true);
0081   //@}
0082 protected:
0083 
0084   /** @name Clone Methods. */
0085   //@{
0086   /**
0087    * Make a simple clone of this object.
0088    * @return a pointer to the new object.
0089    */
0090   virtual IBPtr clone() const {return new_ptr(*this);}
0091 
0092   /** Make a clone of this object, possibly modifying the cloned object
0093    * to make it sane.
0094    * @return a pointer to the new object.
0095    */
0096   virtual IBPtr fullclone() const {return new_ptr(*this);}
0097   //@}
0098 
0099 
0100 public:
0101 
0102   /** @name Functions used by the persistent I/O system. */
0103   //@{
0104   /**
0105    * Function used to write out object persistently.
0106    * @param os the persistent output stream written to.
0107    */
0108   void persistentOutput(PersistentOStream & os) const;
0109 
0110   /**
0111    * Function used to read in object persistently.
0112    * @param is the persistent input stream read from.
0113    * @param version the version number of the object when written.
0114    */
0115   void persistentInput(PersistentIStream & is, int version);
0116   //@}
0117 
0118   /**
0119    * The standard Init function used to initialize the interfaces.
0120    * Called exactly once for each class by the class description system
0121    * before the main function starts or
0122    * when this class is dynamically loaded.
0123    */
0124   static void Init();
0125 
0126 protected:
0127 
0128   /**
0129    *  Members to set the scales for different interactions
0130    */
0131   //@{
0132   /**
0133    *  Set initial scales for a QCD interaction
0134    */
0135   virtual void setInitialQCDEvolutionScales(const ShowerParticleVector &particles,
0136                         const bool isDecayCase,
0137                         const bool setPartners=true);
0138 
0139   /**
0140    *  Set initial scales for a QED interaction
0141    */
0142   virtual void setInitialQEDEvolutionScales(const ShowerParticleVector &particles,
0143                         const bool isDecayCase,
0144                         const bool setPartners=true);
0145 
0146   /**
0147    *  Set initial scales for a EW interaction
0148    */
0149   virtual void setInitialEWEvolutionScales(const ShowerParticleVector &particles,
0150                        const bool isDecayCase,
0151                        const bool setPartners=true);
0152   //@}
0153 
0154   /**
0155    *  Find the QCD partners
0156    * @param particle The particle to find the partners for
0157    * @param particles The full set of particles to search
0158    */
0159   vector< pair<ShowerPartnerType, tShowerParticlePtr> > 
0160   findQCDPartners(tShowerParticlePtr particle, const ShowerParticleVector &particles);
0161 
0162   /**
0163    *  Find the QED partners
0164    * @param particle The particle to find the partners for
0165    * @param particles The full set of particles to search
0166    */
0167   vector< pair<double, tShowerParticlePtr> >
0168   findQEDPartners(tShowerParticlePtr particle, const ShowerParticleVector &particles,
0169           const bool isDecayCase);
0170 
0171 public:
0172   /**
0173    *  Find the EW partners
0174    * @param particle The particle to find the partners for
0175    * @param particles The full set of particles to search
0176    */
0177   vector< pair<double, tShowerParticlePtr> >
0178   findEWPartners(tShowerParticlePtr particle, const ShowerParticleVector &particles,
0179          const bool isDecayCase);
0180 
0181   /**
0182    * Given a pair of particles, supposedly partners w.r.t. an interaction,
0183    * this method returns their initial evolution scales as a pair.
0184    * If something wrong happens, it returns the null (ZERO,ZERO) pair. 
0185    * This method is used by the above setXXXInitialEvolutionScales 
0186    * methods.
0187    * These methods must be overiden in inheriting classes
0188    */
0189   //@{
0190   /**
0191    *  General method to calculate the initial evolution scales
0192    */
0193   pair<Energy,Energy> calculateInitialEvolutionScales(const ShowerPPair &,
0194                               const bool isDecayCase, int key=0);
0195 
0196   /**
0197    *  Calculate the initial evolution scales given momenta
0198    */
0199   pair<Energy,Energy> calculateFinalFinalScales(const Lorentz5Momentum & p1, 
0200                                                 const Lorentz5Momentum & p2, int key=0);
0201 
0202   /**
0203    *  Calculate the initial evolution scales given momenta
0204    */
0205   pair<Energy,Energy> calculateInitialInitialScales(const Lorentz5Momentum& p1, 
0206                             const Lorentz5Momentum& p2);
0207 
0208   /**
0209    *  Calculate the initial evolution scales given momenta
0210    */
0211   pair<Energy,Energy> calculateInitialFinalScales(const Lorentz5Momentum& pb, const Lorentz5Momentum& pc,
0212                           const bool isDecayCase);
0213 
0214 
0215   //@}
0216 
0217 protected:
0218 
0219   /**
0220    *  Find weakling interacting particles
0221    */
0222   bool weaklyInteracting(tcPDPtr pd) {
0223     long id = abs(pd->id());
0224     return ( id==ParticleID::Wplus || id ==ParticleID::Z0 || (id>=1 && id<=6 ) || (id>=11 && id<=16));
0225   }
0226 
0227 private:
0228 
0229   /**
0230    * The assignment operator is private and must never be called.
0231    * In fact, it should not even be implemented.
0232    */
0233   PartnerFinder & operator=(const PartnerFinder &) = delete;
0234 
0235 private:
0236 
0237   /**
0238    *  Method for choosing colour partner
0239    */
0240    int partnerMethod_;
0241 
0242   /**
0243    *  Choice for the QED radiation partner
0244    */
0245   int QEDPartner_;
0246 
0247   /**
0248    *  Choice of the scale
0249    */
0250   int scaleChoice_;
0251 
0252 };
0253 
0254 }
0255 
0256 #endif /* HERWIG_PartnerFinder_H */