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

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

#include <FlukaParticle.h>

Collaboration diagram for FlukaParticle:

Public Types

enum  flukaParticleType { BRUCE, TALANOV }
 

Public Member Functions

 FlukaParticle (int type=0)
 
 FlukaParticle (const FlukaParticle &flukaParticle)=default
 
FlukaParticleoperator= (const FlukaParticle &flukaParticle)=default
 
int read (std::vector< std::string > *eventAsStringVector)
 A function to read the values from a single row definition and fill the data members. More...
 
void print (void)
 A function to print the contents of this particle. More...
 
void clear (void)
 A function to clear the values of this particle. More...
 
int type (void) const
 A function to return the type of this FlukaParticle. More...
 
long eventId (void) const
 A function to return the FLUKA event Id of this particle. More...
 
int flukaId (void) const
 A function to return the FLUKA particle Id of this particle. More...
 
int partGenNum (void) const
 A function to return the particle generation number of this particle. More...
 
double kineticEnergy (void) const
 A function to return the relativistic kinetic energy of this particle. More...
 
HepMC::FourVector positionAtScoringPlane (void) const
 A function to return the fourvector position with respect to the scoring plane of this particle. More...
 
HepMC::FourVector directionalCosines (void) const
 A function to return the directional cosines of this particle. More...
 
double weight (void) const
 A function to return the particle or event weight. More...
 
double totalEnergy (void) const
 A function to return the total energy. More...
 
HepMC::FourVector positionAtPrimary (void) const
 A function to return the position of the primary interaction. More...
 
int pdgId ()
 A function to return the PDG id of this particle. More...
 

Private Attributes

int m_type
 
long m_eventId
 
int m_flukaId
 
int m_partGenNum
 
double m_kineticEnergy
 
HepMC::FourVector m_positionAtScoringPlane
 
HepMC::FourVector m_directionalCosines
 
double m_weight
 
double m_totalEnergy
 
HepMC::FourVector m_positionAtPrimary
 

Detailed Description

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

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

Definition at line 19 of file FlukaParticle.h.

Member Enumeration Documentation

◆ flukaParticleType

Enumerator
BRUCE 
TALANOV 

Definition at line 72 of file FlukaParticle.h.

72  {
73  BRUCE,
74  TALANOV};

Constructor & Destructor Documentation

◆ FlukaParticle() [1/2]

FlukaParticle::FlukaParticle ( int  type = 0)

Definition at line 11 of file FlukaParticle.cxx.

11  : m_type(type),
12  m_eventId(0),
13  m_flukaId(0),
14  m_partGenNum(0),
15  m_kineticEnergy(0.),
18  m_weight(1.),
19  m_totalEnergy(0.),
21 }

◆ FlukaParticle() [2/2]

FlukaParticle::FlukaParticle ( const FlukaParticle flukaParticle)
default

Member Function Documentation

◆ clear()

void FlukaParticle::clear ( void  )

A function to clear the values of this particle.

Definition at line 25 of file FlukaParticle.cxx.

25  {
26  m_eventId = 0;
27  m_flukaId = 0;
28  m_partGenNum = 0;
29  m_kineticEnergy = 0.;
30  m_positionAtScoringPlane.setX(0.);
31  m_positionAtScoringPlane.setY(0.);
32  m_positionAtScoringPlane.setZ(0.);
33  m_positionAtScoringPlane.setT(0.);
34  m_directionalCosines.setX(0.);
35  m_directionalCosines.setY(0.);
36  m_directionalCosines.setZ(0.);
37  m_weight = 1.;
38  m_totalEnergy = 0.;
39  m_positionAtPrimary.setX(0.);
40  m_positionAtPrimary.setY(0.);
41  m_positionAtPrimary.setZ(0.);
42  m_positionAtPrimary.setT(0.);
43 }

◆ directionalCosines()

HepMC::FourVector FlukaParticle::directionalCosines ( void  ) const
inline

A function to return the directional cosines of this particle.

The fourth component is 0

Definition at line 58 of file FlukaParticle.h.

58 { return m_directionalCosines; }

◆ eventId()

long FlukaParticle::eventId ( void  ) const
inline

A function to return the FLUKA event Id of this particle.

Definition at line 39 of file FlukaParticle.h.

39 { return m_eventId; }

◆ flukaId()

int FlukaParticle::flukaId ( void  ) const
inline

A function to return the FLUKA particle Id of this particle.

Definition at line 42 of file FlukaParticle.h.

42 { return m_flukaId; }

◆ kineticEnergy()

double FlukaParticle::kineticEnergy ( void  ) const
inline

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

Definition at line 50 of file FlukaParticle.h.

50 { return m_kineticEnergy; }

◆ operator=()

