thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.2.1
DiagramBase.h
1 // -*- C++ -*-
2 //
3 // DiagramBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2019 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_DiagramBase_H
10 #define ThePEG_DiagramBase_H
11 // This is the declaration of the DiagramBase class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "ThePEG/PDT/ParticleData.h"
15 #include "ThePEG/MatrixElement/ColourLines.h"
16 #include "ThePEG/Handlers/StandardXComb.fh"
17 #include "DiagramBase.fh"
18 #include "DiagramBase.xh"
19 
20 namespace ThePEG {
21 
41 class DiagramBase: public Base {
42 
43 public:
44 
51 
55  virtual ~DiagramBase();
57 
58 public:
59 
69  virtual tPVector construct(SubProPtr sb, const StandardXComb &,
70  const ColourLines &) const = 0;
72 
79  int nIncoming() const { return theNIncoming; }
80 
85  const cPDVector& partons() const { return thePartons; }
86 
90  int id() const { return theId; }
91 
96  string getTag() const;
97 
102  virtual bool isSame (tcDiagPtr other) const {
103  return
104  nIncoming() == other->nIncoming() &&
105  partons() == other->partons();
106  }
108 
109 protected:
110 
123  void partons(int ninc, const cPDVector & parts, int newId) {
124  theNIncoming = ninc;
125  thePartons = parts;
126  theId = newId;
127  }
128 
133  void diagramInfo(int ninc, int newId) {
134  theNIncoming = ninc;
135  theId = newId;
136  }
137 
142  bool done() const { return nIncoming() >= 0; }
143 
147  void addParton(tcPDPtr pd) { thePartons.push_back(pd); }
148 
149 public:
150 
157  void persistentOutput(PersistentOStream & os) const;
158 
164  void persistentInput(PersistentIStream & is, int version);
166 
170  static void Init();
171 
172 private:
173 
178 
184 
188  int theId;
189 
190 private:
191 
196 
200  DiagramBase & operator=(const DiagramBase &) = delete;
201 
202 };
203 
204 }
205 
206 
207 namespace ThePEG {
208 
215 template <>
216 struct BaseClassTrait<DiagramBase,1>: public ClassTraitsType {
218  typedef Base NthBase;
219 };
220 
225 template <>
226 struct ClassTraits<DiagramBase>: public ClassTraitsBase<DiagramBase> {
228  static string className() { return "ThePEG::DiagramBase"; }
229 };
230 
233 }
234 
235 #endif /* ThePEG_DiagramBase_H */
int nIncoming() const
Return the number of incoming partons for this diagram.
Definition: DiagramBase.h:79
PersistentIStream is used to read persistent objects from a stream where they were previously written...
Define the base class from which all (polymorphic) classes in ThePEG are derived. ...
Definition: ThePEG.h:54
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
int theId
The id number of this diagram.
Definition: DiagramBase.h:188
int theNIncoming
The number of incoming partons for this diagram.
Definition: DiagramBase.h:177
void partons(int ninc, const cPDVector &parts, int newId)
To be used by sub classes to report the incoming and outgoing particle types, and an id number...
Definition: DiagramBase.h:123
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
A concreate implementation of ClassDescriptionBase describing an abstract class with persistent data...
void addParton(tcPDPtr pd)
Add to the partons.
Definition: DiagramBase.h:147
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
virtual bool isSame(tcDiagPtr other) const
Compare this diagram to another one modulo the ids of the diagrams.
Definition: DiagramBase.h:102
virtual ~DiagramBase()
Destructor.
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
int id() const
Return the id number of this diagram.
Definition: DiagramBase.h:90
DiagramBase & operator=(const DiagramBase &)=delete
Private and non-existent assignment operator.
This is the main config header file for ThePEG.
const cPDVector & partons() const
Return the incoming, followed by the outgoing partons for this diagram.
Definition: DiagramBase.h:85
The StandardXComb class inherits from the more general XComb class which stores all information about...
Definition: StandardXComb.h:53
static void Init()
Standard Init function.
void persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
vector< cPDPtr > cPDVector
A vector of pointers to const ParticleData objects.
Definition: Containers.h:36
void persistentInput(PersistentIStream &is, int version)
Function used to read in object persistently.
bool done() const
Returns true if the partons(int, const cPDVector &, int) function has been called properly from the s...
Definition: DiagramBase.h:142
string getTag() const
Generate a tag which is unique for diagrams with the same type of incoming and outgoing partons...
cPDVector thePartons
The incoming, followed by the outgoing partons for this diagram.
Definition: DiagramBase.h:183
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
DiagramBase()
Default constructor.
Definition: DiagramBase.h:50
DiagramBase is the base class of all classes which describes Feynman diagrams which can be generated ...
Definition: DiagramBase.h:41
The ColourLines class defines the colour flow in a SubProcess.
Definition: ColourLines.h:23
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
static AbstractClassDescription< DiagramBase > initDiagramBase
Describe an abstract base class with persistent data.
Definition: DiagramBase.h:195
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52
virtual tPVector construct(SubProPtr sb, const StandardXComb &, const ColourLines &) const =0
Construct a sub process corresponding to this diagram.
void diagramInfo(int ninc, int newId)
Complete the missing information, provided partons() has already been filled.
Definition: DiagramBase.h:133