eic-smear
1.0.3
A collection of ROOT classes for Monte Carlo events and a fast-smearing code simulating detector effects for the Electron-Ion Collider task force
Main Page
Related Pages
Classes
Files
File List
File Members
EventDisFactory.cxx
Go to the documentation of this file.
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
ParticleIdentifier.h
Smear::Detector
Definition:
Detector.h:44
Smear::EventDisFactory::EventDisFactory
EventDisFactory(const Detector &, TBranch &)
Definition:
EventDisFactory.cxx:37
Smear::Detector::Smear
ParticleMCS * Smear(const erhic::VirtualParticle &) const
Definition:
Detector.cxx:132
erhic::VirtualParticle::GetStatus
virtual UShort_t GetStatus() const =0
ParticleMCS.h
erhic::VirtualEvent::GetNTracks
virtual UInt_t GetNTracks() const =0
EventDis.h
erhic::VirtualEvent::GetTrack
virtual const VirtualParticle * GetTrack(UInt_t) const =0
erhic::EventDis::BeamLepton
virtual const VirtualParticle * BeamLepton() const =0
Smear::Detector::FillEventKinematics
void FillEventKinematics(Event *event)
Definition:
Detector.cxx:82
VirtualParticle.h
Smear::EventDisFactory::~EventDisFactory
virtual ~EventDisFactory()
Definition:
EventDisFactory.cxx:34
erhic::EventDis::ScatteredLepton
virtual const VirtualParticle * ScatteredLepton() const =0
erhic::VirtualParticle::Get4Vector
virtual TLorentzVector Get4Vector() const =0
erhic::VirtualParticle::Id
virtual Pid Id() const =0
Smear::EventDisFactory::Create
virtual Event * Create()
Definition:
EventDisFactory.cxx:43
erhic::EventDis::BeamHadron
virtual const VirtualParticle * BeamHadron() const =0
erhic::VirtualParticle
Abstract base class for a general particle.
Definition:
VirtualParticle.h:23
EventDisFactory.h
Smear::ParticleMCS
Definition:
ParticleMCS.h:27
Smear::Event
Definition:
EventSmear.h:29
eic-smear
src
smear
EventDisFactory.cxx
Generated on Thu Jul 24 2014 15:18:40 for eic-smear by
1.8.7