FlukaParticle& FlukaParticle::operator= ( const FlukaParticle flukaParticle)
default

◆ partGenNum()

int FlukaParticle::partGenNum ( void  ) const
inline

A function to return the particle generation number of this particle.

Definition at line 46 of file FlukaParticle.h.

46 { return m_partGenNum; }

◆ pdgId()

int FlukaParticle::pdgId ( )

A function to return the PDG id of this particle.

Definition at line 128 of file FlukaParticle.cxx.

128  {
129  int pdgID = 0;
130 
131  // There does not appear to be a clever way to do this. The case
132  // statement mapping is taken from the FLUKA manual:
133  // http://www.fluka.org/fluka.php?id=man_onl&sub=7
134 
135  switch (m_flukaId) {
136  case -6 : pdgID = 1000020040; break;
137  case -5 : pdgID = 1000020030; break;
138  case -4 : pdgID = 1000010030; break;
139  case -3 : pdgID = 1000010020; break;
140  case 1 : pdgID = 2212; break;
141  case 2 : pdgID = -2212; break;
142  case 3 : pdgID = 11; break;
143  case 4 : pdgID = -11; break;
144  case 5 : pdgID = 12; break;
145  case 6 : pdgID = -12; break;
146  case 7 : pdgID = 22; break;
147  case 8 : pdgID = 2112; break;
148  case 9 : pdgID = -2112; break;
149  case 10 : pdgID = -13; break;
150  case 11 : pdgID = 13; break;
151  case 12 : pdgID = 130; break;
152  case 13 : pdgID = 211; break;
153  case 14 : pdgID = -211; break;
154  case 15 : pdgID = 321; break;
155  case 16 : pdgID = -321; break;
156  case 17 : pdgID = 3122; break;
157  case 18 : pdgID = -3122; break;
158  case 19 : pdgID = 310; break;
159  case 20 : pdgID = 3112; break;
160  case 21 : pdgID = 3222; break;
161  case 22 : pdgID = 3212; break;
162  case 23 : pdgID = 111; break;
163  case 24 : pdgID = 311; break;
164  case 25 : pdgID = -311; break;
165  case 27 : pdgID = 14; break;
166  case 28 : pdgID = -14; break;
167  case 31 : pdgID = -3222; break;
168  case 32 : pdgID = -3212; break;
169  case 33 : pdgID = -3112; break;
170  case 34 : pdgID = 3322; break;
171  case 35 : pdgID = -3322; break;
172  case 36 : pdgID = 3312; break;
173  case 37 : pdgID = -3312; break;
174  case 38 : pdgID = 3334; break;
175  case 39 : pdgID = -3334; break;
176  case 41 : pdgID = -15; break;
177  case 42 : pdgID = 15; break;
178  case 43 : pdgID = 16; break;
179  case 44 : pdgID = -16; break;
180  case 45 : pdgID = 411; break;
181  case 46 : pdgID = -411; break;
182  case 47 : pdgID = 421; break;
183  case 48 : pdgID = -421; break;
184  case 49 : pdgID = 431; break;
185  case 50 : pdgID = -431; break;
186  case 51 : pdgID = 4122; break;
187  case 52 : pdgID = 4232; break;
188  case 53 : pdgID = 4112; break;
189  case 54 : pdgID = 4322; break;
190  case 55 : pdgID = 4312; break;
191  case 56 : pdgID = 4332; break;
192  case 57 : pdgID = -4122; break;
193  case 58 : pdgID = -4232; break;
194  case 59 : pdgID = -4132; break;
195  case 60 : pdgID = -4322; break;
196  case 61 : pdgID = -4312; break;
197  case 62 : pdgID = -4332; break;
198  default : pdgID = 0;
199  }
200 
201  return pdgID;
202 }

◆ positionAtPrimary()

HepMC::FourVector FlukaParticle::positionAtPrimary ( void  ) const
inline

A function to return the position of the primary interaction.

Definition at line 67 of file FlukaParticle.h.

67 { return m_positionAtPrimary; }

◆ positionAtScoringPlane()

HepMC::FourVector FlukaParticle::positionAtScoringPlane ( void  ) const
inline

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

Definition at line 54 of file FlukaParticle.h.

54 { return m_positionAtScoringPlane; }

◆ print()

void FlukaParticle::print ( void  )

A function to print the contents of this particle.

Definition at line 206 of file FlukaParticle.cxx.

