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
EventSmear.h
1 
9 #ifndef INCLUDE_EICSMEAR_HADRONIC_EVENTSMEAR_H_
10 #define INCLUDE_EICSMEAR_HADRONIC_EVENTSMEAR_H_
11 
12 #include <vector>
13 
14 #include <Rtypes.h> // For ClassDef macro
15 #include <TBranch.h>
16 
21 
22 namespace erhic {
23 namespace hadronic {
24 
28 class EventSmear : public VirtualEvent {
29  public:
33  virtual ~EventSmear();
34 
38  EventSmear();
39 
43  virtual const Smear::ParticleMCS* GetTrack(UInt_t) const;
44 
48  virtual Smear::ParticleMCS* GetTrack(UInt_t);
49 
53  virtual UInt_t GetNTracks() const;
54 
58  virtual void AddLast(Smear::ParticleMCS*);
59 
60  protected:
61  std::vector<Smear::ParticleMCS*> particles;
62 
63  ClassDef(erhic::hadronic::EventSmear, 1)
64 };
65 
66 } // namespace hadronic
67 } // namespace erhic
68 
69 namespace Smear {
70 
74 class HadronicEventBuilder : public EventFactory<erhic::hadronic::EventSmear> {
75  public:
79  virtual ~HadronicEventBuilder() { }
80 
86  HadronicEventBuilder(const Detector& d, TBranch& mcBranch)
87  : mDetector(d)
88  , mMcEvent(NULL) {
89  mcBranch.SetAddress(&mMcEvent);
90  }
91 
98  virtual EventType* Create() {
99  EventType* event = new EventType;
100  for (unsigned j(0); j < mMcEvent->GetNTracks(); j++) {
101  const erhic::VirtualParticle* ptr = mMcEvent->GetTrack(j);
102  if (ptr) {
103  event->AddLast(mDetector.Smear(*ptr));
104  } // if
105  } // for
106  return event;
107  }
108 
109  protected:
110  Detector mDetector;
111  erhic::hadronic::EventMC* mMcEvent;
112 };
113 
114 } // namespace Smear
115 
116 #endif // INCLUDE_EICSMEAR_HADRONIC_EVENTSMEAR_H_
virtual EventType * Create()
Definition: EventSmear.h:98
HadronicEventBuilder(const Detector &d, TBranch &mcBranch)
Definition: EventSmear.h:86
virtual UInt_t GetNTracks() const
Definition: EventSmear.cxx:32
virtual void AddLast(Smear::ParticleMCS *)
Definition: EventSmear.cxx:36
ParticleMCS * Smear(const erhic::VirtualParticle &) const
Definition: Detector.cxx:132
Abstract base class for a physics event.
Definition: VirtualEvent.h:25
virtual const ParticleMC * GetTrack(UInt_t) const
Definition: EventMC.cxx:29
virtual UInt_t GetNTracks() const
Definition: EventMC.cxx:37
virtual const Smear::ParticleMCS * GetTrack(UInt_t) const
Definition: EventSmear.cxx:24
Abstract base class for a general particle.