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
EventDisFactory.cxx
Go to the documentation of this file.
1 
11 
12 #include <vector>
13 
14 #include <TBranch.h>
15 
20 
21 namespace {
22 
23 Smear::ParticleMCS* mcToSmear(const erhic::VirtualParticle& mc) {
25  mc.Id(), mc.GetStatus());
26  p->SetStatus(mc.GetStatus());
27  return p;
28 }
29 
30 } // anonymous namespace
31 
32 namespace Smear {
33 
35 }
36 
37 EventDisFactory::EventDisFactory(const Detector& d, TBranch& mcBranch)
38 : mDetector(d)
39 , mMcEvent(NULL) {
40  mcBranch.SetAddress(&mMcEvent);
41 }
42 
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.
76  return event;
77 }
78 
79 } // namespace Smear
erhic::EventDis::BeamHadron
virtual const VirtualParticle * BeamHadron() const =0
Returns a pointer to the incident hadron beam particle.
Smear::Detector::FillEventKinematics
void FillEventKinematics(Event *event)
Calculate event-wise smeared kinematics for an event which has already had its particles smeared and ...
Definition: Detector.cxx:82
Smear
Definition: Acceptance.cxx:16
erhic::EventDis::BeamLepton
virtual const VirtualParticle * BeamLepton() const =0
Returns a pointer to the incident lepton beam particle.
Smear::Event
Definition: smear/EventSmear.h:29
ParticleMCS.h
EventDis.h
erhic::VirtualEvent::GetNTracks
virtual UInt_t GetNTracks() const =0
Returns the number of tracks in the event.
erhic::VirtualParticle::GetStatus
virtual UShort_t GetStatus() const =0
A general "status" code for the particle (definition depends on implementation).
Smear::EventDisFactory::mMcEvent
erhic::EventDis * mMcEvent
Definition: EventDisFactory.h:56
erhic::EventDis::ScatteredLepton
virtual const VirtualParticle * ScatteredLepton() const =0
Returns a pointer to the lepton beam particle after scattering.
Smear::Detector
The detector structure.
Definition: Detector.h:44
Smear::ParticleMCS::SetStatus
virtual void SetStatus(Int_t)
Definition: ParticleMCS.h:257
VirtualParticle.h
erhic::VirtualParticle
Abstract base class for a general particle.
Definition: VirtualParticle.h:23
Smear::ParticleMCS
A smeared Monte Carlo particle.
Definition: ParticleMCS.h:27
erhic::VirtualEvent::GetTrack
virtual const VirtualParticle * GetTrack(UInt_t) const =0
Returns the nth track from the event.
Smear::EventDisFactory::mDetector
Detector mDetector
Definition: EventDisFactory.h:55
EventDisFactory.h
Smear::Detector::Smear
ParticleMCS * Smear(const erhic::VirtualParticle &) const
Detector level particle smearing.
Definition: Detector.cxx:132
Smear::EventDisFactory::Create
virtual Event * Create()
Create a smeared event corresponding to the current DIS Monte Carlo event in the input branch passed ...
Definition: EventDisFactory.cxx:43
Smear::EventDisFactory::EventDisFactory
EventDisFactory(const Detector &, TBranch &)
Constructor.
Definition: EventDisFactory.cxx:37
erhic::VirtualParticle::Get4Vector
virtual TLorentzVector Get4Vector() const =0
Returns the momentum-energy four-vector (px, py, pz, E).
Smear::EventDisFactory::~EventDisFactory
virtual ~EventDisFactory()
Destructor.
Definition: EventDisFactory.cxx:34
ParticleIdentifier.h
erhic::VirtualParticle::Id
virtual Pid Id() const =0
Returns identity information for the Particle species.