Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //
0003 // SubProcess.h is a part of ThePEG - Toolkit for HEP Event Generation
0004 // Copyright (C) 1999-2019 Leif Lonnblad
0005 // Copyright (C) 2009-2019 Simon Platzer
0006 //
0007 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
0008 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
0009 //
0010 #ifndef ThePEG_SubProcess_H
0011 #define ThePEG_SubProcess_H
0012 // This is the declaration of the SubProcess class.
0013 
0014 
0015 #include <vector>
0016 #include "ThePEG/EventRecord/Particle.h"
0017 
0018 namespace ThePEG {
0019 
0020   class SubProcessGroup;
0021 
0022 /**
0023  * A SubProcess object represents a hard \f$2\rightarrow n\f$
0024  * sub-process in a collision. It carries information about the
0025  * incoming and outgoing particles, as well as possible intermediate
0026  * ones. It also has a pointer to the MEBase object which generated
0027  * the sub-process.
0028  *
0029  * @see Event
0030  * @see Particle
0031  * @see SubProcessGroup
0032  */
0033 class SubProcess: public EventRecordBase {
0034 
0035 public:
0036 
0037   /** Most of the Event classes are friends with each other. */
0038   friend class Step;
0039   /** Most of the Event classes are friends with each other. */
0040   friend class Collision;
0041   /** Most of the Event classes are friends with each other. */
0042   friend class SubProcessGroup;
0043 
0044 public:
0045 
0046   /**
0047    * Standard constructor.
0048    * @param newIncoming the two incoming partons.
0049    * @param newCollision the Collision to which this SubProcess belongs.
0050    * @param newHandler the MEBase object which generated this SubProcess.
0051    */
0052   SubProcess(const PPair & newIncoming,
0053          tCollPtr newCollision = tCollPtr(),
0054          tcEventBasePtr newHandler = tcEventBasePtr(),
0055          tSubProPtr newHead = tSubProPtr(),
0056          double newGroupWeight = 1.0);
0057 
0058   /**
0059    * Destructor.
0060    */
0061   virtual ~SubProcess();
0062 
0063   /**
0064    * A pointer to the MEBase object which generated this SubProcess.
0065    */
0066   tcEventBasePtr handler() const { return theHandler; }
0067 
0068   /**
0069    * A pointer to the collision to which this sub-process belongs.
0070    */
0071   tCollPtr collision() const { return theCollision; }
0072 
0073   /**
0074    * The pair of incoming partons.
0075    */
0076   const PPair & incoming() const { return theIncoming; }
0077 
0078   /**
0079    * A reference to the vector of intermediate partons.
0080    */
0081   const ParticleVector & intermediates() const { return theIntermediates; }
0082 
0083   /**
0084    * A reference to the vector of outgoing particles.
0085    */
0086   const ParticleVector & outgoing() const { return theOutgoing; }
0087 
0088   /**
0089    * Set the vector of outgoing particles.
0090    */
0091   template <class InputIterator>
0092   void setOutgoing(InputIterator, InputIterator);
0093 
0094   /**
0095    * Add a particle to the list of outgoing ones. If \a fixrelations
0096    * is true the mother daughter pointers will be set to/from the
0097    * incoming partons.
0098    */
0099   void addOutgoing(tPPtr p, bool fixrelations = true);
0100 
0101   /**
0102    * Change the incoming parton
0103    */
0104   void changeIncoming(tPPtr pnew, tPPtr pold); 
0105 
0106   /**
0107    * Set the vector of intermediate particles.
0108    */
0109   template <class InputIterator>
0110   void setIntermediates(InputIterator, InputIterator);
0111 
0112   /**
0113    * Add a particle to the list of intermediate ones. If \a fixrelations
0114    * is true the mother daughter pointers will be set to/from the
0115    * incoming partons.
0116    */
0117   void addIntermediate(tPPtr p, bool fixrelations = true);
0118 
0119   /**
0120    * Remove a particle entry from this sub-process.
0121    */
0122   void removeEntry(tPPtr p);
0123 
0124   /**
0125    * Return a clone of this sub process.
0126    */
0127   virtual SubProPtr clone() const;
0128 
0129   /**
0130    * True if a perturbative cascade has been applied to this sub
0131    * process.
0132    */
0133   bool decayed() const { return isDecayed; }
0134 
0135   /**
0136    * Set to true if a perturbative cascade has been applied to this
0137    * sub process.
0138    */
0139   void decayed(bool x) { isDecayed = x; }
0140 
0141   /**
0142    * Return the head SubProcess, if this SubProcess
0143    * object belongs to a SubProcessGroup. Return NULL
0144    * if head of a SubProcessGroup or not member of
0145    * a SubProcessGroup at all.
0146    */
0147   tSubProPtr head() const { return theHead; }
0148 
0149   /**
0150    * Set the head SubProcess
0151    */
0152   void head(tSubProPtr newHead) { theHead = newHead; }
0153 
0154   /**
0155    * If this SubProcess belongs to a SubProcessGroup,
0156    * return its relative weight w.r.t. the head's
0157    * weight.
0158    */
0159   double groupWeight() const { return theGroupWeight; }
0160 
0161   /**
0162    * If this SubProcess belongs to a SubProcessGroup,
0163    * set its relative weight w.r.t. the head's
0164    * weight.
0165    */
0166   void groupWeight(double w) { theGroupWeight = w; }
0167 
0168 protected:
0169 
0170   /**
0171    * Rebind to cloned objects. When a SubProcess is cloned, a shallow
0172    * copy is done first, then all <code>Particle</code>s etc, are
0173    * cloned, and finally this method is used to see to that the
0174    * pointers in the cloned SubProcess points to the cloned
0175    * <code>Particle</code>s etc.
0176    */
0177   virtual void rebind(const EventTranslationMap & trans);
0178 
0179 
0180 public:
0181 
0182   /**
0183    * Perform a LorentzTransformation of all particles in the sub
0184    * process.
0185    */
0186   virtual void transform(const LorentzRotation &);
0187 
0188   /**
0189    * Return the value of the Mandelstam variable \f$\hat{s}\f$ in this
0190    * SubProcess. It is calculated using the incoming particles.
0191    */
0192   Energy2 shat() const {
0193     return (incoming().first->momentum() + incoming().second->momentum()).m2();
0194   }
0195 
0196   /**
0197    * Return the value of the Mandelstam variable \f$\hat{t}\f$ in this
0198    * SubProcess. It is calculated using the first incoming and first outgoing
0199    * particle.
0200    */
0201   Energy2 that() const {
0202     return (incoming().first->momentum() - outgoing()[0]->momentum()).m2();
0203   }
0204 
0205   /**
0206    * Return the value of the Mandelstam variable \f$\hat{u}\f$ in this
0207    * SubProcess. It is calculated using the first incoming and last outgoing
0208    * particle.
0209    */
0210   Energy2 uhat() const {
0211     return (incoming().second->momentum() - outgoing()[0]->momentum()).m2();
0212   }
0213 
0214 public:
0215 
0216   /**
0217    * Standard function for writing to a persistent stream.
0218    */
0219   void persistentOutput(PersistentOStream &) const;
0220 
0221   /**
0222    * Standard function for reading from a persistent stream.
0223    */
0224   void persistentInput(PersistentIStream &, int);
0225 
0226   /**
0227    * Standard Init function. @see Base::Init().
0228    */
0229   static void Init();
0230 
0231 private:
0232 
0233   /**
0234    * A pointer to the MEBase object which generated this sub-process.
0235    */
0236   tcEventBasePtr theHandler;
0237 
0238   /**
0239    * A pointer to the collision to which this sub-process belongs.
0240    */
0241   tCollPtr theCollision;
0242 
0243   /**
0244    * The pair of incoming particles.
0245    */
0246   PPair theIncoming;
0247 
0248   /**
0249    * The vector of intermediate particles,
0250    */
0251   ParticleVector theIntermediates;
0252 
0253   /**
0254    * The vector of outgoing particles.
0255    */
0256   ParticleVector theOutgoing;
0257 
0258   /**
0259    * True if a perturbative cascade has been applied to this sub process.
0260    */
0261   bool isDecayed;
0262 
0263   /**
0264    * The head SubProcess, if this SubProcess
0265    * object belongs to a SubProcessGroup. NULL
0266    * if head of a SubProcessGroup or not member of
0267    * a SubProcessGroup at all.
0268    */
0269   tSubProPtr theHead;
0270 
0271   /**
0272    * If this SubProcess belongs to a SubProcessGroup,
0273    * this gives its relative weight w.r.t. the head's
0274    * weight.
0275    */
0276   double theGroupWeight;
0277 
0278 public:
0279 
0280   /**
0281    * Print out debugging information for this object on std::cerr. To
0282    * be called from within a debugger via the debug() function.
0283    */
0284   virtual void debugme() const;
0285 
0286   /**
0287    * Put to ostream
0288    */
0289   virtual void printMe(ostream&) const;
0290 
0291 private:
0292 
0293   /**
0294    * Default constructor
0295    */
0296   SubProcess() : isDecayed(false), theGroupWeight(1.0) {}
0297 
0298   /**
0299    * Describe concrete class with persistent data.
0300    */
0301   static ClassDescription<SubProcess> initSubProcess;
0302 
0303   /**
0304    * The ClassTraits<SubProcess> class must be a friend to be able to
0305    * use the private default constructor.
0306    */
0307   friend struct ClassTraits<SubProcess>;
0308 
0309   /**
0310    * Assignment is forbidden.
0311    */
0312   SubProcess & operator=(const SubProcess &) = delete;
0313 
0314 };
0315 
0316 /** Output a SubProcess to an ostream. */
0317 ostream & operator<<(ostream &, const SubProcess &);
0318 
0319 
0320 /** @cond TRAITSPECIALIZATIONS */
0321 
0322 /** This template specialization informs ThePEG about the
0323  *  base class of Collision. */
0324 template <>
0325 struct BaseClassTrait<SubProcess,1>: public ClassTraitsType {
0326   /** Typedef of the first base class of SubProcess. */
0327   typedef EventRecordBase NthBase;
0328 };
0329 
0330 /** This template specialization informs ThePEG about the name of
0331  *  the SubProcess class and how to create it. */
0332 template <>
0333 struct ClassTraits<SubProcess>: public ClassTraitsBase<SubProcess> {
0334   /** Return a platform-independent class name */
0335   static string className() { return "ThePEG::SubProcess"; }
0336   /** Create a SubProcess object. */
0337   static TPtr create() { return TPtr::Create(SubProcess()); }
0338 };
0339 
0340 /** @endcond */
0341 
0342 }
0343 
0344 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
0345 #include "SubProcess.tcc"
0346 #endif
0347 
0348 #endif /* ThePEG_SubProcess_H */