EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EventDisFactory.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EventDisFactory.cxx
1
10
#include "
eicsmear/smear/EventDisFactory.h
"
11
12
#include <vector>
13
14
#include <TBranch.h>
15
16
#include "
eicsmear/erhic/EventDis.h
"
17
#include "
eicsmear/erhic/ParticleIdentifier.h
"
18
#include "
eicsmear/erhic/VirtualParticle.h
"
19
#include "
eicsmear/smear/ParticleMCS.h
"
20
21
namespace
{
22
23
Smear::ParticleMCS
* mcToSmear(
const
erhic::VirtualParticle
& mc) {
24
Smear::ParticleMCS
*
p
=
new
Smear::ParticleMCS
(mc.
Get4Vector
(),
25
mc.
Id
(), mc.
GetStatus
());
26
p->
SetStatus
(mc.
GetStatus
());
27
return
p
;
28
}
29
30
}
// anonymous namespace
31
32
namespace
Smear {
33
34
EventDisFactory::~EventDisFactory
() {
35
}
36
37
EventDisFactory::EventDisFactory
(
const
Detector
&
d
, TBranch& mcBranch)
38
: mDetector(d)
39
, mMcEvent(NULL) {
40
mcBranch.SetAddress(&
mMcEvent
);
41
}
42
43
Event
*
EventDisFactory::Create
() {
44
Event
*
event
=
new
Event
;
45
for
(
unsigned
j(0); j <
mMcEvent
->
GetNTracks
(); j++) {
46
const
erhic::VirtualParticle
* ptr =
mMcEvent
->
GetTrack
(j);
47
if
(!ptr) {
48
continue
;
49
}
// if
50
// If this is the scattered lepton, record the index.
51
// Set the index even if the particle turns out to be outside the
52
// acceptance (in which case it will just point to a NULL anyway).
53
if
(
mMcEvent
->
ScatteredLepton
() == ptr) {
54
ParticleMCS
* p =
mDetector
.
Smear
(*ptr);
55
if
(p) {
56
p->
SetStatus
(ptr->
GetStatus
());
57
event
->SetScattered(j);
58
}
// if
59
event
->AddLast(p);
60
// Only set the index if the scattered electron is detected
61
}
else
if
(
mMcEvent
->
BeamLepton
() == ptr ||
62
mMcEvent
->
BeamHadron
() == ptr) {
63
// It's convenient to keep the initial beams, unsmeared, in the
64
// smeared event record, so copy their properties exactly
65
event
->AddLast(mcToSmear(*ptr));
66
}
else
{
67
ParticleMCS
* p =
mDetector
.
Smear
(*ptr);
68
if
(p) {
69
p->
SetStatus
(ptr->
GetStatus
());
70
}
// if
71
event
->AddLast(p);
72
}
// if
73
}
// for
74
// Fill the event-wise kinematic variables.
75
mDetector
.
FillEventKinematics
(event);
76
return
event;
77
}
78
79
}
// namespace Smear
eic-smear
blob
master
src
smear
EventDisFactory.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:32
using
1.8.2 with
EIC GitHub integration