ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
BeamHaloParticle Class Reference

A class to describe a generic beam halo particle. More...

#include <BeamHaloParticle.h>

Collaboration diagram for BeamHaloParticle:

Public Member Functions

 BeamHaloParticle ()
 
 BeamHaloParticle (long pdgId, HepMC::FourVector fourVector, HepMC::FourVector positionAtScoringPlane, double weight)
 
 BeamHaloParticle (long pdgId, HepMC::FourVector fourVector, HepMC::FourVector positionAtScoringPlane, double weight, HepMC::FourVector positionAtPrimary)
 
 BeamHaloParticle (const BeamHaloParticle &beamHaloParticle)=default
 
BeamHaloParticleoperator= (const BeamHaloParticle &rhs)=default
 Assignment operator. More...
 
int fill (const HepPDT::ParticleDataTable *particleDataTable, MarsParticle *marsParticle)
 A function to fill the data members from an input MarsParticle object. More...
 
int fill (const HepPDT::ParticleDataTable *particleDataTable, FlukaParticle *flukaParticle)
 A function to fill the data members from an input FlukaParticle object. More...
 
void print ()
 A function to print the contents of this particle. More...
 
long pdgId () const
 A function to return the PDG id of this particle. More...
 
HepMC::FourVector fourVector () const
 A function to return the momentum fourvector of this particle. More...
 
HepMC::FourVector positionAtScoringPlane () const
 A function to return the position fourvector of this particle with respect to the scoring plane. More...
 
double weight () const
 A function to return the weight of this particle within the input beam background simulation file. More...
 
HepMC::FourVector positionAtPrimary () const
 A function to return the position fourvector of this particle with respect to the primary interaction. More...
 

Private Attributes

long m_pdgId
 The PDG Id of the particle. More...
 
HepMC::FourVector m_fourVector
 A four vector describing this particle at the scoring plane. More...
 
HepMC::FourVector m_positionAtScoringPlane
 Position of the particle at the scoring plane (x,y,z,t). More...
 
double m_weight
 The resultant particle weight after normalisation and rescaling. More...
 
HepMC::FourVector m_positionAtPrimary
 Position of the particle at the primary interaction point (x,y,z,y). More...
 

Detailed Description

A class to describe a generic beam halo particle.

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

Definition at line 22 of file BeamHaloParticle.h.

Constructor & Destructor Documentation

◆ BeamHaloParticle() [1/4]

BeamHaloParticle::BeamHaloParticle ( )

Definition at line 14 of file BeamHaloParticle.cxx.

14  : m_pdgId(0),
15  m_fourVector(),
17  m_weight(0.),
19 }

◆ BeamHaloParticle() [2/4]

BeamHaloParticle::BeamHaloParticle ( long  pdgId,
HepMC::FourVector  fourVector,
HepMC::FourVector  positionAtScoringPlane,
double  weight 
)

◆ BeamHaloParticle() [3/4]

BeamHaloParticle::BeamHaloParticle ( long  pdgId,
HepMC::FourVector  fourVector,
HepMC::FourVector  positionAtScoringPlane,
double  weight,
HepMC::FourVector  positionAtPrimary 
)

◆ BeamHaloParticle() [4/4]

BeamHaloParticle::BeamHaloParticle ( const BeamHaloParticle beamHaloParticle)
default

Member Function Documentation

◆ fill() [1/2]

int BeamHaloParticle::fill ( const HepPDT::ParticleDataTable *  particleDataTable,
FlukaParticle flukaParticle 
)

A function to fill the data members from an input FlukaParticle object.

Definition at line 113 of file BeamHaloParticle.cxx.

