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 }
115 ctx,
116 *currPar,
120 if (msEntry) {
127
128 const std::vector<const Trk::TrackStateOnSurface*>* mmsentry =
m_extrapolator->extrapolateM(ctx,
129 *currPar,
132 false,
134 if (mmsentry ) {
135 for (const auto& entry : *mmsentry) {
136 if (entry) {
138 <<
entry->trackParameters()->position() <<
":"
139 <<
entry->trackParameters()->momentum().mag() - currPar->
momentum().mag());
140 }
141 }
142
143 currPar = (mmsentry->back()) ? mmsentry->back()->trackParameters() : msEntry;
144
145 const std::vector<const Trk::TrackStateOnSurface*>* peri =
m_extrapolator->extrapolateM(ctx,
146 *currPar,
147 pSf,
149 false,
152 if (peri){
154 } else {
155 ATH_MSG_ERROR (
"Perigee pointer is null in CETmaterial.cxx");
156 delete msEntry;
157 return StatusCode::FAILURE;
158 }
159 for (const auto& entry : *peri) {
160 if (entry &&
entry->trackParameters()) {
162 <<
entry->trackParameters()->position() <<
":"
163 <<
entry->trackParameters()->momentum().mag() - msEntry->
momentum().mag());
164 }
165 }
166
167 if (peri->back() && peri->back()->trackParameters()) {
169 << initialPerigee.parameters()[0] << ","
170 << initialPerigee.parameters()[1] << ","
171 << initialPerigee.parameters()[2] << ","
172 << initialPerigee.parameters()[3] << ","
173 << initialPerigee.momentum().mag() );
175 << peri->back()->trackParameters()->parameters()[0] << ","
176 << peri->back()->trackParameters()->parameters()[1] << ","
177 << peri->back()->trackParameters()->parameters()[2] << ","
178 << peri->back()->trackParameters()->parameters()[3] << ","
179 << peri->back()->trackParameters()->momentum().mag() );
180 } else {
181 ATH_MSG_ERROR(
"extrapolation to perigee failed for input parameters: " << msEntry->parameters() );
182 }
183 delete peri;
184 delete msEntry;
185 } else {
186 ATH_MSG_ERROR(
"extrapolation to MSentry failed for input parameters: " << currPar->parameters() );
188 }
189 }
190 }
191 delete currPar;
192 continue;
193 }
195 double matApp = 0.;
196 while (currPar) {
197 std::pair<std::unique_ptr<Trk::TrackParameters>,
const Trk::Layer*>
next =
m_extrapolator->extrapolateToNextActiveLayerM(
198 ctx,
199 *currPar,
201 true,
202 material,
204
205
207 const Trk::Layer* lay =
next.second;
208 currPar = nextPar;
209
211
212 const std::vector<const Trk::TrackStateOnSurface*>* nextPrec =
m_extraprec->extrapolateM(
213 ctx,
216 false,
218 delete precPar;
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 }
326 }
327
328 delete destParameters;
329 }
330 }
331
333
334 return StatusCode::SUCCESS;
335}
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