thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
Step.h
1// -*- C++ -*-
2//
3// Step.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_BasicStep_H
10#define ThePEG_BasicStep_H
11// This is the declaration of the Step class.
12
13#include "ThePEG/EventRecord/Particle.h"
15
16namespace ThePEG {
17
34class Step: public EventRecordBase {
35
36public:
37
39 friend class Collision;
41 friend class Event;
42
43public:
44
51 Step(tCollPtr newCollision = tCollPtr(),
52 tcEventBasePtr newHandler = tcEventBasePtr())
53 : theCollision(newCollision), theHandler(newHandler) {}
54
58 Step(const Step &);
59
64
69 tcEventBasePtr handler() const { return theHandler; }
70
74 tCollPtr collision() const { return theCollision; }
75
84 template <typename OutputIterator>
85 void select(OutputIterator r, const SelectorBase & s) const;
86
92 template <typename OutputIterator>
93 void selectFinalState(OutputIterator r) const {
95 }
96
102 tPVector ret;
103 selectFinalState(back_inserter(ret));
104 return ret;
105 }
106
112 template <typename PIterator>
113 static vector<tPVector> getSinglets(PIterator first, PIterator last) {
114 tParticleSet left(first, last);
115 return getSinglets(left);
116 }
117
121 const ParticleSet & all() const { return allParticles; }
122
126 const ParticleSet & particles() const { return theParticles; }
127
131 const ParticleSet & intermediates() const { return theIntermediates; }
132
138 return theSubProcesses;
139 }
140
147 const PPair & incoming() const;
148
153 tPPtr find(tcPPtr p) const {
154 tPPtr r = const_ptr_cast<tPPtr>(p);
155 if ( !member(all(), r) ) return tPPtr();
156 return r;
157 }
158
159
169
177 bool setCopy(tcPPtr pold, tPPtr pnew);
178
189
201 bool addDecayProduct(tcPPtr parent, tPPtr child, bool fixColour = true);
202
216 template <typename CIterator>
218 CIterator firstChild, CIterator lastChild,
219 bool fixColour = true) {
220 for ( ; firstChild != lastChild; ++firstChild )
221 if ( !addDecayProduct(parent, *firstChild, fixColour) ) return false;
222 return true;
223 }
224
231 void addDecayNoCheck(tPPtr parent, tPPtr child);
232
240
245 bool removeDecayProduct(tcPPtr parent, tPPtr child);
246
251 template <typename CIterator>
253 CIterator firstChild, CIterator lastChild) {
254 bool success = true;
255 for ( ; firstChild != lastChild; ++firstChild )
256 if ( !removeDecayProduct(parent, *firstChild) ) success = false;
257 return success;
258 }
259
270 template <typename Iterator>
271 bool addDecayProduct(Iterator firstParent, Iterator lastParent, tPPtr child,
272 bool checkfinal = true);
273
282 template <typename PIterator, typename CIterator>
283 bool addDecayProduct(PIterator firstParent, PIterator lastParent,
284 CIterator firstChild, CIterator lastChild);
285
295
303 tPPtr colourNeighbour(tcPPtr particle, bool anti = false) const;
304
313
320 template <typename Iterator>
321 void addParticles(Iterator first, Iterator last);
322
330
339 template <typename Iterator>
340 void addIntermediates(Iterator first, Iterator last);
341
351
358 void insertIntermediate(tPPtr p, tPPtr parent, tPPtr child);
359
366
372
379
383 bool nullStep() const;
384
391 template <typename Cont>
392 tParticleSet getCurrent(const Cont & c) const {
393 return getCurrent(c.begin(), c.end());
394 }
395
402 template <typename Iterator>
403 tParticleSet getCurrent(Iterator first, Iterator last) const;
404
408 StepPtr clone() const;
409
410public:
411
420
424 static void Init();
425
426protected:
427
432 static vector<tPVector> getSinglets(tParticleSet &);
433
439
446 void rebind(const EventTranslationMap & trans);
447
453 template <typename Inserter, typename PPointer>
454 void addIfFinal(Inserter o, PPointer p);
455
456private:
457
461 Step & operator=(const Step &) = delete;
462
467
472
473private:
474
479
484
489
494
499
504
505public:
506
511 virtual void debugme() const;
512
513private:
514
519
520};
521
523ostream & operator<<(ostream &, const Step &);
524
526ThePEG_DECLARE_CLASS_TRAITS(Step,EventRecordBase);
529}
530
531#include "Collision.h"
532
533inline const ThePEG::PPair & ThePEG::Step::incoming() const {
534 return collision()->incoming();
535}
536
537#ifndef ThePEG_TEMPLATES_IN_CC_FILE
538#include "Step.tcc"
539#endif
540
541#endif /* ThePEG_BasicStep_H */
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
The Event class contains all Particles produced in the generation of an event.
Definition: Event.h:37
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
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
~Step()
The destructor.
ParticleSet allParticles
The set of all particles available in this step.
Definition: Step.h:493
void addParticle(tPPtr p)
Add a particle to this step.
void addIntermediate(tPPtr p)
Add an intermediate particle in this Step.
void select(OutputIterator r, const SelectorBase &s) const
Extract particles from this Step which satisfies the requirements given by an object of the SelectorB...
tParticleSet getCurrent(Iterator first, Iterator last) const
Get final state particles.
void handler(tcEventBasePtr sh)
Setup pointer to the step handler.
Definition: Step.h:471
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
void addDecayProduct(tPPtr child)
Add a particle to this Step.
void insertIntermediate(tPPtr p, tPPtr parent, tPPtr child)
Add an intermediate particle.
void removeParticle(tPPtr p)
Remove (recursively) the given Particle from the Step.
ParticleSet theIntermediates
The set of all intermediate particle in this step.
Definition: Step.h:483
static void Init()
Standard Init function.
const ParticleSet & all() const
A reference to the set of all particles in this step.
Definition: Step.h:121
tCollPtr collision() const
Return a pointer to the Collision to which this step belongs.
Definition: Step.h:74
StepPtr clone() const
Return a clone of this step.
bool addDecayProduct(PIterator firstParent, PIterator lastParent, CIterator firstChild, CIterator lastChild)
Add the children as a decay products of all the listed particles.
tPPtr copyParticle(tcPPtr p)
Copy a particle.
ParticleSet theParticles
The set of all outgoing particle in this step.
Definition: Step.h:478
tPPtr colourNeighbour(tcPPtr particle, bool anti=false) const
Return the (anti-)colour neighbour of the given particle if one exists in the final state of this Ste...
bool removeDecayProduct(tcPPtr parent, CIterator firstChild, CIterator lastChild)
Remove children form the given parent.
Definition: Step.h:252
void fixColourFlow()
Fix the colour flow of particles which have been added to this step and which have not already had th...
void addSubProcess(tSubProPtr)
Add a sub-process.
void addDecayNoCheck(tPPtr parent, tPPtr child)
Add a particle to this Step.
void removeSubProcess(tSubProPtr)
Remove a sub-process.
bool nullStep() const
Return true if no new particles were introduced in this step.
bool addDecayProduct(Iterator firstParent, Iterator lastParent, tPPtr child, bool checkfinal=true)
Add decay product.
tCollPtr theCollision
Pointer to the collision to which this step belongs.
Definition: Step.h:498
static vector< tPVector > getSinglets(tParticleSet &)
Used internally by the public getSinglets(...);.
const ParticleSet & intermediates() const
A reference to the set of intermediate particles in this step.
Definition: Step.h:131
bool addDecayProduct(tcPPtr parent, tPPtr child, bool fixColour=true)
Add decay product.
void addParticles(Iterator first, Iterator last)
Add a range of particles to this Step.
const SubProcessVector & subProcesses() const
A reference to the vector of sub-processes introduced in this step.
Definition: Step.h:137
void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
const PPair & incoming() const
Returns the colliding particles in the collision to which this step belongs.
Definition: Step.h:533
tcEventBasePtr handler() const
Return a pointer to the step handler which performed the generation of this step.
Definition: Step.h:69
SubProcessVector theSubProcesses
The vector of all sub-processes introduced in this step.
Definition: Step.h:488
void collision(tCollPtr c)
Setup pointer to the Collision.
Definition: Step.h:466
tParticleSet getCurrent(const Cont &c) const
Get final state particles.
Definition: Step.h:392
static ClassDescription< Step > initStep
Describe concrete class with persistent data.
Definition: Step.h:518
void removeEntry(tPPtr p)
Remove a particle entry from the step.
void addIfFinal(Inserter o, PPointer p)
Get final state particles.
tPPtr find(tcPPtr p) const
Get mutable particle.
Definition: Step.h:153
bool addDecayProduct(tcPPtr parent, CIterator firstChild, CIterator lastChild, bool fixColour=true)
Add decay products.
Definition: Step.h:217
tPPtr antiColourNeighbour(tcPPtr particle) const
Return the anti-colour neighbour of the given particle if one exists in the final state of this Step.
Step(const Step &)
The copy constructor.
tPVector getFinalState() const
Extract all final state particles in this Step.
Definition: Step.h:101
void addIntermediates(Iterator first, Iterator last)
Add a range of intermediate particles in this step.
Step & operator=(const Step &)=delete
Assignement is not allowed.
void persistentInput(PersistentIStream &, int)
Standard function for reading from a persistent stream.
tPPtr insertCopy(tcPPtr p)
Insert a copy.
bool setCopy(tcPPtr pold, tPPtr pnew)
Make particles copies of eachother.
virtual void debugme() const
Print out debugging information for this object on std::cerr.
Step(tCollPtr newCollision=tCollPtr(), tcEventBasePtr newHandler=tcEventBasePtr())
Standard constructor.
Definition: Step.h:51
const ParticleSet & particles() const
A reference to the set of outgoing particles in this step.
Definition: Step.h:126
void selectFinalState(OutputIterator r) const
Extract all final state particles in this Step.
Definition: Step.h:93
static vector< tPVector > getSinglets(PIterator first, PIterator last)
Return a vector of particle vectors with colour-connected partons, where each particle vector is in a...
Definition: Step.h:113
bool removeDecayProduct(tcPPtr parent, tPPtr child)
Remove the child form the given parent.
tcEventBasePtr theHandler
Pointer ot the step handler which performed this step.
Definition: Step.h:503
This is the main namespace within which all identifiers in ThePEG are declared.
Definition: FactoryBase.h:28
ThePEG::Ptr< Particle >::transient_pointer tPPtr
Alias for a transient pointer to Particle .
Definition: Pointers.h:67
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
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
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
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.
ThePEG::Ptr< Collision >::transient_pointer tCollPtr
Alias for a transient pointer to Collision .
Definition: Pointers.h:84
ostream & left(ostream &os)
Stream manipulator setting an ostream to left-adjust its ouput.
Definition: std.h:161
Define the base class from which all (polymorphic) classes in ThePEG are derived.
Definition: ThePEG.h:54