114  {
115  double p_sq, mod_p, pz, mass, energy;
116 
117  // Needed for debugging
118  //flukaParticle->print();
119 
120  m_pdgId = flukaParticle->pdgId();
121  if(!m_pdgId) {
122  std::cerr << "There is no PDG code for FLUKA id " << flukaParticle->flukaId() << std::endl;
123  return 1;
124  }
125 
126  // Read mass from pdg table
127  const HepPDT::ParticleData* particleData = particleDataTable->particle(HepPDT::ParticleID(std::abs(m_pdgId)));
128  mass = 0;
129  if(particleData) {
130  mass = particleData->mass().value();
131  }
132  else {
133  std::cerr << "PDG code " << m_pdgId << " is not in the particle data table." << std::endl;
134  return 1;
135  }
136 
137  // FLUKA uses GeV, convert to MeV then calculate |p|
138  // from relativistic kinetic energy (using c=1):
139  // KE = m - m_0 m^2 = p^2 + m_0^2
140  p_sq = std::pow(flukaParticle->kineticEnergy() * 1000.0 + mass, 2) - std::pow(mass,2);
141  mod_p = std::sqrt(p_sq);
142 
143  // Calculate px, py, pz from the directional cosines
144  m_fourVector.setX(flukaParticle->directionalCosines().x() * mod_p);
145  m_fourVector.setY(flukaParticle->directionalCosines().y() * mod_p);
146 
147  // If the z component of the directional cosine has not been set recalculate it.
148  if(std::abs(flukaParticle->directionalCosines().z()) < 0.0001) {
149  // Calculate pz from sqrt(p^2 - p_T^2)
150  pz = std::sqrt(p_sq - m_fourVector.perp2());
151  m_fourVector.setZ(pz); // This is always +ve. Corrected during conversion to HepParticle
152  }
153  else {
154  m_fourVector.setZ(flukaParticle->directionalCosines().z() * mod_p);
155  }
156 
157  // Calculate the energy
158  energy=std::sqrt(std::pow(mass,2)+std::pow(mod_p,2));
159  m_fourVector.setE(energy);
160 
161  // Convert the position from cm to mm.
162  m_positionAtScoringPlane.setX(flukaParticle->positionAtScoringPlane().x()*10.0); // Convert from cm to mm
163  m_positionAtScoringPlane.setY(flukaParticle->positionAtScoringPlane().y()*10.0); // Convert from cm to mm
164  m_positionAtScoringPlane.setZ(flukaParticle->positionAtScoringPlane().z()*10.0); // Convert from cm to mm
165  m_positionAtScoringPlane.setT(flukaParticle->positionAtScoringPlane().t());
166 
167  // Get the weight
168  m_weight = flukaParticle->weight();
169 
170  // Convert the position from cm to mm.
171  m_positionAtPrimary.setX(flukaParticle->positionAtPrimary().x()*10.0); // Convert from cm to mm
172  m_positionAtPrimary.setY(flukaParticle->positionAtPrimary().y()*10.0); // Convert from cm to mm
173  m_positionAtPrimary.setZ(flukaParticle->positionAtPrimary().z()*10.0); // Convert from cm to mm
174  m_positionAtPrimary.setT(flukaParticle->positionAtPrimary().t());
175 
176  // ATLAS: the x-axis points towards the centre of the LHC ring, the
177  // y-axis points upwards, and the z-axis points towards the airport
178  // and the Saleve, i.e. towards the A-side.
179  //
180  // R. Bruce fluka simulation: the x-axis points away from the
181  // center of the LHC ring, the y-axis points upwards, and the z-axis
182  // points along the beam line, but is positive for beam 1 and beam 2
183  // input files.
184  if(flukaParticle->type() == 0) {
185  m_fourVector.setX(-m_fourVector.x());
188  }
189 
190  return 0;
191 }

◆ fill() [2/2]

int BeamHaloParticle::fill ( const HepPDT::ParticleDataTable *  particleDataTable,
MarsParticle marsParticle 
)

A function to fill the data members from an input MarsParticle object.

Definition at line 52 of file BeamHaloParticle.cxx.

