Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:38:21

0001 // -*- C++ -*-
0002 //
0003 // HelicityVertex.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 2003-2019 Peter Richardson, Leif Lonnblad
0005 //
0006 // ThePEG 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 ThePEG_HelicityVertex_H
0010 #define ThePEG_HelicityVertex_H
0011 // This is the declaration of the HelicityVertex class.
0012 
0013 #include "HelicityVertex.fh"
0014 #include "ThePEG/EventRecord/EventConfig.h"
0015 #include "ThePEG/Utilities/ClassDescription.h"
0016 #include "RhoDMatrix.h"
0017 #include "ThePEG/Utilities/Rebinder.h"
0018 #include "ThePEG/Helicity/HelicityDefinitions.h"
0019 
0020 namespace ThePEG {
0021 
0022 /**
0023  *  The HelicityVertex class is designed to store the helicity
0024  *  amplitude expression for the matrix element for use by the spin
0025  *  correlation algorithm. It implements the storage of the pointers
0026  *  to the incoming and outgoing particles at the vertex and virtual
0027  *  methods for calculating the rho and D matrices. The concrete
0028  *  implementations of the vertices for specific processes, eg
0029  *  production or decay, inherit from this and implement the storage
0030  *  of the matrix element together with the set and get methods.
0031  *
0032  *  These methods are then called by the SpinInfo class to perform the
0033  *  calculations.
0034  *
0035  *
0036  * @see SpinInfo
0037  *
0038  * @author Peter Richardson
0039  *
0040  */
0041 class HelicityVertex: public EventInfoBase {
0042 
0043 public:
0044 
0045   /**
0046    * Output the spin density matrix for debugging purposes.
0047    */
0048   friend ostream & operator<<(ostream & os, const HelicityVertex & vert);
0049 
0050 public:
0051 
0052   /** A vector of SpinInfo objects. */
0053   typedef vector<tcSpinPtr> SpinVector;
0054 
0055 public:
0056 
0057   /**
0058    * Standard Init function.
0059    */
0060   static void Init();
0061 
0062   /**
0063    * Rebind to cloned objects. If a HelicityVertex is cloned together
0064    * with a whole Event and this has pointers to other event record
0065    * objects, these should be rebound to their clones in this
0066    * function.
0067    */
0068   virtual void rebind(const EventTranslationMap & trans);
0069 
0070 public:
0071 
0072   /** @name Access the incoming and outgoing particles. */
0073   //@{
0074   /**
0075    * Access the spin of the incoming particles.
0076    */
0077   const SpinVector & incoming() const {return _incoming;}
0078 
0079   /**
0080    * Access the spin of the outgoing particles.
0081    */
0082   const SpinVector & outgoing() const {return _outgoing;}
0083 
0084   /**
0085    * Add the spin of an incoming particle.
0086    * @param spin the spin of the particle.
0087    * @param loc is set to the position in the list of incoming spins.
0088    */
0089   void addIncoming(tcSpinPtr spin, int & loc) {
0090     if(loc<0) {
0091       _incoming.push_back(spin);
0092       loc=_incoming.size()-1;
0093     }
0094     else {
0095       _incoming[loc] = spin;
0096     }
0097   }
0098 
0099   /**
0100    * Add the spin of an outgoing particle.
0101    * @param spin the spin of the particle.
0102    * @param loc is set to the position in the list of outgoing spins.
0103    */
0104   void addOutgoing(tcSpinPtr spin, int & loc) {
0105     if(loc<0) {
0106       _outgoing.push_back(spin);
0107       loc=_outgoing.size()-1;
0108     }
0109     else {
0110       _outgoing[loc]= spin;
0111     }
0112   }
0113 
0114   /**
0115    * Reset the \a spin of the incoming particle at position \a loc.
0116    */
0117   void resetIncoming(tcSpinPtr spin, int loc) {
0118     assert( loc < int(_incoming.size()) && loc >= 0 );
0119     _incoming[loc]=spin;
0120   }
0121 
0122   /**
0123    * Reset the \a spin of the outgoing particle at position \a loc.
0124    */
0125   void resetOutgoing(tcSpinPtr spin, int loc) {
0126     assert( loc < int(_outgoing.size()) && loc >= 0 );
0127     _outgoing[loc]=spin;
0128   }
0129   //@}
0130 
0131 public:
0132 
0133   /** @name Mthods to calculate rho and D matrices. */
0134   //@{
0135   /**
0136    * Get the rho matrix for the outgoing particle at position \a loc.
0137    */
0138   virtual RhoDMatrix getRhoMatrix(int loc,bool recursive) const = 0;
0139 
0140   /**
0141    * Get the D matrix for the incoming particle at position \a loc.
0142    */
0143   virtual RhoDMatrix getDMatrix(int loc) const = 0;
0144   //@}
0145 
0146 private:
0147 
0148   /**
0149    * Describe an abstract base class without persistent data.
0150    */
0151   static AbstractNoPIOClassDescription<HelicityVertex> initHelicityVertex;
0152 
0153   /**
0154    * Private and non-existent assignment operator.
0155    */
0156   HelicityVertex & operator=(const HelicityVertex &) = delete;
0157 
0158 private:
0159 
0160   /**
0161    * Pointers to the incoming particle spins at the vertex.
0162    */
0163   SpinVector _incoming;
0164 
0165   /**
0166    * Pointers to the outgoing particle spins at the vertex.
0167    */
0168   SpinVector _outgoing;
0169 
0170 };
0171 
0172 /**
0173  *  Output operator
0174  */
0175 inline ostream & operator<<(ostream & os, const HelicityVertex & vert) {
0176   os << "the incoming particles at the vertex are" << endl;
0177   for(unsigned int ix=0;ix<vert._incoming.size();++ix) {
0178     os << "the " << ix << " th incoming particle " << vert._incoming[ix] << "\n";
0179   }
0180   os << "the outgoing particles at the vertex are" << endl;
0181   for(unsigned int ix=0;ix<vert._outgoing.size();++ix) {
0182     os << "the " << ix << " th outgoing particle " << vert._outgoing[ix] << "\n";
0183   }
0184   return os;
0185 }
0186   
0187 }
0188 
0189 
0190 namespace ThePEG {
0191 
0192 /** @cond TRAITSPECIALIZATIONS */
0193 
0194   /**
0195    * This template specialization informs ThePEG about the
0196    * base class of HelicityVertex.
0197    */
0198   template <>
0199   struct BaseClassTrait<ThePEG::HelicityVertex,1>
0200     : public ClassTraitsType {
0201   /** Typedef of the base class of HelicityVertex. */
0202     typedef EventInfoBase NthBase;
0203   };
0204 
0205   /**
0206    * This template specialization informs ThePEG about the name of
0207    * the HelicityVertex class and the shared object where it is defined.
0208    */
0209 template <>
0210 struct ClassTraits<ThePEG::HelicityVertex>
0211   : public ClassTraitsBase<ThePEG::HelicityVertex> {
0212   /**
0213    * Return the class name.
0214    */
0215   static string className() { return "ThePEG::HelicityVertex"; }
0216 };
0217 
0218 /** @endcond */
0219 
0220 }
0221 
0222 #endif /* ThePEG_HelicityVertex_H */