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 */