ATLAS Offline Software
Loading...
Searching...
No Matches
MarsParticle Class Reference

A class to describe a MARS particle read from an input ASCII file. More...

#include <MarsParticle.h>

Collaboration diagram for MarsParticle:

Public Member Functions

 MarsParticle ()
int read (std::vector< std::string > *eventAsStringVector)
 A function to read the values from a single row definition and fill the data members.
void print (bool beamGas)
 A function to print the contents of this particle.
long eventNumber () const
 A function to return the event number of this particle.
int particleId () const
 A function to return the particle identify of this particle.
double kineticEnergy () const
 A function to return the relativistic kinetic energy of this particle.
double weight () const
 A function to return the weight associated with this particle in the input ASCII file.
HepMC::FourVector positionAtScoringPlane () const
 A function to the position of this particle with respect to the scoring plane.
HepMC::FourVector directionalCosines () const
 A function to return the directional cosines of this particle.
double timeOfFlight () const
 A function to return the time of flight for this particle.
double primaryProtonZ () const
 A function to return the primary proton Z position for this particle.
const MarsShowerPrimaryshowerPrimary () const
 A function to return the shower primary infomation for this particle.
MarsBeamGasInteraction beamGasInteraction () const
 A function to return the beam gas interaction information for this particle.
int pdgId ()
 A function to return the PDG id for this particle.

Private Attributes

long m_eventNumber
int m_particleId
double m_kineticEnergy
double m_weight
HepMC::FourVector m_positionAtScoringPlane
HepMC::FourVector m_directionalCosines
double m_timeOfFlight
double m_primaryProtonZ
MarsShowerPrimary m_showerPrimary
MarsBeamGasInteraction m_beamGasInteraction

Detailed Description

A class to describe a MARS particle read from an input ASCII file.

Author
W. H. Bell W.Bel.nosp@m.l@ce.nosp@m.rn.ch

Definition at line 55 of file MarsParticle.h.

Constructor & Destructor Documentation

◆ MarsParticle()

MarsParticle::MarsParticle ( )

Definition at line 23 of file MarsParticle.cxx.

23 : m_eventNumber(0),
24 m_particleId(0),
26 m_weight(0.),
33}
MarsShowerPrimary m_showerPrimary
double m_timeOfFlight
MarsBeamGasInteraction m_beamGasInteraction
double m_kineticEnergy
HepMC::FourVector m_positionAtScoringPlane
double m_primaryProtonZ
HepMC::FourVector m_directionalCosines

Member Function Documentation

◆ beamGasInteraction()

MarsBeamGasInteraction MarsParticle::beamGasInteraction ( ) const
inline

A function to return the beam gas interaction information for this particle.

Definition at line 103 of file MarsParticle.h.

103{ return m_beamGasInteraction; }

◆ directionalCosines()

HepMC::FourVector MarsParticle::directionalCosines ( ) const
inline

A function to return the directional cosines of this particle.

Definition at line 88 of file MarsParticle.h.

88{ return m_directionalCosines; }

◆ eventNumber()

long MarsParticle::eventNumber ( ) const
inline

A function to return the event number of this particle.

Definition at line 69 of file MarsParticle.h.

69{ return m_eventNumber; }

◆ kineticEnergy()

double MarsParticle::kineticEnergy ( ) const
inline

A function to return the relativistic kinetic energy of this particle.

Definition at line 76 of file MarsParticle.h.

76{ return m_kineticEnergy; }

◆ particleId()

int MarsParticle::particleId ( ) const
inline

A function to return the particle identify of this particle.

Definition at line 72 of file MarsParticle.h.

72{ return m_particleId; }

◆ pdgId()

int MarsParticle::pdgId ( )

A function to return the PDG id for this particle.

Definition at line 115 of file MarsParticle.cxx.

