thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
Collision.h
1// -*- C++ -*-
2//
3// Collision.h is a part of ThePEG - Toolkit for HEP Event Generation
4// Copyright (C) 1999-2019 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
12
13#include "EventConfig.h"
14#include "Particle.h"
15#include "StandardSelectors.h"
17#include "ThePEG/Vectors/LorentzRotation.h"
18
19namespace ThePEG {
20
35
36public:
37
41 friend class EventHandler;
43 friend class Event;
45 friend class Step;
46
47public:
48
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 }
65
70
71public:
72
80
85
90 tcEventBasePtr handler() const { return theHandler; }
91
96 tEventPtr event() const { return theEvent; }
97
108 template <class OutputIterator>
109 void select(OutputIterator r, const SelectorBase & s) const;
110
116 template <class OutputIterator>
117 void selectFinalState(OutputIterator r) const {
119 }
120
126 tPVector ret;
127 selectFinalState(back_inserter(ret));
128 return ret;
129 }
130
136 return subProcesses().empty()? SubProPtr(): subProcesses().front();
137 }
138
143 return theSubProcesses;
144 }
145
150 return steps().empty()? tcStepPtr(): tcStepPtr(steps().back());
151 }
152
157 return steps().empty()? StepPtr(): steps().back();
158 }
159
163 const StepVector & steps() const { return theSteps; }
164
168 tcStepPtr step(unsigned int i) const {
169 return i < steps().size()? tcStepPtr(theSteps[i]): tcStepPtr();
170 }
171
177 const PPair & incoming() const { return theIncoming; }
178
186
193 bool isRemnant(tPPtr p) const { return member(getRemnants(), p); }
194
196
200 const LorentzPoint & vertex() const { return theVertex; }
201
205 void vertex(const LorentzPoint & p) { theVertex = p; }
206
211
216 Energy2 m2() const {
217 return ( incoming().first->momentum() + incoming().second->momentum() ).m2();
218 }
219
227
234
239
243 void popStep();
244
246
247public:
248
253
258
262 static void Init();
263
264protected:
265
272
277
281 template <class Iterator>
282 void addParticles(Iterator first, Iterator last);
283
288
293
295
299 const ParticleSet & all() const { return allParticles; }
300
305 CollPtr clone() const;
306
314 void rebind(const EventTranslationMap & trans);
315
316private:
317
322
327
333
338
343
349
354
355private:
356
361
367
372 friend struct ClassTraits<Collision>;
373
377 Collision & operator=(const Collision &) = delete;
378
380 friend ostream & operator<<(ostream & os, const Collision & c);
381
382};
383
385ostream & operator<<(ostream &, const Collision &);
386
387
392template <>
393struct BaseClassTrait<Collision,1>: public ClassTraitsType {
395 typedef EventRecordBase NthBase;
396};
397
400template <>
401struct ClassTraits<Collision>: public ClassTraitsBase<Collision> {
403 static string className() { return "ThePEG::Collision"; }
405 static TPtr create() { return TPtr::Create(Collision()); }
406};
407
410}
411
412#ifndef ThePEG_TEMPLATES_IN_CC_FILE
413#include "Collision.tcc"
414#endif
415
416#endif /* ThePEG_Collision_H */
This is the main config header file for the Event classes.
contains the LorentzVector class.
This file contains declarations of standard selector classes.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
This is the decalaration of the Collision class.
Definition: Collision.h:34
void removeParticle(tPPtr)
Remove (recursively) the given Particle from the Collision.
void select(OutputIterator r, const SelectorBase &s) const
Extract particles from this Collision which satisfies the requirements given by an object of the Sele...
tcEventBasePtr theHandler
A pointer to the EventHandler which performed the generation of this Collision.
Definition: Collision.h:348
bool isRemnant(tPPtr p) const
Return true if the given particle is a remnant of the colliding particles.
Definition: Collision.h:193
tParticleSet getRemnants() const
Return the set of remnants in this collision.
void transform(const LorentzRotation &)
Transform all particles in this Collision.
void removeEntry(tPPtr p)
Remove a given Particle entry.
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
static ClassDescription< Collision > initCollision
Describe concrete class with persistent data.
Definition: Collision.h:360
void cleanSteps()
Remove all steps which have no new particles introduced in them.
void removeDecay(tPPtr)
Remove (recursively) the decay products from a given Particle and add the particle to the list of fin...
static void Init()
Standard Init function.
ParticleSet allParticles
A set of all particles in this Collision.
Definition: Collision.h:337
tPVector getFinalState() const
Extract all final state particles in this Collision.
Definition: Collision.h:125
~Collision()
The destructor.
tEventPtr event() const
Return a pointer to the Event to which this Collision belongs.
Definition: Collision.h:96
CollPtr clone() const
Clone this Collision.
void addParticles(Iterator first, Iterator last)
Add a range of particles to this Collision.
tcStepPtr finalStep() const
Return a const pointer to the last step in this Collission.
Definition: Collision.h:149
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...
void selectFinalState(OutputIterator r) const
Extract all final state particles in this Collision.
Definition: Collision.h:117
void addParticle(tPPtr p)
Add a particle to this Collision.
Collision & operator=(const Collision &)=delete
The assignment operator is private and not implemented.
StepVector theSteps
A vector of all steps in this Collision.
Definition: Collision.h:326
tSubProPtr primarySubProcess() const
Return a pointer to the primary SubProcess in this Collision.
Definition: Collision.h:135
const ParticleSet & all() const
Return a reference to the list of all particles in this Collision.
Definition: Collision.h:299
void addStep(tStepPtr s)
Add a new Step to this Collision.
void addSubProcess(tSubProPtr p)
Add a new SubProcess to this Collision.
PPair theIncoming
The pair of colliding particles.
Definition: Collision.h:321
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
void persistentInput(PersistentIStream &, int)
Standard functions for reading from a persistent stream.
SubProcessVector theSubProcesses
A vector of all sub-processes in this Collision.
Definition: Collision.h:332
tEventPtr theEvent
A pointer to the Event to which this Collision belongs.
Definition: Collision.h:342
const SubProcessVector & subProcesses() const
Return the possibly empty list of sub processes in this Collision.
Definition: Collision.h:142
void vertex(const LorentzPoint &p)
Set the vertex position of this Collision.
Definition: Collision.h:205
void popStep()
Remove the last Step in this Collision.
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
Collision()
Private default constructor must only be used by the PersistentIStream class via the ClassTraits<Coll...
Definition: Collision.h:366
const StepVector & steps() const
Return the vector of steps in this Collision.
Definition: Collision.h:163
void removeSubProcess(tSubProPtr p)
Remove a SubProcess from this Collision.
void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
friend ostream & operator<<(ostream &os, const Collision &c)
Output to a standard ostream.
const PPair & incoming() const
Return a reference to the pair of colliding particles in this Collision.
Definition: Collision.h:177
tStepPtr finalStep()
Return a pointer to the last step in this Collission.
Definition: Collision.h:156
Energy2 m2() const
Return the total invariant mass squared of the final-state particles in this Collision.
Definition: Collision.h:216
LorentzPoint theVertex
The vertex position of this Collision.
Definition: Collision.h:353
const LorentzPoint & vertex() const
Return the vertex position of this Collision.
Definition: Collision.h:200
The EventHandler is the base class used to implement event handlers in ThePEG.
Definition: EventHandler.h:63
The Event class contains all Particles produced in the generation of an event.
Definition: Event.h:37
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
PersistentIStream is used to read persistent objects from a stream where they were previously written...
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
RCPtr is a reference counted (smart) pointer.
Definition: RCPtr.h:60
static RCPtr Create()
Allocate and construct an object of class T and return a RCPtr to it.
Definition: RCPtr.h:120
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition: RCPtr.h:696
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition: RCPtr.h:519
Rebinder is a class associating pairs of pointers to objects.
Definition: Rebinder.h:27
Classes derived from the SelectorBase class are used to extract particles from an Event with Event::s...
Definition: SelectorBase.h:45
The Step class contains information of all particles present after certain step in the event generati...
Definition: Step.h:34
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
pair< PPtr, PPtr > PPair
A pair of pointers to Particle objects.
Definition: Containers.h:127
set< tPPtr, less< tPPtr > > tParticleSet
A set of transient pointers to Particle.
Definition: EventConfig.h:78
ThePEG::Ptr< Step >::transient_const_pointer tcStepPtr
Alias for a transient pointer to a const Step .
Definition: Pointers.h:85
Ptr< EventRecordBase >::transient_const_pointer tcEventBasePtr
Alias for a transient pointer to const EventRecordBase.
Definition: EventConfig.h:49
bool member(const Container &c, const Key &k)
Check if a given object is a part of a container.
Definition: std.h:126
set< PPtr, less< PPtr > > ParticleSet
A set of pointers to Particle.
Definition: EventConfig.h:76
ThePEG::Ptr< Event >::transient_pointer tEventPtr
Alias for a transient pointer to Event .
Definition: Pointers.h:83
vector< StepPtr > StepVector
A vector of pointers to Step.
Definition: EventConfig.h:82
ThePEG::Ptr< SubProcess >::pointer SubProPtr
Alias for a reference counted pointer to SubProcess .
Definition: Pointers.h:86
vector< T > & operator<<(vector< T > &tv, const U &u)
Overload the left shift operator for vector to push_back objects to a vector.
Definition: Containers.h:179
ThePEG::Ptr< Step >::pointer StepPtr
Alias for a reference counted pointer to Step .
Definition: Pointers.h:85
vector< SubProPtr > SubProcessVector
A vector of pointers to SubProcess.
Definition: EventConfig.h:84
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition: Containers.h:82
ParticleSelector< FinalStateSelector > SelectFinalState
Typedef to declare a selector used to extract all final state particles from an event.
BaseClassTraits describes the base classes of the templated class.
Definition: ClassTraits.h:156
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition: ClassTraits.h:161
Define the base class from which all (polymorphic) classes in ThePEG are derived.
Definition: ThePEG.h:54
static string className()
Return the name of class T.
Definition: ClassTraits.h:66
static TPtr create()
Create a T object and return a smart pointer to it.
Definition: ClassTraits.h:60
ThePEG::Ptr< T >::pointer TPtr
Alias for a reference counted pointer to T .
Definition: ClassTraits.h:54
ClassTraitsType is an empty, non-polymorphic, base class.
Definition: ClassTraits.h:30
The default concrete implementation of ClassTraitsBase.
Definition: ClassTraits.h:134