SenecaShowerFileParticleIterator.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <utl/PhysicalConstants.h>
5 
6 
7 using namespace std;
8 using namespace utl;
9 using namespace io;
10 
11 
12 SenecaShowerFileParticleIterator::SenecaShowerFileParticleIterator(SenecaFileParser* const senecaParser) :
13  fCurrentParticle(utl::Particle::eUndefined,
14  utl::Particle::eShower,
15  Point(0,0,0, CoordinateSystem::GetRootCoordinateSystem()),
16  Vector(0,0,0, CoordinateSystem::GetRootCoordinateSystem()),
17  TimeInterval(0), 0)
18 {
19  fSenecaFile = senecaParser;
20 
21  const Status check = fSenecaFile->FileStatus();
22 
23  if (check != eSuccess) {
25  fIteratorValid = false;
26  } else {
28  fIteratorValid = true;
29  }
30 }
31 
32 
34  fCurrentParticle(utl::Particle::eUndefined,
35  utl::Particle::eShower,
36  Point(0,0,0, CoordinateSystem::GetRootCoordinateSystem()),
37  Vector(0,0,0, CoordinateSystem::GetRootCoordinateSystem()),
38  TimeInterval(0), 0)
39 {
40 }
41 
42 
44 {
45 }
46 
47 
48 Particle*
50 {
51  const Status check = fSenecaFile->ReadParticle();
52 
53  if (check != eSuccess)
54  return NULL;
55 
56  do
58  while (!fCurrentSenecaParticle);
59 
61 
62  return SenecaToDPAParticle(groundCS);
63 }
64 
65 
66 void
68 {
71 }
72 
73 
76 {
77  if (fCurrentSenecaParticle == NULL)
78  return NULL;
79 
80  const int particleID = SenecaToDPAParticle(fCurrentSenecaParticle->ID);
81 
82  if (particleID == utl::Particle::eUndefined)
83  return NULL;
84 
85  fCurrentParticle =
86  Particle(particleID, Particle::eShower,
87  Point(fCurrentSenecaParticle->X * m,
88  fCurrentSenecaParticle->Y * m,
89  0.0,
90  groundCS),
91  Vector(fCurrentSenecaParticle->Px * GeV,
92  fCurrentSenecaParticle->Py * GeV,
93  -fCurrentSenecaParticle->Pz * GeV,
94  groundCS),
95  TimeInterval(fCurrentSenecaParticle->T / .299 * ns), fCurrentSenecaParticle->Weight);
96 
97  return &fCurrentParticle;
98 }
99 
100 
101 int
103 {
104  switch (senecaParticleID) {
105  case 11:
107  case -11:
109  case 15:
110  return utl::Particle::eNuTau;
111  case -15:
113  case 13:
114  return utl::Particle::eNuMuon;
115  case -13:
117  case 10:
118  return utl::Particle::ePhoton;
119  case 12:
121  case -12:
123  case 14:
124  return utl::Particle::eMuon;
125  case -14:
127  case 110:
128  return utl::Particle::ePiZero;
129  case 120:
130  return utl::Particle::ePiPlus;
131  case -120:
133  case 220:
134  return utl::Particle::eEta;
135  case 130:
137  case -130:
139  case 230:
141  case -230:
143  case 330:
145  case 1120:
146  return utl::Particle::eProton;
147  case -1120:
149  case 1220:
151  case -1220:
153  case 1130:
155  case 1230:
157  case 2130:
158  return utl::Particle::eLambda;
159  case -2130:
161  case -20:
162  return utl::Particle::eKaon0L;
163  case 20:
164  return utl::Particle::eKaon0S;
165  default:
167  }
168 }
169 
170 
171 Status
173 {
174  fSenecaFile = senecaParser;
175 
176  const Status check = fSenecaFile->FileStatus();
177 
178  if (check != eSuccess) {
180  fIteratorValid = false;
181  } else {
183  fIteratorValid = true;
184  }
185 
186  return check;
187 }
SenecaParticleRecord * GetParticleRecord()
Point object.
Definition: Point.h:32
Describes a particle for Simulation.
Definition: Particle.h:26
unsigned int GetPosition()
Constructors for Transformer classes.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Status
Return code for seek operation.
Definition: IoCodes.h:24
const double ns
Status GotoPosition(unsigned int thePosition)
virtual void Rewind()
Rewind the particle list in the shower file to the beginning.
A TimeInterval is used to represent time elapsed between two events.
Definition: TimeInterval.h:43
constexpr double GeV
Definition: AugerUnits.h:187
Vector object.
Definition: Vector.h:30
Status SetSenecaFileParser(SenecaFileParser *const senecaParser)
virtual utl::Particle * GetOneParticle(const utl::CoordinateSystemPtr &groundCS)
Member function to fetch the next particle.
constexpr double m
Definition: AugerUnits.h:121

, generated on Tue Sep 26 2023.