53  {
54  double p_sq, mod_p, pz, mass, energy;
55 
56  m_pdgId = marsParticle->pdgId();
57  if(!m_pdgId) {
58  std::cerr << "There is no PDG code for MARS id " << marsParticle->particleId() << std::endl;
59  return 1;
60  }
61 
62  // Read mass from pdg table
63  const HepPDT::ParticleData* particleData = particleDataTable->particle(HepPDT::ParticleID(std::abs(m_pdgId)));
64  mass = 0;
65  if(particleData) {
66  mass = particleData->mass().value();
67  }
68  else {
69  std::cerr << "PDG code " << m_pdgId << " is not in the particle data table." << std::endl;
70  return 1;
71  }
72 
73  // Mars uses GeV, convert to MeV then calculate |p|
74  // from relativistic kinetic energy (using c=1):
75  // KE = m - m_0 m^2 = p^2 + m_0^2
76  p_sq = std::pow(marsParticle->kineticEnergy() * 1000.0 + mass, 2) - std::pow(mass,2);
77  mod_p = std::sqrt(p_sq);
78 
79  // ATLAS: the x-axis points towards the centre of the LHC ring, the
80  // y-axis points upwards, and the z-axis points towards the airport
81  // and the Saleve, i.e. towards the A-side.
82  //
83  // MARS simulation: the x-axis points into the ground, the y-axis
84  // points out of the ring, and the z-axis points towards the Jura
85  // i.e. towards the C-side.
86 
87  // Calculate px and py from the directional cosines
88  m_fourVector.setX(-1.0 * marsParticle->directionalCosines().y() * mod_p);
89  m_fourVector.setY(-1.0 * marsParticle->directionalCosines().x() * mod_p);
90 
91  // Calculate pz from sqrt(p^2 - p_T^2)
92  pz = std::sqrt(p_sq - m_fourVector.perp2());
93  m_fourVector.setZ(pz); // This is always +ve. Corrected during conversion to HepParticle
94 
95  // Calculate the energy
96  energy=std::sqrt(std::pow(mass,2)+std::pow(mod_p,2));
97  m_fourVector.setE(energy);
98 
99  // Convert the position from cm to mm.
100  m_positionAtScoringPlane.setX(-1.0 * marsParticle->positionAtScoringPlane().y() * 10.0);
101  m_positionAtScoringPlane.setY(-1.0 * marsParticle->positionAtScoringPlane().x() * 10.0);
102  m_positionAtScoringPlane.setZ(0.0); // The information is not provided in the input file.
103  m_positionAtScoringPlane.setT(0.0); // Assume that this is t = 0
104 
105  // replace this with marsParticle->effectiveWeight();
106  m_weight = marsParticle->weight();
107 
108  return 0;
109 }

◆ fourVector()

HepMC::FourVector BeamHaloParticle::fourVector ( ) const
inline

A function to return the momentum fourvector of this particle.

Definition at line 62 of file BeamHaloParticle.h.

62 { return m_fourVector; }

◆ operator=()

BeamHaloParticle& BeamHaloParticle::operator= ( const BeamHaloParticle rhs)
default

Assignment operator.

◆ pdgId()

long BeamHaloParticle::pdgId ( ) const
inline

A function to return the PDG id of this particle.

Definition at line 58 of file BeamHaloParticle.h.

58 { return m_pdgId; }

◆ positionAtPrimary()

HepMC::FourVector BeamHaloParticle::positionAtPrimary ( ) const
inline

A function to return the position fourvector of this particle with respect to the primary interaction.

Definition at line 74 of file BeamHaloParticle.h.

74 { return m_positionAtPrimary; }

◆ positionAtScoringPlane()

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

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

Definition at line 66 of file BeamHaloParticle.h.

66 { return m_positionAtScoringPlane; }

◆ print()

void BeamHaloParticle::print ( )

A function to print the contents of this particle.

Definition at line 195 of file BeamHaloParticle.cxx.

195  {
196  std::cout.fill(' ');
197  std::cout.precision(6);
198  std::cout.width(11); std::cout << m_pdgId << " ";
199  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_fourVector.px() << " ";
200  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_fourVector.py() << " ";
201  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_fourVector.pz() << " ";
202  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_fourVector.e() << " ";
203  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.x() << " ";
204  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.y() << " ";
205  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.z() << " ";
206  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.t() << " ";
207  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_weight << std::endl;
208  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.x() << " ";
209  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.y() << " ";
210  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.z() << " ";
211  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.t() << std::endl;
212 }

◆ weight()

double BeamHaloParticle::weight ( ) const
inline

A function to return the weight of this particle within the input beam background simulation file.

Definition at line 70 of file BeamHaloParticle.h.

70 { return m_weight; }

Member Data Documentation

◆ m_fourVector

HepMC::FourVector BeamHaloParticle::m_fourVector
private

A four vector describing this particle at the scoring plane.

Definition at line 82 of file BeamHaloParticle.h.

◆ m_pdgId

long BeamHaloParticle::m_pdgId
private

The PDG Id of the particle.

Definition at line 79 of file BeamHaloParticle.h.

◆ m_positionAtPrimary

HepMC::FourVector BeamHaloParticle::m_positionAtPrimary
private

Position of the particle at the primary interaction point (x,y,z,y).

Definition at line 91 of file BeamHaloParticle.h.

◆ m_positionAtScoringPlane

HepMC::FourVector BeamHaloParticle::m_positionAtScoringPlane
private

