thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
EventRecord
Event.h
1
// -*- C++ -*-
2
//
3
// Event.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_Event_H
10
#define ThePEG_Event_H
11
// This is the decalaration of the Event class.
12
13
#include "Particle.h"
14
#include "
StandardSelectors.h
"
15
#include "SubProcess.h"
16
#include "ThePEG/Utilities/Named.h"
17
#include "ThePEG/Utilities/AnyReference.h"
18
19
namespace
ThePEG
{
20
37
class
Event
:
public
EventRecordBase
,
public
Named
{
38
39
public
:
40
44
friend
class
EventHandler
;
46
friend
class
Collision
;
47
49
typedef
map<tcColinePtr, int>
ColourLineMap
;
50
51
public
:
52
66
Event
(
const
PPair
& newIncoming,
tcEventBasePtr
newHandler =
tcEventBasePtr
(),
67
string
newName =
""
,
long
newNumber = -1,
double
weight
= 1.0);
68
72
Event
(
const
Event
&);
73
77
~Event
();
78
83
EventPtr
clone
()
const
;
84
85
public
:
86
91
tcEventBasePtr
handler
()
const
{
return
theHandler
; }
92
103
template
<
class
OutputIterator>
104
void
select
(OutputIterator r,
const
SelectorBase
& s)
const
;
105
111
template
<
class
OutputIterator>
112
void
selectFinalState
(OutputIterator r)
const
{
113
select
(r,
SelectFinalState
());
114
}
115
121
template
<
class
Container>
122
void
getFinalState
(Container & c)
const
{
123
selectFinalState
(
inserter
(c));
124
}
125
130
tPVector
getFinalState
()
const
{
131
tPVector
ret;
132
selectFinalState
(back_inserter(ret));
133
return
ret;
134
}
135
140
tCollPtr
primaryCollision
()
const
{
141
return
collisions
().empty() ?
tCollPtr
() :
tCollPtr
(
collisions
()[0]);
142
}
143
147
const
CollisionVector
&
collisions
()
const
{
return
theCollisions
; }
148
153
tSubProPtr
primarySubProcess
()
const
;
154
159
const
PPair
&
incoming
()
const
{
return
theIncoming
; }
160
162
166
tCollPtr
newCollision
();
167
173
tStepPtr
newStep
();
174
178
void
transform
(
const
LorentzRotation
&);
179
184
long
number
()
const
{
return
theNumber
; }
185
189
int
colourLineIndex
(
tcColinePtr
)
const
;
190
197
void
removeDecay
(
tPPtr
);
198
204
void
removeParticle
(
tPPtr
);
205
209
void
cleanSteps
();
210
212
216
double
weight
()
const
{
return
theWeight
; }
217
222
double
optionalWeight
(
const
string
&
name
)
const
;
223
227
const
map<string,double>&
optionalWeights
()
const
{
return
theOptionalWeights
; }
228
232
void
printGraphviz
()
const
;
233
237
void
weight
(
double
w) {
theWeight
= w; }
238
242
void
optionalWeight
(
const
string
&
name
,
double
value);
243
247
map<string,double>&
optionalWeights
() {
return
theOptionalWeights
; }
248
252
void
setInfo
(
tcEventBasePtr
newHandler,
string
newName,
253
long
newNumber,
double
weight
);
254
258
void
addCollision
(
tCollPtr
c);
259
263
void
primaryCollision
(
tCollPtr
c);
264
265
public
:
266
270
bool
hasMeta
(
const
string
&
id
)
const
{
271
return
theMeta
.find(
id
) !=
theMeta
.end();
272
}
273
277
template
<
class
T>
278
void
meta
(
const
string
&
id
, T& ref) {
279
theMeta
[id] =
AnyReference
(ref);
280
}
281
285
void
eraseMeta
(
const
string
&
id
) {
286
theMeta
.erase(
id
);
287
}
288
292
template
<
class
T>
293
T&
meta
(
const
string
&
id
)
const
{
294
return
theMeta
.find(
id
)->second.cast<T>();
295
}
296
297
protected
:
298
302
template
<
class
Iterator>
303
void
addParticles
(Iterator first, Iterator last) {
304
while
( first != last )
addParticle
(*first++);
305
}
306
310
void
addParticle
(
tPPtr
p);
311
317
void
addSubProcess
(
tSubProPtr
p) {
318
if
( p )
allSubProcesses
.insert(p);
319
}
320
324
void
removeSubProcess
(
tSubProPtr
p) {
allSubProcesses
.erase(p); }
325
331
void
addStep
(
tStepPtr
s) {
332
if
( s )
allSteps
.insert(s);
333
}
334
338
void
removeEntry
(
tPPtr
p);
339
347
void
rebind
(
const
EventTranslationMap
& trans);
348
349
public
:
350
354
void
persistentOutput
(
PersistentOStream
&)
const
;
355
359
void
persistentInput
(
PersistentIStream
&,
int
);
360
364
static
void
Init
();
365
366
private
:
367
371
PPair
theIncoming
;
372
376
CollisionVector
theCollisions
;
377
381
StepSet
allSteps
;
382
386
SubProcessSet
allSubProcesses
;
387
391
ParticleSet
allParticles
;
392
397
tcEventBasePtr
theHandler
;
398
402
mutable
ColourLineMap
theColourLines
;
403
407
long
theNumber
;
408
412
double
theWeight
;
413
417
map<string,double>
theOptionalWeights
;
418
422
long
theParticleNumber
;
423
427
map<string,AnyReference>
theMeta
;
428
429
public
:
430
435
virtual
void
debugme
()
const
;
436
437
private
:
438
442
static
ClassDescription<Event>
initEvent
;
443
448
Event
() :
theNumber
(-1),
theWeight
(1.0),
theParticleNumber
(0) {}
449
454
friend
struct
ClassTraits
<
Event
>;
455
459
Event
&
operator=
(
const
Event
&) =
delete
;
460
461
};
462
464
ostream &
operator<<
(ostream &,
const
Event
&);
465
467
void
printGraphviz
(ostream &,
tcEventPtr
);
468
473
template
<>
474
struct
BaseClassTrait
<
Event
,1>:
public
ClassTraitsType
{
476
typedef
EventRecordBase
NthBase
;
477
};
478
481
template
<>
482
struct
ClassTraits<Event>:
public
ClassTraitsBase<Event> {
484
static
string
className
() {
return
"ThePEG::Event"
; }
486
static
TPtr
create
() {
return
TPtr::Create
(Event()); }
487
};
488
491
}
492
493
#include "Collision.h"
494
495
inline
ThePEG::tSubProPtr
ThePEG::Event::primarySubProcess
()
const
{
496
return
collisions
().empty() ?
ThePEG::tSubProPtr
() :
497
ThePEG::tSubProPtr
(
primaryCollision
()->
primarySubProcess
());
498
}
499
500
namespace
ThePEG
{
501
template
<
class
OutputIterator>
502
void
Event::select
(OutputIterator r,
const
SelectorBase
& s)
const
{
503
if
( s.allCollisions() ) {
504
for
( CollisionVector::const_iterator it =
theCollisions
.begin();
505
it !=
theCollisions
.end(); ++it ) (**it).select(r, s);
506
}
else
{
507
primaryCollision
()->select(r, s);
508
}
509
}
510
}
511
512
#endif
/* ThePEG_Event_H */
StandardSelectors.h
This file contains declarations of standard selector classes.
ThePEG::AnyReference
AnyReference is inspired by boost::any to hold a reference to an object of arbitrary type.
Definition:
AnyReference.h:22
ThePEG::ClassDescription
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data.
Definition:
ClassDescription.h:333
ThePEG::Collision
This is the decalaration of the Collision class.
Definition:
Collision.h:34
ThePEG::EventHandler
The EventHandler is the base class used to implement event handlers in ThePEG.
Definition:
EventHandler.h:63
ThePEG::Event
The Event class contains all Particles produced in the generation of an event.
Definition:
Event.h:37
ThePEG::Event::initEvent
static ClassDescription< Event > initEvent
Describe concrete class with persistent data.
Definition:
Event.h:442
ThePEG::Event::clone
EventPtr clone() const
Returns a full clone of this Event.
ThePEG::Event::Event
Event(const Event &)
The copy constructor.
ThePEG::Event::primaryCollision
tCollPtr primaryCollision() const
Return a pointer to the primary Collision in this Event.
Definition:
Event.h:140
ThePEG::Event::select
void select(OutputIterator r, const SelectorBase &s) const
Extract particles from this event which satisfies the requirements given by an object of the Selector...
Definition:
Event.h:502
ThePEG::Event::eraseMeta
void eraseMeta(const string &id)
Erase meta information.
Definition:
Event.h:285
ThePEG::Event::incoming
const PPair & incoming() const
Return a reference to the pair of colliding particles in the primary Collision of this Event.
Definition:
Event.h:159
ThePEG::Event::persistentOutput
void persistentOutput(PersistentOStream &) const
Standard function for writing to a persistent stream.
ThePEG::Event::optionalWeight
double optionalWeight(const string &name) const
Return an optional named weight associated to this event.
ThePEG::Event::weight
void weight(double w)
Set the weight associated with this event.
Definition:
Event.h:237
ThePEG::Event::theHandler
tcEventBasePtr theHandler
A pointer to the EventHandler which performed the generation of this Event.
Definition:
Event.h:397
ThePEG::Event::theCollisions
CollisionVector theCollisions
A vector of collisions in this Event.
Definition:
Event.h:376
ThePEG::Event::Event
Event(const PPair &newIncoming, tcEventBasePtr newHandler=tcEventBasePtr(), string newName="", long newNumber=-1, double weight=1.0)
The standard constructor for an Event takes as arguments a pair of colliding particles (corresponding...
ThePEG::Event::theParticleNumber
long theParticleNumber
Counter to keep track of particle numbering.
Definition:
Event.h:422
ThePEG::Event::newCollision
tCollPtr newCollision()
Create a new Collision in this event and return a pointer to it.
ThePEG::Event::addParticles
void addParticles(Iterator first, Iterator last)
Add a range of particles to this Collision.
Definition:
Event.h:303
ThePEG::Event::primaryCollision
void primaryCollision(tCollPtr c)
Set the primary collision in this Event.
ThePEG::Event::ColourLineMap
map< tcColinePtr, int > ColourLineMap
Map colour lines to indices.
Definition:
Event.h:49
ThePEG::Event::optionalWeights
map< string, double > & optionalWeights()
Access the optional named weights associated to this event.
Definition:
Event.h:247
ThePEG::Event::removeDecay
void removeDecay(tPPtr)
Remove (recursively) the decay products from a given Particle and add the particle to the list of fin...
ThePEG::Event::getFinalState
void getFinalState(Container &c) const
Extract all final state particles in this Event.
Definition:
Event.h:122
ThePEG::Event::addSubProcess
void addSubProcess(tSubProPtr p)
Add a new SubProcess to this Event.
Definition:
Event.h:317
ThePEG::Event::cleanSteps
void cleanSteps()
Remove all steps which have no new particles introduced in them.
ThePEG::Event::meta
T & meta(const string &id) const
Retrieve meta information.
Definition:
Event.h:293
ThePEG::Event::theWeight
double theWeight
The weight associated with this event.
Definition:
Event.h:412
ThePEG::Event::printGraphviz
void printGraphviz() const
Print this Event in Graphviz format on the standard output.
ThePEG::Event::colourLineIndex
int colourLineIndex(tcColinePtr) const
Return the index of the given colour line.
ThePEG::Event::~Event
~Event()
The destructor.
ThePEG::Event::theMeta
map< string, AnyReference > theMeta
The meta information.
Definition:
Event.h:427
ThePEG::Event::allSteps
StepSet allSteps
A set of all particles in this Event.
Definition:
Event.h:381
ThePEG::Event::removeSubProcess
void removeSubProcess(tSubProPtr p)
Remove a SubProcess from this Event.
Definition:
Event.h:324
ThePEG::Event::allSubProcesses
SubProcessSet allSubProcesses
A set of all sub-processes in this Event.
Definition:
Event.h:386
ThePEG::Event::setInfo
void setInfo(tcEventBasePtr newHandler, string newName, long newNumber, double weight)
Set event info.
ThePEG::Event::optionalWeights
const map< string, double > & optionalWeights() const
Return the optional named weights associated to this event.
Definition:
Event.h:227
ThePEG::Event::Event
Event()
Private default constructor must only be used by the PersistentIStream class via the ClassTraits<Even...
Definition:
Event.h:448
ThePEG::Event::operator=
Event & operator=(const Event &)=delete
The assignment operator is private and not implemented.
ThePEG::Event::optionalWeight
void optionalWeight(const string &name, double value)
Set an optional named weight associated to this event.
ThePEG::Event::number
long number() const
Return the number assigned to this Event.
Definition:
Event.h:184
ThePEG::Event::getFinalState
tPVector getFinalState() const
Extract all final state particles in this Event.
Definition:
Event.h:130
ThePEG::Event::hasMeta
bool hasMeta(const string &id) const
Check for meta information.
Definition:
Event.h:270
ThePEG::Event::persistentInput
void persistentInput(PersistentIStream &, int)
Standard functions for reading from a persistent stream.
ThePEG::Event::collisions
const CollisionVector & collisions() const
Return a possibly empty list of collisions in this Event.
Definition:
Event.h:147
ThePEG::Event::removeEntry
void removeEntry(tPPtr p)
Remove a given Particle entry.
ThePEG::Event::addStep
void addStep(tStepPtr s)
Add a new Step to this Collision.
Definition:
Event.h:331
ThePEG::Event::removeParticle
void removeParticle(tPPtr)
Remove the given Particle from the Collision.
ThePEG::Event::primarySubProcess
tSubProPtr primarySubProcess() const
Return a pointer to the primary SubProcess in the prinmary Collision in this Event.
Definition:
Event.h:495
ThePEG::Event::theOptionalWeights
map< string, double > theOptionalWeights
Optional named weights.
Definition:
Event.h:417
ThePEG::Event::rebind
void rebind(const EventTranslationMap &trans)
Rebind to cloned objects.
ThePEG::Event::handler
tcEventBasePtr handler() const
Return a pointer to the EventHandler which produced this Event.
Definition:
Event.h:91
ThePEG::Event::debugme
virtual void debugme() const
Print out debugging information for this object on std::cerr.
ThePEG::Event::newStep
tStepPtr newStep()
Create a new Step in the current Collision, which is a copy of the last Step (if any) and return a po...
ThePEG::Event::selectFinalState
void selectFinalState(OutputIterator r) const
Extract all final state particles in this Event.
Definition:
Event.h:112
ThePEG::Event::transform
void transform(const LorentzRotation &)
Transform all particles in this Event.
ThePEG::Event::meta
void meta(const string &id, T &ref)
Set meta information.
Definition:
Event.h:278
ThePEG::Event::Init
static void Init()
Standard Init function.
ThePEG::Event::theNumber
long theNumber
The number assigned to this Event.
Definition:
Event.h:407
ThePEG::Event::allParticles
ParticleSet allParticles
A set of all particles in this Event.
Definition:
Event.h:391
ThePEG::Event::theColourLines
ColourLineMap theColourLines
Map of all registered colour lines to their index numbers.
Definition:
Event.h:402
ThePEG::Event::addCollision
void addCollision(tCollPtr c)
Add a collision to this Event.
ThePEG::Event::theIncoming
PPair theIncoming
The pair of colliding particles.
Definition:
Event.h:371
ThePEG::Event::addParticle
void addParticle(tPPtr p)
Add a particle to this Collision.
ThePEG::Event::weight
double weight() const
Return the weight associated with this event.
Definition:
Event.h:216
ThePEG::LorentzRotation
The LorentzRotation class combine a SpinOneLorentzRotation and a spin SpinHalfLorentzRotation to prov...
Definition:
LorentzRotation.h:27
ThePEG::Named
The Named class is a simple concrete base class to used by classes of objects with a name.
Definition:
Named.h:24
ThePEG::Named::name
const string & name() const
Return name.
Definition:
Named.h:42
ThePEG::PersistentIStream
PersistentIStream is used to read persistent objects from a stream where they were previously written...
Definition:
PersistentIStream.h:48
ThePEG::PersistentOStream
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
Definition:
PersistentOStream.h:51
ThePEG::Pointer::RCPtr
RCPtr is a reference counted (smart) pointer.
Definition:
RCPtr.h:60
ThePEG::Pointer::RCPtr::Create
static RCPtr Create()
Allocate and construct an object of class T and return a RCPtr to it.
Definition:
RCPtr.h:120
ThePEG::Pointer::TransientConstRCPtr
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
Definition:
RCPtr.h:696
ThePEG::Pointer::TransientRCPtr
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
Definition:
RCPtr.h:519
ThePEG::Rebinder
Rebinder is a class associating pairs of pointers to objects.
Definition:
Rebinder.h:27
ThePEG::SelectorBase
Classes derived from the SelectorBase class are used to extract particles from an Event with Event::s...
Definition:
SelectorBase.h:45
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::PPair
pair< PPtr, PPtr > PPair
A pair of pointers to Particle objects.
Definition:
Containers.h:127
ThePEG::tcEventBasePtr
Ptr< EventRecordBase >::transient_const_pointer tcEventBasePtr
Alias for a transient pointer to const EventRecordBase.
Definition:
EventConfig.h:49
ThePEG::ParticleSet
set< PPtr, less< PPtr > > ParticleSet
A set of pointers to Particle.
Definition:
EventConfig.h:76
ThePEG::StepSet
set< StepPtr, less< StepPtr > > StepSet
A set of pointers to Step.
Definition:
EventConfig.h:90
ThePEG::tSubProPtr
ThePEG::Ptr< SubProcess >::transient_pointer tSubProPtr
Alias for a transient pointer to SubProcess .
Definition:
Pointers.h:86
ThePEG::operator<<
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::CollisionVector
vector< CollPtr > CollisionVector
A vector of pointers to Collision.
Definition:
EventConfig.h:88
ThePEG::tPVector
vector< tPPtr > tPVector
A vector of transient pointers to Particle objects.
Definition:
Containers.h:82
ThePEG::SelectFinalState
ParticleSelector< FinalStateSelector > SelectFinalState
Typedef to declare a selector used to extract all final state particles from an event.
Definition:
StandardSelectors.h:94
ThePEG::tCollPtr
ThePEG::Ptr< Collision >::transient_pointer tCollPtr
Alias for a transient pointer to Collision .
Definition:
Pointers.h:84
ThePEG::printGraphviz
void printGraphviz(ostream &, tcEventPtr)
Print event tree in Graphviz format, ready for plotting.
ThePEG::inserter
std::insert_iterator< Cont > inserter(Cont &c)
Return an insert iterator for a given container.
Definition:
std.h:141
ThePEG::SubProcessSet
set< SubProPtr, less< SubProPtr > > SubProcessSet
A set of pointers to SubProcess.
Definition:
EventConfig.h:92
ThePEG::BaseClassTrait
BaseClassTraits describes the base classes of the templated class.
Definition:
ClassTraits.h:156
ThePEG::BaseClassTrait::NthBase
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
Definition:
ClassTraits.h:161
ThePEG::Base
Define the base class from which all (polymorphic) classes in ThePEG are derived.
Definition:
ThePEG.h:54
ThePEG::ClassTraitsBase::className
static string className()
Return the name of class T.
Definition:
ClassTraits.h:66
ThePEG::ClassTraitsBase::create
static TPtr create()
Create a T object and return a smart pointer to it.
Definition:
ClassTraits.h:60
ThePEG::ClassTraitsBase::TPtr
ThePEG::Ptr< T >::pointer TPtr
Alias for a reference counted pointer to T .
Definition:
ClassTraits.h:54
ThePEG::ClassTraitsType
ClassTraitsType is an empty, non-polymorphic, base class.
Definition:
ClassTraits.h:30
ThePEG::ClassTraits
The default concrete implementation of ClassTraitsBase.
Definition:
ClassTraits.h:134
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6