74{
76
82 return StatusCode::FAILURE;
83 }
85 }
86
88
89
90 std::vector<const TrackStateOnSurface*> material;
91 std::vector<const TrackStateOnSurface*> matPrec;
94
97
102
104 const Trk::PerigeeSurface& pSf = initialPerigee.associatedSurface();
105 material.clear(); matPrec.clear();
111 }
114 ctx,
115 *currPar,
119 if (msEntry) {
123 currPar->
momentum().mag() - msEntry->momentum().mag(),
126
127 const std::vector<const Trk::TrackStateOnSurface*>* mmsentry =
m_extrapolator->extrapolateM(ctx,
128 *currPar,
129 msEntry->associatedSurface(),
131 false,
133 if (mmsentry ) {
134 for (const auto& entry : *mmsentry) {
135 if (entry) {
137 <<
entry->trackParameters()->position() <<
":"
138 <<
entry->trackParameters()->momentum().mag() - currPar->
momentum().mag());
139 }
140 }
141
142 currPar = (mmsentry->back()) ? mmsentry->back()->trackParameters() : msEntry.release();
143
144 const std::vector<const Trk::TrackStateOnSurface*>* peri =
m_extrapolator->extrapolateM(ctx,
145 *currPar,
146 pSf,
148 false,
151 if (peri){
153 } else {
154 ATH_MSG_ERROR (
"Perigee pointer is null in CETmaterial.cxx");
155 return StatusCode::FAILURE;
156 }
157 for (const auto& entry : *peri) {
158 if (entry &&
entry->trackParameters()) {
160 <<
entry->trackParameters()->position() <<
":"
161 <<
entry->trackParameters()->momentum().mag() - msEntry->momentum().mag());
162 }
163 }
164
165 if (peri->back() && peri->back()->trackParameters()) {
167 << initialPerigee.parameters()[0] << ","
168 << initialPerigee.parameters()[1] << ","
169 << initialPerigee.parameters()[2] << ","
170 << initialPerigee.parameters()[3] << ","
171 << initialPerigee.momentum().mag() );
173 << peri->back()->trackParameters()->parameters()[0] << ","
174 << peri->back()->trackParameters()->parameters()[1] << ","
175 << peri->back()->trackParameters()->parameters()[2] << ","
176 << peri->back()->trackParameters()->parameters()[3] << ","
177 << peri->back()->trackParameters()->momentum().mag() );
178 } else {
179 ATH_MSG_ERROR(
"extrapolation to perigee failed for input parameters: " << msEntry->parameters() );
180 }
181 delete peri;
182 peri = nullptr;
183 } else {
184 ATH_MSG_ERROR(
"extrapolation to MSentry failed for input parameters: " << currPar->parameters() );
186 }
187 }
188 }
189 delete currPar;
190 currPar = nullptr;
191 continue;
192 }
194 double matApp = 0.;
195 while (currPar) {
196 std::pair<std::unique_ptr<Trk::TrackParameters>,
const Trk::Layer*>
next =
m_extrapolator->extrapolateToNextActiveLayerM(
197 ctx,
198 *currPar,
200 true,
201 material,
203
204
206 const Trk::Layer* lay =
next.second;
207 currPar = nextPar;
208
210
211 const std::vector<const Trk::TrackStateOnSurface*>* nextPrec =
m_extraprec->extrapolateM(
212 ctx,
215 false,
217 delete precPar;
218 precPar = nullptr;
219
220 if (nextPrec) {
221 for (const auto *i : *nextPrec) {
222 const Trk::MaterialEffectsBase* mEff =
i->materialEffectsOnTrack();
224 if (mEff && trPar) {
226 }
227 }
228 }
229
230 if (!lay || !nextPrec || nextPrec->empty() || !nextPrec->back() ) break;
231 precPar = nextPrec->back()->trackParameters();
233 if (!material.empty()) for (auto & i : material) {
234 if (
i->materialEffectsOnTrack())
mat +=
i->materialEffectsOnTrack()->thicknessInX0();
235 }
237 currPar->parameters()[1]-precPar->parameters()[1]);
238 else if (currPar) {
239
241 }
242 }
244 int id = 0;
246 double matc=0.;
247 if (!material.empty()) for (auto & i : material) {
248 if (
i->materialEffectsOnTrack()) matc +=
i->materialEffectsOnTrack()->thicknessInX0();
249 }
253
255 }
256 if (!lay) break;
257 }
260 if (!material.empty()) for (auto & i : material) {
261 if (
i->materialEffectsOnTrack()) {
262 mat +=
i->materialEffectsOnTrack()->thicknessInX0();
263 }
264 }
266 }
267 } else {
268 const std::vector<const Trk::TrackStateOnSurface*>* destParameters =
m_extrapolator->extrapolateM(
269 ctx,
270 *currPar,
273 false,
275
278 if (destParameters) for (const auto *destParameter : *destParameters) {
279 const Trk::MaterialEffectsBase* mEff = destParameter->materialEffectsOnTrack();
281 if (trPar) {
282
283
284
285 }
286 if (mEff && trPar) {
288
289 std::vector<const Trk::DetachedTrackingVolume*> detVols =
m_extrapolator->trackingGeometry()->lowestDetachedTrackingVolumes(trPar->
position());
292 }
293 }
294 if (destParameters) {
295
296
297
298 }
300 }
301
302 if (!destParameters || destParameters->empty() ) {
303 ATH_MSG_ERROR(
"extrapolation to outer boundary failed for input parameters: " << initialPerigee.parameters() );
304 } else if (destParameters->back()->trackParameters()) {
305
307 material.clear();
308 const std::vector<const Trk::TrackStateOnSurface*>* peri =
m_extrapolator->extrapolateM(
309 ctx, *(destParameters->back()->trackParameters()),
310 pSf,
312 false,
314
315 if (peri) {
317 for (
unsigned int i=0;
i< peri->size();
i++)
319 ATH_MSG_INFO(
"extrapolation to perigee:input: " << initialPerigee.parameters() );
320 ATH_MSG_INFO(
"extrapolation to perigee:output: " << peri->back()->trackParameters()->parameters() );
321 } else {
322 ATH_MSG_ERROR(
"extrapolation to perigee failed for input parameters: " << destParameters->back()->trackParameters()->parameters() );
323 }
324 delete peri;
325 peri = nullptr;
326 }
327 }
328
329 delete destParameters;
330 destParameters = nullptr;
331 }
332 }
333
335
336 return StatusCode::SUCCESS;
337}
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.
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
ParametersBase< TrackParametersDim, Charged > TrackParameters