115 {
116 int pdgId = 0;
117
118 switch (m_particleId) {
119 case 1 : pdgId = 2212; break;
120 case 2 : pdgId = 2112; break;
121 case 3 : pdgId = 211; break;
122 case 4 : pdgId = -211; break;
123 case 5 : pdgId = 321; break;
124 case 6 : pdgId = -321; break;
125 case 7 : pdgId = -13; break;
126 case 8 : pdgId = 13; break;
127 case 9 : pdgId = 22; break;
128 case 10 : pdgId = 11; break;
129 case 11 : pdgId = -11; break;
130 case 12 : pdgId = -2212; break;
131 case 13 : pdgId = 111; break;
132 case 14 : pdgId = 1000010020; break; // Deuterium
133 case 15 : pdgId = 1000010030; break; // Tritium
134 case 16 : pdgId = 1000020030; break; // He3
135 case 17 : pdgId = 1000020040; break; // Alpha-(He4)
136 case 18 : pdgId = 14; break;
137 case 19 : pdgId = -14; break;
138 case 20 : pdgId = 12; break;
139 case 21 : pdgId = -12; break;
140 case 22 : pdgId = 130; break;
141 case 23 : pdgId = 310; break;
142 case 24 : pdgId = 311; break;
143 case 25 : pdgId = -311; break;
144 case 26 : pdgId = 3122; break;
145 case 27 : pdgId = -3122; break;
146 case 28 : pdgId = 3222; break;
147 case 29 : pdgId = 3212; break;
148 case 30 : pdgId = 3112; break;
149 case 31 : pdgId = -2112; break;
150 case 32 : pdgId = 3322; break;
151 case 33 : pdgId = 3312; break;
152 case 34 : pdgId = 3334; break;
153 case 35 : pdgId = -3112; break;
154 case 36 : pdgId = -3212; break;
155 case 37 : pdgId = -3222; break;
156 case 38 : pdgId = -3322; break;
157 case 39 : pdgId = -3312; break;
158 case 40 : pdgId = -3334; break;
159 default : pdgId = 0; break;
160 }
161
162 return pdgId;
163}
int pdgId()
A function to return the PDG id for this particle.

◆ positionAtScoringPlane()

HepMC::FourVector MarsParticle::positionAtScoringPlane ( ) const
inline

A function to the position of this particle with respect to the scoring plane.

Definition at line 84 of file MarsParticle.h.

◆ primaryProtonZ()

double MarsParticle::primaryProtonZ ( ) const
inline

A function to return the primary proton Z position for this particle.

Definition at line 95 of file MarsParticle.h.

95{ return m_primaryProtonZ; }

◆ print()

void MarsParticle::print ( bool beamGas)

A function to print the contents of this particle.

If the beamGas value is true then the beam gas information is printed.

Definition at line 80 of file MarsParticle.cxx.

80 {
81 std::cout.fill(' ');
82 std::cout.width(11); std::cout << m_eventNumber << " ";
83 std::cout.width(6); std::cout << m_particleId << " ";
84 std::cout.width(12); std::cout.precision(5); std::cout << std::scientific << m_kineticEnergy << " ";
85 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_weight << " ";
86 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_positionAtScoringPlane.x() << " ";
87 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_positionAtScoringPlane.y() << " ";
88 std::cout.width(14); std::cout.precision(7); std::cout << std::scientific << m_directionalCosines.x() << " ";
89 std::cout.width(14); std::cout.precision(7); std::cout << std::scientific << m_directionalCosines.y() << " ";
90 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_timeOfFlight << " ";
91 std::cout.width(12); std::cout.precision(5); std::cout << std::scientific << m_primaryProtonZ << " ";
92 std::cout.width(12); std::cout.precision(5); std::cout << std::scientific << m_showerPrimary.position.z() << " ";
93 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_showerPrimary.position.x() << " ";
94 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_showerPrimary.position.y() << " ";
95 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_showerPrimary.kineticEnergy << " ";
96 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_showerPrimary.weight << " ";
97 std::cout.fill(' ');
98 std::cout.width(3); std::cout << m_showerPrimary.particleId << " ";
99 std::cout.width(3); std::cout << m_showerPrimary.processId;
100
101 if(beamGas) {
102 std::cout << " ";
103 std::cout.width(3); std::cout << m_beamGasInteraction.nevve << " ";
104 std::cout.width(3); std::cout << m_beamGasInteraction.nucleusType << " ";
105 std::cout.width(11); std::cout.precision(4); std::cout << std::scientific << m_beamGasInteraction.timeOfFlight;
106 }
107
108 std::cout << std::endl;
109
110 std::cout.precision(6);
111}

◆ read()

int MarsParticle::read ( std::vector< std::string > * eventAsStringVector)

A function to read the values from a single row definition and fill the data members.

Definition at line 37 of file MarsParticle.cxx.