206  {
207  if(m_type == BRUCE) {
208  std::cout.fill(' ');
209  std::cout.width(6); std::cout << m_eventId << " ";
210  std::cout.width(6); std::cout << m_partGenNum << " ";
211  std::cout.width(6); std::cout << m_flukaId << " ";
212  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_kineticEnergy << " ";
213  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_weight << " ";
214  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.x() << " ";
215  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.y() << " ";
216  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_directionalCosines.x() << " ";
217  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_directionalCosines.y() << " ";
218  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.t() << " ";
219  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_totalEnergy << " ";
220  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.x() << " ";
221  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.y() << " ";
222  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.z() << " ";
223  std::cout.width(13); std::cout.precision(6); std::cout << std::scientific << m_positionAtPrimary.t() << " ";
224  std::cout.precision(6);
225  std::cout << std::endl;
226  }
227  else if(m_type == TALANOV) {
228  std::cout.fill(' ');
229  std::cout.width(7); std::cout << m_eventId << " ";
230  std::cout.width(2); std::cout << m_flukaId << " ";
231  std::cout.width(4); std::cout << m_partGenNum << " ";
232  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_kineticEnergy << " ";
233  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_positionAtScoringPlane.x() << " ";
234  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_positionAtScoringPlane.y() << " ";
235  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_positionAtScoringPlane.z() << " ";
236  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_directionalCosines.x() << " ";
237  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_directionalCosines.y() << " ";
238  std::cout.width(19); std::cout.precision(12); std::cout << std::scientific << m_directionalCosines.z() << " ";
239  std::cout.width(19); std::cout.precision(6); std::cout << std::scientific << m_positionAtScoringPlane.t();
240  std::cout.precision(6);
241  std::cout << std::endl;
242  }
243 }

◆ read()

int FlukaParticle::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 47 of file FlukaParticle.cxx.

47  {
48  clear();
49 
50  if(!eventAsStringVector) {
51  std::cerr << "ERROR: string vector passed to FlukaParticle::read is null." << std::endl;
52  return 1;
53  }
54 
55  if(m_type == BRUCE) {
56  if(eventAsStringVector->size() != 15) {
57  std::cerr << "ERROR: there are " << eventAsStringVector->size() << " data words, which is out of range. This particle will be null." << std::endl;
58  return 2;
59  }
60  }
61  else if(m_type == TALANOV) {
62  if(eventAsStringVector->size() < 10 || eventAsStringVector->size() > 11 ) {
63  std::cerr << "ERROR: there are " << eventAsStringVector->size() << " data words, which is out of range. This particle will be null." << std::endl;
64  return 3;
65  }
66  }
67  else {
68  std::cerr << "ERROR: unknown input Fluka record type. This particle will be null." << std::endl;
69  return 4;
70  }
71 
72  double doubleValue;
73  std::vector<std::string>::iterator itr = eventAsStringVector->begin();
74  std::vector<std::string>::iterator itr_end = eventAsStringVector->end();
75  int wordNumber = 0;
76  if(m_type == BRUCE) {
77  for(;itr!=itr_end;++itr,++wordNumber) {
78  if((*itr).length() == 0) {
79  std::cerr << "ERROR: string word has zero length." << std::endl;
80  return 5;
81  }
82  std::istringstream inStr((*itr));
83  switch (wordNumber) {
84  case 0 : inStr >> m_eventId; break; // FLUKA run number (between 1 and 3000)
85  case 1 : inStr >> m_partGenNum; break; // ID of primary particle (between 1 and 100 in each run)
86  case 2 : inStr >> m_flukaId; break; // Standard FLUKA particle id
87  case 3 : inStr >> m_kineticEnergy; break; // GeV
88  case 4 : inStr >> m_weight; break;
89  case 5 : inStr >> doubleValue; m_positionAtScoringPlane.setX(doubleValue); break; // (cm)
90  case 6 : inStr >> doubleValue; m_positionAtScoringPlane.setY(doubleValue); break; // (cm)
91  case 7 : inStr >> doubleValue; m_directionalCosines.setX(doubleValue); break; // w.r.t x-axis
92  case 8 : inStr >> doubleValue; m_directionalCosines.setY(doubleValue); break; // w.r.t y-axis
93  //case 9 : inStr >> doubleValue; m_positionAtScoringPlane.setT(doubleValue); break; // time (s) since start of primary particle (use t=0 for ATLAS Geant)
94  case 10 : inStr >> m_totalEnergy; break; // total energy (GeV)
95  case 11 : inStr >> doubleValue; m_positionAtPrimary.setX(doubleValue); break; // (cm)
96  case 12 : inStr >> doubleValue; m_positionAtPrimary.setY(doubleValue); break; // (cm)
97  case 13 : inStr >> doubleValue; m_positionAtPrimary.setZ(doubleValue); break; // (cm)
98  case 14 : inStr >> doubleValue; m_positionAtPrimary.setT(doubleValue); break; // (cm)
99  default : break;
100  }
101  }
102  }
103  else if(m_type == TALANOV) {
104  for(;itr!=itr_end;++itr,++wordNumber) {
105  std::istringstream inStr((*itr));
106  switch (wordNumber) {
107  case 0 : inStr >> m_eventId; break;
108  case 1 : inStr >> m_flukaId; break;
109  case 2 : inStr >> m_partGenNum; break;
110  case 3 : inStr >> m_kineticEnergy; break;
111  case 4 : inStr >> doubleValue; m_positionAtScoringPlane.setX(doubleValue); break;
112  case 5 : inStr >> doubleValue; m_positionAtScoringPlane.setY(doubleValue); break;
113  case 6 : inStr >> doubleValue; m_positionAtScoringPlane.setZ(doubleValue); break;
114  case 7 : inStr >> doubleValue; m_directionalCosines.setX(doubleValue); break;
115  case 8 : inStr >> doubleValue; m_directionalCosines.setY(doubleValue); break;
116  case 9 : inStr >> doubleValue; m_directionalCosines.setZ(doubleValue); break;
117  case 10 : inStr >> doubleValue; m_positionAtScoringPlane.setT(doubleValue); break;
118  default : break;
119  }
120  }
121  }
122 
123  return 0;
124 }

