74{
76 const EventContext& ctx = Gaudi::Hive::currentContext();
77
83 return StatusCode::FAILURE;
84 }
86 }
87
89
90
91 std::vector<const TrackStateOnSurface*> material;
92 std::vector<const TrackStateOnSurface*> matPrec;
95
98
103
105 const Trk::PerigeeSurface& pSf = initialPerigee.associatedSurface();
106 material.clear(); matPrec.clear();
112 }
116 ctx,
117 *currPar,
121 if (msEntry) {
128
129 const std::vector<const Trk::TrackStateOnSurface*>* mmsentry =
m_extrapolator->extrapolateM(ctx,
130 *currPar,
133 false,
135 if (mmsentry ) {
136 for (const auto& entry : *mmsentry) {
137 if (entry) {
139 <<
entry->trackParameters()->position() <<
":"
140 <<
entry->trackParameters()->momentum().mag() - currPar->
momentum().mag());
141 }
142 }
143
144 currPar = (mmsentry->back()) ? mmsentry->back()->trackParameters() : msEntry;
145
146 const std::vector<const Trk::TrackStateOnSurface*>* peri =
m_extrapolator->extrapolateM(ctx,
147 *currPar,
148 pSf,
150 false,
153 if (peri){
155 } else {
156 ATH_MSG_ERROR (
"Perigee pointer is null in CETmaterial.cxx");
157 delete msEntry;
158 return StatusCode::FAILURE;
159 }
160 for (const auto& entry : *peri) {
161 if (entry &&
entry->trackParameters()) {
163 <<
entry->trackParameters()->position() <<
":"
164 <<
entry->trackParameters()->momentum().mag() - msEntry->
momentum().mag());
165 }
166 }
167
168 if (peri->back() && peri->back()->trackParameters()) {
170 << initialPerigee.parameters()[0] << ","
171 << initialPerigee.parameters()[1] << ","
172 << initialPerigee.parameters()[2] << ","
173 << initialPerigee.parameters()[3] << ","
174 << initialPerigee.momentum().mag() );
176 << peri->back()->trackParameters()->parameters()[0] << ","
177 << peri->back()->trackParameters()->parameters()[1] << ","
178 << peri->back()->trackParameters()->parameters()[2] << ","
179 << peri->back()->trackParameters()->parameters()[3] << ","
180 << peri->back()->trackParameters()->momentum().mag() );
181 } else {
182 ATH_MSG_ERROR(
"extrapolation to perigee failed for input parameters: " << msEntry->parameters() );
183 }
184 delete peri;
185 delete msEntry;
186 } else {
187 ATH_MSG_ERROR(
"extrapolation to MSentry failed for input parameters: " << currPar->parameters() );
189 }
190 }
191 }
192 delete currPar;
193 continue;
194 }
196 double matApp = 0.;
197 while (currPar) {
198 std::pair<std::unique_ptr<Trk::TrackParameters>,
const Trk::Layer*>
next =
m_extrapolator->extrapolateToNextActiveLayerM(
199 ctx,
200 *currPar,
202 true,
203 material,
205
206
208 const Trk::Layer* lay =
next.second;
209 currPar = nextPar;
210
212
213 const std::vector<const Trk::TrackStateOnSurface*>* nextPrec =
m_extraprec->extrapolateM(
214 ctx,
217 false,
219 delete precPar;
220
221 if (nextPrec) {
222 for (const auto *i : *nextPrec) {
223 const Trk::MaterialEffectsBase* mEff =
i->materialEffectsOnTrack();
225 if (mEff && trPar) {
227 }
228 }
229 }
230
231 if (!lay || !nextPrec || nextPrec->empty() || !nextPrec->back() ) break;
232 precPar = nextPrec->back()->trackParameters();
234 if (!material.empty()) for (auto & i : material) {
235 if (
i->materialEffectsOnTrack())
mat +=
i->materialEffectsOnTrack()->thicknessInX0();
236 }
238 currPar->parameters()[1]-precPar->parameters()[1]);
239 else if (currPar) {
240
242 }
243 }
245 int id = 0;
247 double matc=0.;
248 if (!material.empty()) for (auto & i : material) {
249 if (
i->materialEffectsOnTrack()) matc +=
i->materialEffectsOnTrack()->thicknessInX0();
250 }
254
256 }
257 if (!lay) break;
258 }
261 if (!material.empty()) for (auto & i : material) {
262 if (
i->materialEffectsOnTrack()) {
263 mat +=
i->materialEffectsOnTrack()->thicknessInX0();
264 }
265 }
267 }
268 } else {
269 const std::vector<const Trk::TrackStateOnSurface*>* destParameters =
m_extrapolator->extrapolateM(
270 ctx,
271 *currPar,
274 false,
276
279 if (destParameters) for (const auto *destParameter : *destParameters) {
280 const Trk::MaterialEffectsBase* mEff = destParameter->materialEffectsOnTrack();
282 if (trPar) {
283
284
285
286 }
287 if (mEff && trPar) {
289
290 std::vector<const Trk::DetachedTrackingVolume*> detVols =
m_extrapolator->trackingGeometry()->lowestDetachedTrackingVolumes(trPar->
position());
293 }
294 }
295 if (destParameters) {
296
297
298
299 }
301 }
302
303 if (!destParameters || destParameters->empty() ) {
304 ATH_MSG_ERROR(
"extrapolation to outer boundary failed for input parameters: " << initialPerigee.parameters() );
305 } else if (destParameters->back()->trackParameters()) {
306
308 material.clear();
309 const std::vector<const Trk::TrackStateOnSurface*>* peri =
m_extrapolator->extrapolateM(
310 ctx, *(destParameters->back()->trackParameters()),
311 pSf,
313 false,
315
316 if (peri) {
318 for (
unsigned int i=0;
i< peri->size();
i++)
319 ATH_MSG_INFO(
"position:" << i <<
"," << (*peri)[i]->trackParameters()->position() );
320 ATH_MSG_INFO(
"extrapolation to perigee:input: " << initialPerigee.parameters() );
321 ATH_MSG_INFO(
"extrapolation to perigee:output: " << peri->back()->trackParameters()->parameters() );
322 } else {
323 ATH_MSG_ERROR(
"extrapolation to perigee failed for input parameters: " << destParameters->back()->trackParameters()->parameters() );
324 }
325 delete peri;
326 }
327 }
328
329 delete destParameters;
330 }
331 }
332
334
335 return StatusCode::SUCCESS;
336}
void printMat(double th, double ph, double mat, double dtheta=0., double dphi=0.) const
BooleanProperty m_backward
BooleanProperty m_domsentry
const Trk::TrackingGeometry * m_trackingGeometry
IntegerProperty m_particleType
void printMatPrec(double theta, double phi, const Trk::TrackParameters *, const Trk::TrackParameters *, double mat, int id, const std::string &name)
BooleanProperty m_doprecision
void printMatScan(double theta, double phi, double r, double z, double mat, const std::string &name) const
BooleanProperty m_printActive
BooleanProperty m_checkStepWise
ToolHandle< IExtrapolator > m_extraprec
UnsignedIntegerProperty m_numScan
const Trk::Surface * m_outerBoundary
BooleanProperty m_printMaterial
void printMatComp(double theta, double phi, const Trk::TrackParameters *currPar, const std::string &name, double mat, double matApp, double dx, double dy) const
DoubleProperty m_minTheta
DoubleProperty m_maxTheta
const Trk::TrackingVolume * m_msentry
ToolHandle< IExtrapolator > m_extrapolator
The Extrapolator(s) to be retrieved.
const std::string & name() const
returns the Name
int layerType() const
get the Layer coding
const DetachedTrackingVolume * enclosingDetachedTrackingVolume() const
get the confining DetachedTrackingVolume
double thicknessInX0() const
returns the actually traversed material .
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters