thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
1 // -*- C++ -*-
2 //
3 // Collision.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2017 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_Collision_H
10 #define ThePEG_Collision_H
11 // This is the decalaration of the Collision class. It
13 #include "EventConfig.h"
14 #include "Particle.h"
15 #include "StandardSelectors.h"
17 #include "ThePEG/Vectors/LorentzRotation.h"
19 namespace ThePEG {
34 class Collision: public EventRecordBase {
36 public:
41  friend class EventHandler;
43  friend class Event;
45  friend class Step;
47 public:
59  Collision(const PPair & newIncoming, tEventPtr newEvent = tEventPtr(),
60  tcEventBasePtr newHandler = tcEventBasePtr())
61  : theIncoming(newIncoming), theEvent(newEvent), theHandler(newHandler) {
62  addParticle(incoming().first);
63  addParticle(incoming().second);
64  }
69  ~Collision();
71 public:
84  void addStep(tStepPtr s);
90  tcEventBasePtr handler() const { return theHandler; }
96  tEventPtr event() const { return theEvent; }
108  template <class OutputIterator>
109  void select(OutputIterator r, const SelectorBase & s) const;
116  template <class OutputIterator>
117  void selectFinalState(OutputIterator r) const {
118  select(r, SelectFinalState());
119  }
126  tPVector ret;
127  selectFinalState(back_inserter(ret));
128  return ret;
129  }
136  return subProcesses().empty()? SubProPtr(): subProcesses().front();
137  }
142  const SubProcessVector & subProcesses() const {
143  return theSubProcesses;
144  }
150  return steps().empty()? tcStepPtr(): tcStepPtr(steps().back());
151  }
157  return steps().empty()? StepPtr(): steps().back();
158  }
163  const StepVector & steps() const { return theSteps; }
168  tcStepPtr step(unsigned int i) const {
169  return i < steps().size()? tcStepPtr(theSteps[i]): tcStepPtr();
170  }
177  const PPair & incoming() const { return theIncoming; }
185  tParticleSet getRemnants() const;
193  bool isRemnant(tPPtr p) const { return member(getRemnants(), p); }
200  const LorentzPoint & vertex() const { return theVertex; }
205  void vertex(const LorentzPoint & p) { theVertex = p; }
210  void transform(const LorentzRotation &);
216  Energy2 m2() const {
217  return ( incoming().first->momentum() + incoming().second->momentum() ).m2();
218  }
226  void removeDecay(tPPtr);
233  void removeParticle(tPPtr);
238  void cleanSteps();
243  void popStep();
247 public:
252  void persistentOutput(PersistentOStream &) const;
257  void persistentInput(PersistentIStream &, int);
262  static void Init();
264 protected:
271  void addSubProcess(tSubProPtr p);
281  template <class Iterator>
282  void addParticles(Iterator first, Iterator last);
287  void addParticle(tPPtr p);
292  void removeEntry(tPPtr p);
299  const ParticleSet & all() const { return allParticles; }
305  CollPtr clone() const;
314  void rebind(const EventTranslationMap & trans);
316 private:
355 private:
372  friend struct ClassTraits<Collision>;
377  Collision & operator=(const Collision &) = delete;
380  friend ostream & operator<<(ostream & os, const Collision & c);
382 };
385 ostream & operator<<(ostream &, const Collision &);
392 template <>
393 struct BaseClassTrait<Collision,1>: public ClassTraitsType {
395  typedef EventRecordBase NthBase;
396 };
400 template <>
401 struct ClassTraits<Collision>: public ClassTraitsBase<Collision> {
403  static string className() { return "ThePEG::Collision"; }
405  static TPtr create() { return TPtr::Create(Collision()); }
406 };
410 }
413 #include "Collision.tcc"
414 #endif
416 #endif /* ThePEG_Collision_H */
const LorentzPoint & vertex() const
Return the vertex position of this Collision.
Definition: Collision.h:200
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
Energy2 m2() const
Return the total invariant mass squared of the final-state particles in this Collision.
Definition: Collision.h:216
StepVector theSteps
A vector of all steps in this Collision.
Definition: Collision.h:326
The EventHandler is the base class used to implement event handlers in ThePEG.
Definition: EventHandler.h:63
PPair theIncoming
The pair of colliding particles.
Definition: Collision.h:321
ThePEG::Ptr< SubProcess >::pointer SubProPtr
Alias for a reference counted pointer to SubProcess .
Definition: Pointers.h:86
vector< StepPtr > StepVector
A vector of pointers to Step.
Definition: EventConfig.h:82
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
static void Init()
Standard Init function.
This is the main config header file for the Event classes.
The Event class contains all Particles produced in the generation of an event.
Definition: Event.h:36
Classes derived from the SelectorBase class are used to extract particles from an Event with Event::s...
Definition: SelectorBase.h:45
void persistentInput(PersistentIStream &, int)
Standard functions for reading from a persistent stream.
set< tPPtr, less< tPPtr > > tParticleSet
A set of transient pointers to Particle.
Definition: EventConfig.h:78
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
bool member(const Container &c, const Key &k)
Check if a given object is a part of a container.
Definition: std.h:124
ParticleSet allParticles
A set of all particles in this Collision.
Definition: Collision.h:337
friend ostream & operator<<(ostream &os, const Collision &c)
Output to a standard ostream.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
void selectFinalState(OutputIterator r) const
Extract all final state particles in this Collision.
Definition: Collision.h:117
void removeSubProcess(tSubProPtr p)
Remove a SubProcess from this Collision.
SubProcessVector theSubProcesses
A vector of all sub-processes in this Collision.
Definition: Collision.h:332
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
Ptr< EventRecordBase >::transient_const_pointer tcEventBasePtr
Alias for a transient pointer to const EventRecordBase.
Definition: EventConfig.h:49
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
const SubProcessVector & subProcesses() const
Return the possibly empty list of sub processes in this Collision.
Definition: Collision.h:142
CollPtr clone() const
Clone this Collision.
Rebinder is a class associating pairs of pointers to objects.
Definition: Rebinder.h:27
const ParticleSet & all() const
Return a reference to the list of all particles in this Collision.
Definition: Collision.h:299
tEventPtr event() const
Return a pointer to the Event to which this Collision belongs.
Definition: Collision.h:96
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
void vertex(const LorentzPoint &p)
Set the vertex position of this Collision.
Definition: Collision.h:205
Collision & operator=(const Collision &)=delete
The assignment operator is private and not implemented.
static ClassDescription< Collision > initCollision
Describe concrete class with persistent data.
Definition: Collision.h:360
void addSubProcess(tSubProPtr p)
Add a new SubProcess to this Collision.
void transform(const LorentzRotation &)
Transform all particles in this Collision.
bool isRemnant(tPPtr p) const
Return true if the given particle is a remnant of the colliding particles.
Definition: Collision.h:193
Private default constructor must only be used by the PersistentIStream class via the ClassTraits<Coll...
Definition: Collision.h:366
tStepPtr newStep(tcEventBasePtr newHandler=tcEventBasePtr())
Create a new step in this collision, which is a copy of the last step (if any) and return a pointer t...
ThePEG::Ptr< Step >::transient_const_pointer tcStepPtr
Alias for a transient pointer to a const Step .
Definition: Pointers.h:85
void removeParticle(tPPtr)
Remove (recursively) the given Particle from the Collision.
tcEventBasePtr theHandler
A pointer to the EventHandler which performed the generation of this Collision.
Definition: Collision.h:348
set< PPtr, less< PPtr > > ParticleSet
A set of pointers to Particle.
Definition: EventConfig.h:76
tStepPtr finalStep()
Return a pointer to the last step in this Collission.
Definition: Collision.h:156
void removeDecay(tPPtr)
Remove (recursively) the decay products from a given Particle and add the particle to the list of fin...
contains the LorentzVector class.
tParticleSet getRemnants() const
Return the set of remnants in this collision.
vector< SubProPtr > SubProcessVector
A vector of pointers to SubProcess.
Definition: EventConfig.h:84
void addStep(tStepPtr s)
Add a new Step to this Collision.
tSubProPtr primarySubProcess() const
Return a pointer to the primary SubProcess in this Collision.
Definition: Collision.h:135
void addParticle(tPPtr p)
Add a particle to this Collision.
pair< PPtr, PPtr > PPair
A pair of pointers to Particle objects.
Definition: Containers.h:127
void popStep()
Remove the last Step in this Collision.
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
void removeEntry(tPPtr p)
Remove a given Particle entry.
The destructor.
This is the decalaration of the Collision class.
Definition: Collision.h:34
tEventPtr theEvent
A pointer to the Event to which this Collision belongs.
Definition: Collision.h:342
LorentzPoint theVertex
The vertex position of this Collision.
Definition: Collision.h:353
void addParticles(Iterator first, Iterator last)
Add a range of particles to this Collision.
ThePEG::Ptr< Event >::transient_pointer tEventPtr
Alias for a transient pointer to Event .
Definition: Pointers.h:83
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134
tPVector getFinalState() const
Extract all final state particles in this Collision.
Definition: Collision.h:125
tcStepPtr finalStep() const
Return a const pointer to the last step in this Collission.
Definition: Collision.h:149
tcEventBasePtr handler() const
Return a pointer to the EventHandler which produced this Collision.
Definition: Collision.h:90
tcStepPtr step(unsigned int i) const
Return a pointer to a given Step in this Collision.
Definition: Collision.h:168
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
void select(OutputIterator r, const SelectorBase &s) const
Extract particles from this Collision which satisfies the requirements given by an object of the Sele...
This file contains declarations of standard selector classes.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
ParticleSelector< FinalStateSelector > SelectFinalState
Typedef to declare a selector used to extract all final state particles from an event.
ThePEG::Ptr< Step >::pointer StepPtr
Alias for a reference counted pointer to Step .
Definition: Pointers.h:85
Collision(const PPair &newIncoming, tEventPtr newEvent=tEventPtr(), tcEventBasePtr newHandler=tcEventBasePtr())
The standard constructor takes a pair of incoming particles as argument.
Definition: Collision.h:59
const PPair & incoming() const
Return a reference to the pair of colliding particles in this Collision.
Definition: Collision.h:177
void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
const StepVector & steps() const
Return the vector of steps in this Collision.
Definition: Collision.h:163
The templated ClassTraitsBase class defines a set of default information about classes used by ThePEG...
Definition: ClassTraits.h:52
The Step class contains information of all particles present after certain step in the event generati...
Definition: Step.h:34
void cleanSteps()
Remove all steps which have no new particles introduced in them.