ThePEG  1.8.0
DiagramBase.h
1 // -*- C++ -*-
2 //
3 // DiagramBase.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 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  bool done() const { return nIncoming() >= 0; }
134 
135 public:
136 
143  void persistentOutput(PersistentOStream & os) const;
144 
150  void persistentInput(PersistentIStream & is, int version);
152 
156  static void Init();
157 
158 private:
159 
164 
170 
174  int theId;
175 
176 private:
177 
182 
186  DiagramBase & operator=(const DiagramBase &);
187 
188 };
189 
190 }
191 
192 
193 namespace ThePEG {
194 
201 template <>
202 struct BaseClassTrait<DiagramBase,1>: public ClassTraitsType {
204  typedef Base NthBase;
205 };
206 
211 template <>
212 struct ClassTraits<DiagramBase>: public ClassTraitsBase<DiagramBase> {
214  static string className() { return "ThePEG::DiagramBase"; }
215 };
216 
219 }
220 
221 #endif /* ThePEG_DiagramBase_H */
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:174
int theNIncoming
The number of incoming partons for this diagram.
Definition: DiagramBase.h:163
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 persistentOutput(PersistentOStream &os) const
Function used to write out object persistently.
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
bool done() const
Returns true if the partons(int, const cPDVector &, int) function has been called properly from the s...
Definition: DiagramBase.h:133
const cPDVector & partons() const
Return the incoming, followed by the outgoing partons for this diagram.
Definition: DiagramBase.h:85
int nIncoming() const
Return the number of incoming partons for this diagram.
Definition: DiagramBase.h:79
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.
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.
cPDVector thePartons
The incoming, followed by the outgoing partons for this diagram.
Definition: DiagramBase.h:169
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
DiagramBase()
Default constructor.
Definition: DiagramBase.h:50
string getTag() const
Generate a tag which is unique for diagrams with the same type of incoming and outgoing partons...
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:181
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
DiagramBase & operator=(const DiagramBase &)
Private and non-existent assignment operator.
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.