◆ totalEnergy()

double FlukaParticle::totalEnergy ( void  ) const
inline

A function to return the total energy.

Definition at line 64 of file FlukaParticle.h.

64 { return m_totalEnergy; }

◆ type()

int FlukaParticle::type ( void  ) const
inline

A function to return the type of this FlukaParticle.

Definition at line 36 of file FlukaParticle.h.

36 { return m_type; }

◆ weight()

double FlukaParticle::weight ( void  ) const
inline

A function to return the particle or event weight.

Definition at line 61 of file FlukaParticle.h.

61 { return m_weight; }

Member Data Documentation

◆ m_directionalCosines

HepMC::FourVector FlukaParticle::m_directionalCosines
private

Definition at line 84 of file FlukaParticle.h.

◆ m_eventId

long FlukaParticle::m_eventId
private

Definition at line 79 of file FlukaParticle.h.

◆ m_flukaId

int FlukaParticle::m_flukaId
private

Definition at line 80 of file FlukaParticle.h.

◆ m_kineticEnergy

double FlukaParticle::m_kineticEnergy
private

Definition at line 82 of file FlukaParticle.h.

◆ m_partGenNum

int FlukaParticle::m_partGenNum
private

Definition at line 81 of file FlukaParticle.h.

◆ m_positionAtPrimary

HepMC::FourVector FlukaParticle::m_positionAtPrimary
private

Definition at line 87 of file FlukaParticle.h.

◆ m_positionAtScoringPlane

HepMC::FourVector FlukaParticle::m_positionAtScoringPlane
private

Definition at line 83 of file FlukaParticle.h.

◆ m_totalEnergy

double FlukaParticle::m_totalEnergy
private

Definition at line 86 of file FlukaParticle.h.

◆ m_type

int FlukaParticle::m_type
private

Definition at line 77 of file FlukaParticle.h.

◆ m_weight

double FlukaParticle::m_weight
private

Definition at line 85 of file FlukaParticle.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
FlukaParticle::m_eventId
long m_eventId
Definition: FlukaParticle.h:79
FlukaParticle::m_kineticEnergy
double m_kineticEnergy
Definition: FlukaParticle.h:82
FlukaParticle::m_positionAtPrimary
HepMC::FourVector m_positionAtPrimary
Definition: FlukaParticle.h:87
FlukaParticle::m_totalEnergy
double m_totalEnergy
Definition: FlukaParticle.h:86
FlukaParticle::m_partGenNum
int m_partGenNum
Definition: FlukaParticle.h:81
FlukaParticle::clear
void clear(void)
A function to clear the values of this particle.
Definition: FlukaParticle.cxx:25
FlukaParticle::m_weight
double m_weight
Definition: FlukaParticle.h:85
FlukaParticle::m_flukaId
int m_flukaId
Definition: FlukaParticle.h:80
FlukaParticle::m_directionalCosines
HepMC::FourVector m_directionalCosines
Definition: FlukaParticle.h:84
FlukaParticle::m_type
int m_type
Definition: FlukaParticle.h:77
FlukaParticle::type
int type(void) const
A function to return the type of this FlukaParticle.
Definition: FlukaParticle.h:36
FlukaParticle::BRUCE
@ BRUCE
Definition: FlukaParticle.h:73
FlukaParticle::m_positionAtScoringPlane
HepMC::FourVector m_positionAtScoringPlane
Definition: FlukaParticle.h:83
FlukaParticle::TALANOV
@ TALANOV
Definition: FlukaParticle.h:74
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79