ATLAS Offline Software
MarsParticle.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <iostream>
7 #include <sstream>
8 
10  processId(0),
11  weight(0),
12  position(),
13  kineticEnergy(0.) {
14 }
15 
17  nevve(0),
18  timeOfFlight(0.) {
19 }
20 
21 //-------------------------------------------------------------------------------------------------
22 
23 MarsParticle::MarsParticle(): m_eventNumber(0),
24  m_particleId(0),
25  m_kineticEnergy(0.),
26  m_weight(0.),
27  m_positionAtScoringPlane(),
28  m_directionalCosines(),
29  m_timeOfFlight(0.),
30  m_primaryProtonZ(0.),
31  m_showerPrimary(),
32  m_beamGasInteraction() {
33 }
34 
35 //-------------------------------------------------------------------------------------------------
36 
37 int MarsParticle::read(std::vector<std::string> *eventAsStringVector) {
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 }
77 
78 //-------------------------------------------------------------------------------------------------
79 
80 void MarsParticle::print(bool beamGas) {
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 }
112 
113 //-------------------------------------------------------------------------------------------------
114 
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 }
164 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MarsShowerPrimary::particleId
int particleId
IORIG.
Definition: MarsParticle.h:23
MarsParticle::print
void print(bool beamGas)
A function to print the contents of this particle.
Definition: MarsParticle.cxx:80
MarsBeamGasInteraction::timeOfFlight
double timeOfFlight
ZBGASHIT.
Definition: MarsParticle.h:44
MarsParticle::m_directionalCosines
HepMC::FourVector m_directionalCosines
Definition: MarsParticle.h:114
MarsParticle::m_timeOfFlight
double m_timeOfFlight
Definition: MarsParticle.h:115
MarsParticle::pdgId
int pdgId()
A function to return the PDG id for this particle.
Definition: MarsParticle.cxx:115
MarsShowerPrimary::position
HepMC::FourVector position
XORG, YORG, ZORG , T.
Definition: MarsParticle.h:26
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
MarsShowerPrimary::processId
int processId
KORIG.
Definition: MarsParticle.h:24
MarsShowerPrimary::kineticEnergy
double kineticEnergy
EORIG.
Definition: MarsParticle.h:27
MarsShowerPrimary::weight
double weight
WORIG.
Definition: MarsParticle.h:25
MarsParticle::MarsParticle
MarsParticle()
Definition: MarsParticle.cxx:23
MarsParticle::read
int read(std::vector< std::string > *eventAsStringVector)
A function to read the values from a single row definition and fill the data members.
Definition: MarsParticle.cxx:37
MarsBeamGasInteraction::MarsBeamGasInteraction
MarsBeamGasInteraction()
Definition: MarsParticle.cxx:16
MarsBeamGasInteraction::nevve
int nevve
NEVVE.
Definition: MarsParticle.h:43
MarsShowerPrimary::MarsShowerPrimary
MarsShowerPrimary()
Definition: MarsParticle.cxx:9
MarsParticle.h
MarsParticle::m_primaryProtonZ
double m_primaryProtonZ
Definition: MarsParticle.h:116
MarsParticle::m_eventNumber
long m_eventNumber
Definition: MarsParticle.h:109
MarsParticle::m_beamGasInteraction
MarsBeamGasInteraction m_beamGasInteraction
Definition: MarsParticle.h:118
MarsParticle::m_positionAtScoringPlane
HepMC::FourVector m_positionAtScoringPlane
Definition: MarsParticle.h:113
MarsParticle::m_kineticEnergy
double m_kineticEnergy
Definition: MarsParticle.h:111
MarsParticle::m_showerPrimary
MarsShowerPrimary m_showerPrimary
Definition: MarsParticle.h:117
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
MarsParticle::m_weight
double m_weight
Definition: MarsParticle.h:112
MarsBeamGasInteraction::nucleusType
int nucleusType
INUC.
Definition: MarsParticle.h:42
MarsParticle::m_particleId
int m_particleId
Definition: MarsParticle.h:110