Position of the particle at the scoring plane (x,y,z,t).

Definition at line 85 of file BeamHaloParticle.h.

◆ m_weight

double BeamHaloParticle::m_weight
private

The resultant particle weight after normalisation and rescaling.

Definition at line 88 of file BeamHaloParticle.h.


The documentation for this class was generated from the following files:
BeamHaloParticle::m_fourVector
HepMC::FourVector m_fourVector
A four vector describing this particle at the scoring plane.
Definition: BeamHaloParticle.h:82
MarsParticle::positionAtScoringPlane
HepMC::FourVector positionAtScoringPlane() const
A function to the position of this particle with respect to the scoring plane.
Definition: MarsParticle.h:84
BeamHaloParticle::m_positionAtScoringPlane
HepMC::FourVector m_positionAtScoringPlane
Position of the particle at the scoring plane (x,y,z,t).
Definition: BeamHaloParticle.h:85
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
FlukaParticle::flukaId
int flukaId(void) const
A function to return the FLUKA particle Id of this particle.
Definition: FlukaParticle.h:42
FlukaParticle::pdgId
int pdgId()
A function to return the PDG id of this particle.
Definition: FlukaParticle.cxx:128
FlukaParticle::positionAtPrimary
HepMC::FourVector positionAtPrimary(void) const
A function to return the position of the primary interaction.
Definition: FlukaParticle.h:67
MarsParticle::weight
double weight() const
A function to return the weight associated with this particle in the input ASCII file.
Definition: MarsParticle.h:80
MarsParticle::pdgId
int pdgId()
A function to return the PDG id for this particle.
Definition: MarsParticle.cxx:115
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
BeamHaloParticle::m_pdgId
long m_pdgId
The PDG Id of the particle.
Definition: BeamHaloParticle.h:79
BeamHaloParticle::positionAtPrimary
HepMC::FourVector positionAtPrimary() const
A function to return the position fourvector of this particle with respect to the primary interaction...
Definition: BeamHaloParticle.h:74
MarsParticle::kineticEnergy
double kineticEnergy() const
A function to return the relativistic kinetic energy of this particle.
Definition: MarsParticle.h:76
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
BeamHaloParticle::pdgId
long pdgId() const
A function to return the PDG id of this particle.
Definition: BeamHaloParticle.h:58
FlukaParticle::directionalCosines
HepMC::FourVector directionalCosines(void) const
A function to return the directional cosines of this particle.
Definition: FlukaParticle.h:58
Amg::pz
@ pz
Definition: GeoPrimitives.h:40
MarsParticle::particleId
int particleId() const
A function to return the particle identify of this particle.
Definition: MarsParticle.h:72
jobOptions.ParticleID
ParticleID
Definition: jobOptions.decayer.py:85
MarsParticle::directionalCosines
HepMC::FourVector directionalCosines() const
A function to return the directional cosines of this particle.
Definition: MarsParticle.h:88
BeamHaloParticle::m_positionAtPrimary
HepMC::FourVector m_positionAtPrimary
Position of the particle at the primary interaction point (x,y,z,y).
Definition: BeamHaloParticle.h:91
BeamHaloParticle::fourVector
HepMC::FourVector fourVector() const
A function to return the momentum fourvector of this particle.
Definition: BeamHaloParticle.h:62
FlukaParticle::weight
double weight(void) const
A function to return the particle or event weight.
Definition: FlukaParticle.h:61
FlukaParticle::positionAtScoringPlane
HepMC::FourVector positionAtScoringPlane(void) const
A function to return the fourvector position with respect to the scoring plane of this particle.
Definition: FlukaParticle.h:54
BeamHaloParticle::weight
double weight() const
A function to return the weight of this particle within the input beam background simulation file.
Definition: BeamHaloParticle.h:70
FlukaParticle::type
int type(void) const
A function to return the type of this FlukaParticle.
Definition: FlukaParticle.h:36
FlukaParticle::kineticEnergy
double kineticEnergy(void) const
A function to return the relativistic kinetic energy of this particle.
Definition: FlukaParticle.h:50
BeamHaloParticle::positionAtScoringPlane
HepMC::FourVector positionAtScoringPlane() const
A function to return the position fourvector of this particle with respect to the scoring plane.
Definition: BeamHaloParticle.h:66
BeamHaloParticle::m_weight
double m_weight
The resultant particle weight after normalisation and rescaling.
Definition: BeamHaloParticle.h:88