61 {
63 Gaudi::Hive::setCurrentContext(eventInfo->GetEventContext());
64 }
65
66
68
69 auto hitVector = std::make_unique<std::vector<Trk::HitInfo>>();
70
72 double charge = HepPDT::ParticleID(pdgId).charge();
73 if (forceNeutral)
charge = 0.;
74
75
77
79
80
82
84
86
87 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] x from position eta="<<
pos.eta()<<
" phi="<<
pos.phi()<<
" d="<<
pos.mag()<<
" pT="<<
mom.perp() );
88
89
91
92 double freepath = -1.;
93 double tDec = freepath > 0. ? freepath : -1.;
94 int decayProc = 0;
95
96 Trk::TimeLimit timeLim(tDec, 0., decayProc);
97 Trk::PathLimit pathLim(-1., 0);
99
100
101 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] before calo entrance ");
102
103
108 else
110 }
111
112 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] after calo entrance ");
113
114 std::unique_ptr<const Trk::TrackParameters> caloEntry = nullptr;
115
117 std::vector<Trk::HitInfo>* dummyHitVector = nullptr;
119 caloEntry =
121 pathLim,
122 timeLim,
124 pHypothesis,
125 dummyHitVector,
126 nextGeoID,
128 }else{
130 pathLim,
131 timeLim,
133 pHypothesis,
134 dummyHitVector,
135 nextGeoID,
137 }
138 } else
139 caloEntry = inputPar.uniqueClone();
140
141 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] after calo caloEntry ");
142
143 if(caloEntry){
144 std::unique_ptr<const Trk::TrackParameters> eParameters = nullptr;
145
146
147 hitVector->push_back(Trk::HitInfo(caloEntry->uniqueClone(), timeLim.time, nextGeoID, 0.));
148
150 "[ fastCaloSim transport ] starting Calo transport from position eta="
151 << caloEntry->position().eta() << " phi=" << caloEntry->position().phi()
152 << " d=" << caloEntry->position().mag());
153
154 std::vector<Trk::HitInfo>* rawHitVector =
hitVector.get();
156 eParameters =
158 pathLim,
159 timeLim,
161 pHypothesis,
162 rawHitVector,
163 nextGeoID);
164 }else{
165 eParameters =
167 pathLim,
168 timeLim,
170 pHypothesis,
171 rawHitVector,
172 nextGeoID);
173 }
174
175 if(eParameters)
hitVector->push_back(Trk::HitInfo(std::move(eParameters), timeLim.time, nextGeoID, 0.));
176 }
177
178
179 int IDCaloBoundary = 3000;
180
181 if(msgLvl(MSG::DEBUG)){
182 std::vector<Trk::HitInfo>::iterator
it =
hitVector->begin();
183 while (it < hitVector->
end()){
186 ATH_MSG_DEBUG(
" HIT: layer="<<sample<<
" sample="<<sample-IDCaloBoundary<<
" eta="<<hitPos.eta()<<
" phi="<<hitPos.phi()<<
" d="<<hitPos.mag());
188 }
189 }
190
191 std::vector<Trk::HitInfo>::iterator it2 =
hitVector->begin();
192 while(it2 < hitVector->
end()){
195 ATH_MSG_DEBUG(
" HIT: layer="<<sample<<
" sample="<<sample-IDCaloBoundary<<
" eta="<<hitPos.eta()<<
" phi="<<hitPos.phi()<<
" r="<<hitPos.perp()<<
" z="<<hitPos[
Amg::z]);
196 ++it2;
197 }
198
199
200 if (!forceNeutral &&
hitVector->empty()){
201 ATH_MSG_DEBUG(
"forcing neutral charge in FastCaloSimCaloTransportation::caloHits");
203 }
204
205
206 else if(
hitVector->empty())
ATH_MSG_ERROR(
"Empty hitVector even after forcing neutral charge. This may cause a segfault soon.");
207
208
210
211 return caloSteps;
212
213}
#define ATH_MSG_WARNING(x)
double charge(const T &p)
std::vector< FPGATrackSimHit > hitVector
static AtlasG4EventUserInfo * GetEventUserInfo()
virtual std::vector< G4FieldTrack > transport(const TFCSTruthState *truth, bool forceNeutral=false) const override final
Trk::PdgToParticleHypothesis m_pdgToParticleHypothesis
StringProperty m_caloEntranceName
CxxUtils::CachedPointer< const Trk::TrackingVolume > m_caloEntrance
std::vector< G4FieldTrack > convertToFieldTrack(const std::vector< Trk::HitInfo > &vec) const
const TLorentzVector & vertex() const
Eigen::Matrix< double, 3, 1 > Vector3D
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.