ThePEG
1.8.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
EventRecord
Event.h
1
// -*- C++ -*-
2
//
3
// Event.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_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
18
namespace
ThePEG {
19
36
class
Event
:
public
EventRecordBase
,
public
Named
{
37
38
public
:
39
43
friend
class
EventHandler
;
45
friend
class
Collision
;
46
48
typedef
map<tcColinePtr, int>
ColourLineMap
;
49
50
public
:
51
65
Event
(
const
PPair
& newIncoming,
tcEventBasePtr
newHandler =
tcEventBasePtr
(),
66
string
newName =
""
,
long
newNumber = -1,
double
weight
= 1.0);
67
71
Event
(
const
Event
&);
72
76
~Event
();
77
82
EventPtr
clone
()
const
;
83
84
public
:
85
90
tcEventBasePtr
handler
()
const
{
return
theHandler
; }
91
102
template
<
class
OutputIterator>
103
void
select
(OutputIterator r,
const
SelectorBase
& s)
const
;
104
110
template
<
class
OutputIterator>
111
void
selectFinalState
(OutputIterator r)
const
{
112
select
(r,
SelectFinalState
());
113
}
114
120
template
<
class
Container>
121
void
getFinalState
(Container & c)
const
{
122
selectFinalState
(
inserter
(c));
123
}
124
129
tPVector
getFinalState
()
const
{
130
tPVector
ret;
131
selectFinalState
(back_inserter(ret));
132
return
ret;
133
}
134
139
tCollPtr
primaryCollision
()
const
{
140
return
collisions
().empty() ?
tCollPtr
() :
tCollPtr
(
collisions
()[0]);
141
}
142
146
const
CollisionVector
&
collisions
()
const
{
return
theCollisions
; }
147
152
tSubProPtr
primarySubProcess
()
const
;
153
158
const
PPair
&
incoming
()
const
{
return
theIncoming
; }
159
161
165
tCollPtr
newCollision
();
166
172
tStepPtr
newStep
();
173
177
void
transform
(
const
LorentzRotation
&);
178
183
long
number
()
const
{
return
theNumber
; }
184
188
int
colourLineIndex
(
tcColinePtr
)
const
;
189
196
void
removeDecay
(
tPPtr
);
197
203
void
removeParticle
(
tPPtr
);
204
208
void
cleanSteps
();
209
211
215
double
weight
()
const
{
return
theWeight
; }
216
221
double
optionalWeight
(
const
string
&
name
)
const
;
222
226
const
map<string,double>&
optionalWeights
()
const
{
return
theOptionalWeights
; }
227
231
void
printGraphviz
()
const
;
232
236
void
weight
(
double
w) {
theWeight
= w; }
237
241
void
optionalWeight
(
const
string
&
name
,
double
value);
242
246
map<string,double>&
optionalWeights
() {
return
theOptionalWeights
; }
247
251
void
setInfo
(
tcEventBasePtr
newHandler,
string
newName,
252
long
newNumber,
double
weight
);
253
257
void
addCollision
(
tCollPtr
c);
258
262
void
primaryCollision
(
tCollPtr
c);
263
264
protected
:
265
269
template
<
class
Iterator>
270
void
addParticles
(Iterator first, Iterator last) {
271
while
( first != last )
addParticle
(*first++);
272
}
273
277
void
addParticle
(
tPPtr
p);
278
284
void
addSubProcess
(
tSubProPtr
p) {
285
if
( p )
allSubProcesses
.insert(p);
286
}
287
291
void
removeSubProcess
(
tSubProPtr
p) {
allSubProcesses
.erase(p); }
292
298
void
addStep
(
tStepPtr
s) {
299
if
( s )
allSteps
.insert(s);
300
}
301
305
void
removeEntry
(
tPPtr
p);
306
314
void
rebind
(
const
EventTranslationMap
& trans);
315
316
public
:
317
321
void
persistentOutput
(
PersistentOStream
&)
const
;
322
326
void
persistentInput
(
PersistentIStream
&,
int
);
327
331
static
void
Init
();
332
333
private
:
334
338
PPair
theIncoming
;
339
343
CollisionVector
theCollisions
;
344
348
StepSet
allSteps
;
349
353
SubProcessSet
allSubProcesses
;
354
358
ParticleSet
allParticles
;
359
364
tcEventBasePtr
theHandler
;
365
369
mutable
ColourLineMap
theColourLines
;
370
374
long
theNumber
;
375
379
double
theWeight
;
380
384
map<string,double>
theOptionalWeights
;
385
389
long
theParticleNumber
;
390
391
public
:
392
397
virtual
void
debugme
()
const
;
398
399
private
:
400
404
static
ClassDescription<Event>
initEvent
;
405
410
Event
() :
theNumber
(-1),
theWeight
(1.0),
theParticleNumber
(0) {}
411
416
friend
struct
ClassTraits
<
Event
>;
417
421
Event
&
operator=
(
const
Event
&);
422
423
};
424
426
ostream &
operator<<
(ostream &,
const
Event
&);
427
429
void
printGraphviz
(ostream &,
tcEventPtr
);
430
435
template
<>
436
struct
BaseClassTrait
<
Event
,1>:
public
ClassTraitsType
{
438
typedef
EventRecordBase
NthBase
;
439
};
440
443
template
<>
444
struct
ClassTraits<Event>:
public
ClassTraitsBase<Event> {
446
static
string
className
() {
return
"ThePEG::Event"
; }
448
static
TPtr
create
() {
return
TPtr::Create
(Event()); }
449
};
450
453
}
454
455
#include "Collision.h"
456
457
inline
ThePEG::tSubProPtr
ThePEG::Event::primarySubProcess
()
const
{
458
return
collisions
().empty() ?
ThePEG::tSubProPtr
() :
459
ThePEG::tSubProPtr
(
primaryCollision
()->
primarySubProcess
());
460
}
461
462
namespace
ThePEG {
463
template
<
class
OutputIterator>
464
void
Event::select
(OutputIterator r,
const
SelectorBase
& s)
const
{
465
if
( s.
allCollisions
() ) {
466
for
( CollisionVector::const_iterator it =
theCollisions
.begin();
467
it !=
theCollisions
.end(); ++it ) (**it).select(r, s);
468
}
else
{
469
primaryCollision
()->select(r, s);
470
}
471
}
472
}
473
474
#endif
/* ThePEG_Event_H */
Generated on Sat Jun 16 2012 16:51:04 for ThePEG by
1.8.1.1