ThePEG  1.8.0
DecayMode.h
1 // -*- C++ -*-
2 //
3 // DecayMode.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_DecayMode_H
10 #define ThePEG_DecayMode_H
11 // This is the declaration of the DecayMode class.
12 
13 #include "ThePEG/Config/ThePEG.h"
14 #include "ThePEG/Interface/Interfaced.h"
15 #include "DecayMode.fh"
16 #include "MatcherBase.h"
17 #include "Decayer.h"
18 
19 namespace ThePEG {
20 
24 
87 class DecayMode: public Interfaced {
88 
89 public:
90 
92  friend class ParticleData;
93 
95  friend class RemnantData;
96 
98  friend class EventGenerator;
99 
100 public:
101 
103  typedef vector<tcDMPtr> ModeVector;
105  typedef vector<tPDPair> LinkVector;
106 
107 public:
108 
116  static DMPtr constructDecayMode(string & tag, vector<DMPtr> * save = 0);
117 
123  DecayMode();
124 
128  DecayMode(const DecayMode &);
129 
133  ~DecayMode();
135 
140  virtual DMPtr clone(tPDPtr pd) const;
141 
142 public:
143 
148  const string & tag() const {
149  return theTag.size() ? theTag : ( theTag = makeTag() );
150  }
151 
156  tcPDPtr parent() const { return theParent; }
157 
161  const ParticleMSet & products() const { return theProducts; }
162 
166  const tPDVector & orderedProducts() const { return theOrderedProducts; }
167 
173  PVector produceProducts() const;
174 
179  const ModeMSet & cascadeProducts() const { return theCascadeProducts; }
180 
184  const MatcherMSet & productMatchers() const { return theMatchers; }
185 
191 
196  const ParticleMSet & excluded() const { return theExcluded; }
197 
201  double brat() const;
202 
206  double brat(const Particle &) const;
207 
211  tDecayerPtr decayer() const { return theDecayer; }
212 
216  bool includes(const DecayMode &) const;
217 
222  tDMPtr CC() const { return theAntiPartner; }
223 
228  bool operator == (const DecayMode & d) const {
229  return tag() == d.tag() ;
230  }
231 
236  const LinkVector & links() const { return theLinks; }
237 
241  const ModeVector & overlap() const { return theOverlap; }
242 
246  void synchronize();
247 
251  bool on() const { return isOn; }
252 
253 public:
254 
261  void persistentOutput(PersistentOStream & os) const;
262 
268  void persistentInput(PersistentIStream & is, int version);
270 
274  static void Init();
275 
276 protected:
277 
283  virtual void doupdate();
284 
294  virtual void rebind(const TranslationMap & trans)
295  ;
296 
302  virtual IVector getReferences();
304 
305 protected:
306 
311  void parent(tPDPtr pd) { theParent = pd; }
312 
316  void brat(double);
317 
321  void switchOn();
322 
326  void switchOff();
327 
332  void decayer(tDecayerPtr);
333 
337  void addProduct(tPDPtr);
338 
343  void addLink(tPDPtr a, tPDPtr b);
344 
349 
354 
358  void setWildMatcher(tPMPtr);
359 
364  void addExcluded(tPDPtr);
365 
369  static DMPtr Create(tPDPtr newParent, double newBrat = 0.0,
370  bool newOn = false);
374  DecayMode(tPDPtr newParticle, double newBrat, bool newOn);
375 
382  virtual IBPtr clone() const;
383 
388  virtual IBPtr fullclone() const;
390 
394  DMPtr dmclone() const;
395 
402  virtual void readSetup(istream & is);
403 
408 
414 
419 
425 
431 
436  void CC(tDMPtr cc) {theAntiPartner = cc;}
437 
438 private:
439 
443  bool addOverlap(tcDMPtr);
444 
448  void resetOverlap();
449 
453  bool compareId(const ParticleMSet &, const ParticleMSet &) const;
454 
458  ParticleMSet::const_iterator findId(const ParticleMSet &,
459  const ParticleData &) const;
460 
465  string makeTag() const;
466 
470  void resetTag() {
471  theTag = "";
472  if ( CC() ) CC()->theTag = "";
473  }
474 
475 
476 private:
477 
481  void setOn(long);
482 
486  long getOn() const;
487 
491  void setDecayer(DecayerPtr);
492 
493 private:
494 
498  mutable string theTag;
499 
503  double theBrat;
504 
508  bool isOn;
509 
515 
520 
525 
531 
537 
542 
548 
553 
558 
563 
569 
570 private:
571 
576 
580  DecayMode & operator=(const DecayMode &);
581 
582 };
583 
588 template <>
589 struct BaseClassTrait<DecayMode,1>: public ClassTraitsType {
591  typedef Interfaced NthBase;
592 };
593 
596 template <>
597 struct ClassTraits<DecayMode>:
598  public ClassTraitsBase<DecayMode> {
600  static string className() { return "ThePEG::DecayMode"; }
601 };
602 
605 }
606 
607 #endif /* ThePEG_DecayMode_H */