Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // DipoleRepository.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_DipoleRepository_H
0010 #define HERWIG_DipoleRepository_H
0011 
0012 #include "Herwig/MatrixElement/Matchbox/Dipoles/SubtractionDipole.h"
0013 #include "Herwig/MatrixElement/Matchbox/InsertionOperators/MatchboxInsertionOperator.h"
0014 #include "ThePEG/Repository/BaseRepository.h"
0015 #include "ThePEG/Pointer/Ptr.h"
0016 
0017 namespace Herwig {
0018 
0019 using namespace ThePEG;
0020 
0021 #define HERWIG_MatchboxDipoles "/Herwig/MatrixElements/Matchbox/Dipoles/"
0022 #define HERWIG_MatchboxTildes "/Herwig/MatrixElements/Matchbox/TildeKinematics/"
0023 #define HERWIG_MatchboxInsertionIOperators "/Herwig/MatrixElements/Matchbox/InsertionIOperators/"
0024 #define HERWIG_MatchboxInsertionPKOperators "/Herwig/MatrixElements/Matchbox/InsertionPKOperators/"
0025 
0026 /**
0027  * \ingroup Matchbox
0028  * \author Simon Platzer
0029  *
0030  * \brief Repository of known subtraction dipoles.
0031  */
0032 class DipoleRepository {
0033 
0034 public:
0035 
0036   /**
0037    * Return the known dipoles
0038    */
0039   static const vector<Ptr<SubtractionDipole>::ptr>& dipoles(int id) {
0040     return theDipoles(id);
0041   }
0042 
0043   /**
0044    * Return the known I insertion operators
0045    */
0046   static const vector<Ptr<MatchboxInsertionOperator>::ptr>& insertionIOperators(int id) {
0047     return theInsertionIOperators(id);
0048   }
0049 
0050   /**
0051    * Return the known PK insertion operators
0052    */
0053   static const vector<Ptr<MatchboxInsertionOperator>::ptr>& insertionPKOperators(int id) {
0054     return theInsertionPKOperators(id);
0055   }
0056 
0057 public:
0058 
0059   /**
0060    * Register a dipole with associated tilde kinematics
0061    */
0062   template<int id, class DipoleT, class TildeKinematicsT, class InvertedTildeKinematicsT>
0063   static void registerDipole(string name, string tildeName, string invertedTildeName) {
0064 
0065     setup();
0066 
0067     BaseRepository::PushDirectory(HERWIG_MatchboxTildes);
0068 
0069     typename Ptr<TildeKinematicsT>::ptr tilde;
0070     if ( !BaseRepository::GetPointer(HERWIG_MatchboxTildes + tildeName) ) {
0071       tilde = new_ptr(TildeKinematicsT());
0072       BaseRepository::Register(tilde,tildeName);
0073     } else {
0074       tilde = 
0075     dynamic_ptr_cast<typename Ptr<TildeKinematicsT>::ptr>
0076     (BaseRepository::GetPointer(HERWIG_MatchboxTildes + tildeName));
0077     }
0078 
0079     typename Ptr<InvertedTildeKinematicsT>::ptr itilde;
0080     if ( !BaseRepository::GetPointer(HERWIG_MatchboxTildes + invertedTildeName) ) {
0081       itilde = new_ptr(InvertedTildeKinematicsT());
0082       BaseRepository::Register(itilde,invertedTildeName);
0083     } else {
0084       itilde = 
0085     dynamic_ptr_cast<typename Ptr<InvertedTildeKinematicsT>::ptr>
0086     (BaseRepository::GetPointer(HERWIG_MatchboxTildes + invertedTildeName));
0087     }
0088 
0089     BaseRepository::PopDirectory();
0090     BaseRepository::PushDirectory(HERWIG_MatchboxDipoles);
0091 
0092     typename Ptr<DipoleT>::ptr dip = new_ptr(DipoleT());
0093     dip->tildeKinematics(tilde);
0094     dip->invertedTildeKinematics(itilde);
0095     BaseRepository::Register(dip,name);
0096 
0097     theDipoles(id).push_back(dip);
0098 
0099     BaseRepository::PopDirectory();
0100 
0101   }
0102 
0103   /**
0104    * Register an I insertion operator
0105    */
0106   template<int id, class InsertionOperatorT>
0107   static void registerInsertionIOperator(string name) {
0108 
0109     setup();
0110 
0111     BaseRepository::PushDirectory(HERWIG_MatchboxInsertionIOperators);
0112     typename Ptr<InsertionOperatorT>::ptr iop = new_ptr(InsertionOperatorT());
0113     BaseRepository::Register(iop,name);
0114 
0115     theInsertionIOperators(id).push_back(iop);
0116 
0117     BaseRepository::PopDirectory();
0118 
0119   }
0120 
0121   /**
0122    * Register an PK insertion operator
0123    */
0124   template<int id, class InsertionOperatorT>
0125   static void registerInsertionPKOperator(string name) {
0126 
0127     setup();
0128 
0129     BaseRepository::PushDirectory(HERWIG_MatchboxInsertionPKOperators);
0130     typename Ptr<InsertionOperatorT>::ptr iop = new_ptr(InsertionOperatorT());
0131     BaseRepository::Register(iop,name);
0132 
0133     theInsertionPKOperators(id).push_back(iop);
0134 
0135     BaseRepository::PopDirectory();
0136 
0137   }
0138 
0139 private:
0140 
0141   /**
0142    * The known dipoles
0143    */
0144   static vector<Ptr<SubtractionDipole>::ptr>& theDipoles(int id);
0145 
0146   /**
0147    * The known I insertion operators
0148    */
0149   static vector<Ptr<MatchboxInsertionOperator>::ptr>& theInsertionIOperators(int id);
0150 
0151   /**
0152    * The known PK insertion operators
0153    */
0154   static vector<Ptr<MatchboxInsertionOperator>::ptr>& theInsertionPKOperators(int id);
0155 
0156   /**
0157    * True, if initialized.
0158    */
0159   static bool& initialized();
0160 
0161   /**
0162    * Setup directories in the repository
0163    */
0164   static void setup();
0165 
0166 };
0167 
0168 }
0169 
0170 #endif // HERWIG_DipoleRepository_H