ThePEG  1.8.0
SubProcess.h
1 // -*- C++ -*-
2 //
3 // SubProcess.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2011 Leif Lonnblad
5 // Copyright (C) 2009-2011 Simon Platzer
6 //
7 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
8 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
9 //
10 #ifndef ThePEG_SubProcess_H
11 #define ThePEG_SubProcess_H
12 // This is the declaration of the SubProcess class.
13 
14 
15 #include <vector>
16 #include "ThePEG/EventRecord/Particle.h"
17 
18 namespace ThePEG {
19 
20  class SubProcessGroup;
21 
33 class SubProcess: public EventRecordBase {
34 
35 public:
36 
38  friend class Step;
40  friend class Collision;
42  friend class SubProcessGroup;
43 
44 public:
45 
52  SubProcess(const PPair & newIncoming,
53  tCollPtr newCollision = tCollPtr(),
54  tcEventBasePtr newHandler = tcEventBasePtr(),
55  tSubProPtr newHead = tSubProPtr(),
56  double newGroupWeight = 1.0);
57 
61  virtual ~SubProcess();
62 
66  tcEventBasePtr handler() const { return theHandler; }
67 
71  tCollPtr collision() const { return theCollision; }
72 
76  const PPair & incoming() const { return theIncoming; }
77 
81  const ParticleVector & intermediates() const { return theIntermediates; }
82 
86  const ParticleVector & outgoing() const { return theOutgoing; }
87 
91  template <class InputIterator>
92  void setOutgoing(InputIterator, InputIterator);
93 
99  void addOutgoing(tPPtr p, bool fixrelations = true);
100 
104  void changeIncoming(tPPtr pnew, tPPtr pold);
105 
109  template <class InputIterator>
110  void setIntermediates(InputIterator, InputIterator);
111 
117  void addIntermediate(tPPtr p, bool fixrelations = true);
118 
122  void removeEntry(tPPtr p);
123 
127  virtual SubProPtr clone() const;
128 
133  bool decayed() const { return isDecayed; }
134 
139  void decayed(bool x) { isDecayed = x; }
140 
147  tSubProPtr head() const { return theHead; }
148 
152  void head(tSubProPtr newHead) { theHead = newHead; }
153 
159  double groupWeight() const { return theGroupWeight; }
160 
166  void groupWeight(double w) { theGroupWeight = w; }
167 
168 protected:
169 
177  virtual void rebind(const EventTranslationMap & trans);
178 
179 
180 public:
181 
186  virtual void transform(const LorentzRotation &);
187 
192  Energy2 shat() const {
193  return (incoming().first->momentum() + incoming().second->momentum()).m2();
194  }
195 
201  Energy2 that() const {
202  return (incoming().first->momentum() - outgoing()[0]->momentum()).m2();
203  }
204 
210  Energy2 uhat() const {
211  return (incoming().second->momentum() - outgoing()[0]->momentum()).m2();
212  }
213 
214 public:
215 
219  void persistentOutput(PersistentOStream &) const;
220 
224  void persistentInput(PersistentIStream &, int);
225 
229  static void Init();
230 
231 private:
232 
237 
242 
247 
252 
257 
261  bool isDecayed;
262 
270 
277 
278 public:
279 
284  virtual void debugme() const;
285 
289  virtual void printMe(ostream&) const;
290 
291 private:
292 
296  SubProcess() : isDecayed(false), theGroupWeight(1.0) {}
297 
302 
307  friend struct ClassTraits<SubProcess>;
308 
312  SubProcess & operator=(const SubProcess &);
313 
314 };
315 
317 ostream & operator<<(ostream &, const SubProcess &);
318 
319 
324 template <>
325 struct BaseClassTrait<SubProcess,1>: public ClassTraitsType {
327  typedef EventRecordBase NthBase;
328 };
329 
332 template <>
333 struct ClassTraits<SubProcess>: public ClassTraitsBase<SubProcess> {
335  static string className() { return "ThePEG::SubProcess"; }
337  static TPtr create() { return TPtr::Create(SubProcess()); }
338 };
339 
342 }
343 
344 #ifndef ThePEG_TEMPLATES_IN_CC_FILE
345 #include "SubProcess.tcc"
346 #endif
347 
348 #endif /* ThePEG_SubProcess_H */