File indexing completed on 2024-06-26 07:05:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include "eicsmear/smear/EventSmear.h"
0011
0012 #include <iostream>
0013 #include <vector>
0014
0015 namespace Smear {
0016
0017 Event::Event()
0018 : nTracks(0)
0019 , mScatteredIndex(-1) {
0020 }
0021
0022 Event::~Event() {
0023 ClearParticles();
0024 }
0025
0026 void Event::ClearParticles() {
0027 for (unsigned i(0); i < particles.size(); ++i) {
0028 if (GetTrack(i)) {
0029 delete GetTrack(i);
0030 }
0031 }
0032 }
0033
0034 void Event::Reset() {
0035 ClearParticles();
0036 *this = Event();
0037 }
0038
0039 void Event::AddLast(ParticleMCS* track) {
0040 particles.push_back(track);
0041 }
0042
0043
0044 const ParticleMCS* Event::ScatteredLepton() const {
0045 if (mScatteredIndex > -1 &&
0046 mScatteredIndex < static_cast<int>(GetNTracks())) {
0047 return GetTrack(mScatteredIndex);
0048 }
0049 return NULL;
0050 }
0051
0052
0053
0054
0055
0056 void Event::HadronicFinalState(ParticlePtrList& final) const {
0057
0058 for (unsigned i(2); i < GetNTracks(); ++i) {
0059 if (!GetTrack(i)) {
0060 continue;
0061 }
0062 if (GetTrack(i) != ScatteredLepton()) {
0063 final.push_back(GetTrack(i));
0064 }
0065 }
0066 }
0067
0068 std::vector<const erhic::VirtualParticle*> Event::GetTracks() const {
0069 std::vector<const erhic::VirtualParticle*> tracks;
0070 for (unsigned i(0); i < GetNTracks(); ++i) {
0071 tracks.push_back(GetTrack(i));
0072 }
0073 return tracks;
0074 }
0075
0076 void Event::SetScattered(int index) {
0077 if (index >= 0) {
0078 mScatteredIndex = index;
0079 }
0080 }
0081 void Event::Print(Option_t* ) const {
0082 std::cout <<
0083 "x: " << GetX() << std::endl <<
0084 "Q2: " << GetQ2() << std::endl <<
0085 "y: " << GetY() << std::endl;
0086 for (unsigned i(0); i < GetNTracks(); ++i) {
0087 if (GetTrack(i)) {
0088 GetTrack(i)->Print();
0089 }
0090 }
0091 }
0092
0093 }