00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_Tree2toNDiagram_H
00010 #define ThePEG_Tree2toNDiagram_H
00011
00012
00013 #include "ThePEG/MatrixElement/DiagramBase.h"
00014 #include "ThePEG/MatrixElement/ColourLines.h"
00015 #include "ThePEG/Handlers/StandardXComb.fh"
00016 #include "Tree2toNDiagram.xh"
00017
00018 namespace ThePEG {
00019
00060 class Tree2toNDiagram: public DiagramBase {
00061
00062 public:
00063
00065 typedef cPDVector::size_type size_type;
00067 typedef multiset<tcPDPtr> PDMSet;
00068
00069 public:
00070
00076 Tree2toNDiagram()
00077 : theNSpace(0), theNOutgoing(0), nextOrig(0) {}
00078
00082 ~Tree2toNDiagram();
00083
00088 explicit Tree2toNDiagram(int space)
00089 : theNSpace(space), theNOutgoing(0), nextOrig(-1) {}
00091
00092 public:
00093
00098 Tree2toNDiagram & operator,(int o) {
00099 nextOrig = o - 1;
00100 if ( o < 0 ) check();
00101 return *this;
00102 }
00103
00107 Tree2toNDiagram & operator,(PDPtr pd) { return add(pd); }
00108
00112 Tree2toNDiagram & operator,(cPDPtr pd) { return add(pd); }
00113
00117 Tree2toNDiagram & operator,(tPDPtr pd) { return add(pd); }
00118
00122 Tree2toNDiagram & operator,(tcPDPtr pd) { return add(pd); }
00123
00131 virtual tPVector construct(SubProPtr sb, const StandardXComb &,
00132 const ColourLines &) const;
00133
00137 tcPDPair incoming() const;
00138
00142 const cPDVector & allPartons() const { return thePartons; }
00143
00147 tcPDVector outgoing() const;
00148
00153 tcPDVector external() const;
00154
00158 int parent(int i) const { return theParents[i]; }
00159
00163 pair<int,int> children(int) const;
00164
00168 int nSpace() const { return theNSpace; }
00169
00173 int nOutgoing() const { return theNOutgoing; }
00174
00175 private:
00176
00180 void check();
00181
00185 void addSpacelike(tcPDPtr pd) {
00186 if ( thePartons.size() >= theNSpace ) throw Tree2toNDiagramError();
00187 theParents.push_back(thePartons.size() - 1);
00188 thePartons.push_back(pd);
00189 }
00193 void addTimelike(tcPDPtr);
00194
00198 void addTimelike(tcPDPtr, size_type origin);
00199
00203 Tree2toNDiagram & add(tcPDPtr);
00204
00205 public:
00206
00213 void persistentOutput(PersistentOStream & os) const;
00214
00220 void persistentInput(PersistentIStream & is, int version);
00222
00223 private:
00224
00228 size_type theNSpace;
00229
00233 int theNOutgoing;
00234
00238 int nextOrig;
00239
00243 cPDVector thePartons;
00244
00248 vector<int> theParents;
00249
00250 private:
00251
00255 static ClassDescription<Tree2toNDiagram> initTree2toNDiagram;
00256
00260 Tree2toNDiagram & operator=(const Tree2toNDiagram &);
00261
00262 };
00263
00264 }
00265
00266 namespace ThePEG {
00267
00274 template <>
00275 struct BaseClassTrait<Tree2toNDiagram,1>: public ClassTraitsType {
00277 typedef DiagramBase NthBase;
00278 };
00279
00284 template <>
00285 struct ClassTraits<Tree2toNDiagram>: public ClassTraitsBase<Tree2toNDiagram> {
00287 static string className() { return "ThePEG::Tree2toNDiagram"; }
00288 };
00289
00292 }
00293
00294 #endif