59 {
61 Gaudi::Hive::setCurrentContext(eventInfo->GetEventContext());
62 }
63
64
66
67 auto hitVector = std::make_unique<std::vector<Trk::HitInfo>>();
68
71 if (forceNeutral)
charge = 0.;
72
73
75
77
78
80
82
84
85 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] x from position eta="<<
pos.eta()<<
" phi="<<
pos.phi()<<
" d="<<
pos.mag()<<
" pT="<<
mom.perp() );
86
87
89
90 double freepath = -1.;
91 double tDec = freepath > 0. ? freepath : -1.;
92 int decayProc = 0;
93
94 Trk::TimeLimit timeLim(tDec, 0., decayProc);
95 Trk::PathLimit pathLim(-1., 0);
97
98
99 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] before calo entrance ");
100
101
106 else
108 }
109
110 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] after calo entrance ");
111
112 std::unique_ptr<const Trk::TrackParameters> caloEntry = nullptr;
113
115 std::vector<Trk::HitInfo>* dummyHitVector = nullptr;
117 caloEntry =
119 pathLim,
120 timeLim,
122 pHypothesis,
123 dummyHitVector,
124 nextGeoID,
126 }else{
128 pathLim,
129 timeLim,
131 pHypothesis,
132 dummyHitVector,
133 nextGeoID,
135 }
136 } else
137 caloEntry = inputPar.uniqueClone();
138
139 ATH_MSG_DEBUG(
"[ fastCaloSim transport ] after calo caloEntry ");
140
141 if(caloEntry){
142 std::unique_ptr<const Trk::TrackParameters> eParameters = nullptr;
143
144
145 hitVector->push_back(Trk::HitInfo(caloEntry->uniqueClone(), timeLim.time, nextGeoID, 0.));
146
148 "[ fastCaloSim transport ] starting Calo transport from position eta="
149 << caloEntry->position().eta() << " phi=" << caloEntry->position().phi()
150 << " d=" << caloEntry->position().mag());
151
152 std::vector<Trk::HitInfo>* rawHitVector =
hitVector.get();
154 eParameters =
156 pathLim,
157 timeLim,
159 pHypothesis,
160 rawHitVector,
161 nextGeoID);
162 }else{
163 eParameters =
165 pathLim,
166 timeLim,
168 pHypothesis,
169 rawHitVector,
170 nextGeoID);
171 }
172
173 if(eParameters)
hitVector->push_back(Trk::HitInfo(std::move(eParameters), timeLim.time, nextGeoID, 0.));
174 }
175
176
177 int IDCaloBoundary = 3000;
178
179 if(msgLvl(MSG::DEBUG)){
180 std::vector<Trk::HitInfo>::iterator
it =
hitVector->begin();
181 while (it < hitVector->
end()){
184 ATH_MSG_DEBUG(
" HIT: layer="<<sample<<
" sample="<<sample-IDCaloBoundary<<
" eta="<<hitPos.eta()<<
" phi="<<hitPos.phi()<<
" d="<<hitPos.mag());
186 }
187 }
188
189 std::vector<Trk::HitInfo>::iterator it2 =
hitVector->begin();
190 while(it2 < hitVector->
end()){
193 ATH_MSG_DEBUG(
" HIT: layer="<<sample<<
" sample="<<sample-IDCaloBoundary<<
" eta="<<hitPos.eta()<<
" phi="<<hitPos.phi()<<
" r="<<hitPos.perp()<<
" z="<<hitPos[
Amg::z]);
194 ++it2;
195 }
196
197
198 if (!forceNeutral &&
hitVector->empty()){
199 ATH_MSG_DEBUG(
"forcing neutral charge in FastCaloSimCaloTransportation::caloHits");
201 }
202
203
204 else if(
hitVector->empty())
ATH_MSG_ERROR(
"Empty hitVector even after forcing neutral charge. This may cause a segfault soon.");
205
206
208
209 return caloSteps;
210
211}
#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
double charge(const T &p)
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.