37 {
38 if(eventAsStringVector->size() != 17 &&
39 eventAsStringVector->size() != 20) {
40 std::cerr << "There are only " << eventAsStringVector->size() << " data words. This event will be null." << std::endl;
41 return 1;
42 }
43
44 double doubleValue;
45 std::vector<std::string>::iterator itr = eventAsStringVector->begin();
46 std::vector<std::string>::iterator itr_end = eventAsStringVector->end();
47 int wordNumber = 0;
48 for(;itr!=itr_end;++itr,++wordNumber) {
49 std::istringstream inStr((*itr));
50 switch (wordNumber) {
51 case 0 : inStr >> m_eventNumber; break;
52 case 1 : inStr >> m_particleId; break;
53 case 2 : inStr >> m_kineticEnergy; break;
54 case 3 : inStr >> m_weight; break;
55 case 4 : inStr >> doubleValue; m_positionAtScoringPlane.setX(doubleValue); break;
56 case 5 : inStr >> doubleValue; m_positionAtScoringPlane.setY(doubleValue); break;
57 case 6 : inStr >> doubleValue; m_directionalCosines.setX(doubleValue); break;
58 case 7 : inStr >> doubleValue; m_directionalCosines.setY(doubleValue); break;
59 case 8 : inStr >> m_timeOfFlight; break;
60 case 9 : inStr >> m_primaryProtonZ; break;
61 case 10 : inStr >> doubleValue; m_showerPrimary.position.setZ(doubleValue); break;
62 case 11 : inStr >> doubleValue; m_showerPrimary.position.setX(doubleValue); break;
63 case 12 : inStr >> doubleValue; m_showerPrimary.position.setY(doubleValue); break;
64 case 13 : inStr >> m_showerPrimary.kineticEnergy; break;
65 case 14 : inStr >> m_showerPrimary.weight; break;
66 case 15 : inStr >> m_showerPrimary.particleId; break;
67 case 16 : inStr >> m_showerPrimary.processId; break;
68 case 17 : inStr >> m_beamGasInteraction.nevve; break;
69 case 18 : inStr >> m_beamGasInteraction.nucleusType; break;
70 case 19 : inStr >> m_beamGasInteraction.timeOfFlight; break;
71 default : break;
72 }
73 }
74
75 return 0;
76}

◆ showerPrimary()

const MarsShowerPrimary & MarsParticle::showerPrimary ( ) const
inline

A function to return the shower primary infomation for this particle.

Definition at line 99 of file MarsParticle.h.

99{ return m_showerPrimary; }

◆ timeOfFlight()

double MarsParticle::timeOfFlight ( ) const
inline

A function to return the time of flight for this particle.

Definition at line 91 of file MarsParticle.h.

91{ return m_timeOfFlight; }

◆ weight()

double MarsParticle::weight ( ) const
inline

A function to return the weight associated with this particle in the input ASCII file.

Definition at line 80 of file MarsParticle.h.

80{ return m_weight; }

Member Data Documentation

◆ m_beamGasInteraction

MarsBeamGasInteraction MarsParticle::m_beamGasInteraction
private

Definition at line 118 of file MarsParticle.h.

◆ m_directionalCosines

HepMC::FourVector MarsParticle::m_directionalCosines
private

Definition at line 114 of file MarsParticle.h.

◆ m_eventNumber

long MarsParticle::m_eventNumber
private

Definition at line 109 of file MarsParticle.h.

◆ m_kineticEnergy

double MarsParticle::m_kineticEnergy
private

Definition at line 111 of file MarsParticle.h.

◆ m_particleId

int MarsParticle::m_particleId
private

Definition at line 110 of file MarsParticle.h.

◆ m_positionAtScoringPlane

HepMC::FourVector MarsParticle::m_positionAtScoringPlane
private

Definition at line 113 of file MarsParticle.h.

◆ m_primaryProtonZ

double MarsParticle::m_primaryProtonZ
private

Definition at line 116 of file MarsParticle.h.

◆ m_showerPrimary

MarsShowerPrimary MarsParticle::m_showerPrimary
private

Definition at line 117 of file MarsParticle.h.

◆ m_timeOfFlight

double MarsParticle::m_timeOfFlight
private

Definition at line 115 of file MarsParticle.h.

◆ m_weight

double MarsParticle::m_weight
private

Definition at line 112 of file MarsParticle.h.


The documentation for this class was generated from the following files: