3640 {
3641 if (refpar2 == nullptr) {
3642 return;
3643 }
3644 const MeasurementBase *firstmuonhit = nullptr;
3645 const MeasurementBase *lastmuonhit = nullptr;
3646 const MeasurementBase *firstidhit =
3647 nullptr;
3648 const MeasurementBase *lastidhit = nullptr;
3649 const MeasurementBase *firsthit = nullptr;
3650 const MeasurementBase *lasthit = nullptr;
3651 std::vector<std::unique_ptr<GXFTrackState>> &
states = trajectory.trackStates();
3652 std::vector<std::unique_ptr<GXFTrackState>> matstates;
3653 std::unique_ptr< const std::vector < const TrackStateOnSurface *>,
3654 void (*)(const std::vector<const TrackStateOnSurface *> *) >
3656 bool matvec_used=false;
3657 std::unique_ptr<TrackParameters> startmatpar1;
3658 std::unique_ptr<TrackParameters> startmatpar2;
3668
3669 int npseudomuon1 = 0;
3670 int npseudomuon2 = 0;
3671
3672 for (auto & state : states) {
3675 GXFMaterialEffects *meff = state->materialEffects();
3676
3678 if (firstidhit == nullptr) {
3679 npseudomuon1++;
3680 } else {
3681 npseudomuon2++;
3682 }
3683 continue;
3684 }
3685
3687 if (firsthit == nullptr) {
3688 firsthit = state->measurement();
3689 if (cache.m_acceleration) {
3690 if (tp == nullptr) {
3692 ctx,
3693 *refpar2,
3694 state->associatedSurface(),
3696 false,
3697 matEffects
3698 ).release();
3699
3700 if (tp == nullptr) {
3701 return;
3702 }
3703
3704 state->setTrackParameters(std::unique_ptr<const TrackParameters>(tp));
3705 }
3706
3708 }
3709 }
3710 lasthit = state->measurement();
3711 if (
3715 ) {
3716 if (firstidhit == nullptr) {
3717 firstidhit = state->measurement();
3718 }
3719
3720 if ((firstidpar == nullptr) && (tp != nullptr)) {
3722 }
3723
3724 lastidhit = state->measurement();
3725 if (tp != nullptr) {
3727 }
3728
3730 if (firstsiliconpar == nullptr) {
3731 firstsiliconpar =
tp;
3732 }
3733 lastsiliconpar =
tp;
3734 }
3735 }
3736
3737 if (
3744 ) {
3745 if (firstmuonhit == nullptr) {
3746 firstmuonhit = state->measurement();
3747 if (tp != nullptr) {
3749 }
3750 }
3751 lastmuonhit = state->measurement();
3752 if (tp != nullptr) {
3754 }
3755 }
3756 }
3758 if (meff->deltaE() == 0) {
3759 if (firstcalopar == nullptr) {
3760 firstcalopar = state->trackParameters();
3761 }
3762 lastcalopar = state->trackParameters();
3763 }
3764 if (firstmatpar == nullptr) {
3765 firstmatpar = state->trackParameters();
3766 }
3767 }
3768 }
3769
3770 std::unique_ptr<TrackParameters> refpar;
3771 AmgVector(5) newpars = refpar2->parameters();
3772
3773 if (trajectory.m_straightline &&
m_p != 0) {
3775 }
3776
3777 refpar = refpar2->associatedSurface().createUniqueTrackParameters(
3778 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3779 );
3780
3781 if (firstmatpar != nullptr) {
3784 }
3785
3786 if ((startmatpar1 == nullptr) || ((firstidhit != nullptr) && (firstmuonhit != nullptr))) {
3789
3790 const double mass = trajectory.mass();
3791 if (mass > 200 * MeV) {
3792 const AmgVector(5) & newpars = startmatpar2->parameters();
3793 const double oldp = std::abs(1 / newpars[
Trk::qOverP]);
3795
3796 startmatpar2 = startmatpar2->associatedSurface().createUniqueTrackParameters(
3797 newpars[0], newpars[1], newpars[2], newpars[3],
3798 sign / std::sqrt(oldp * oldp + 2 * 100 * MeV * std::sqrt(oldp * oldp + mass * mass) + 100 * MeV * 100 * MeV),
3799 std::nullopt
3800 );
3801 }
3802 }
else if (trajectory.m_straightline &&
m_p != 0) {
3803 AmgVector(5) newpars = startmatpar1->parameters();
3805
3806 startmatpar1 = startmatpar1->associatedSurface().createUniqueTrackParameters(
3807 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3808 );
3809
3810 newpars = startmatpar2->parameters();
3812
3813 startmatpar2 = startmatpar2->associatedSurface().createUniqueTrackParameters(
3814 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3815 );
3816 }
3817
3818 if ((firstidhit !=
nullptr) && trajectory.numberOfSiliconHits() > 0 && cache.m_idmat) {
3819
3820 const DistanceSolution distsol = firstidhit->associatedSurface().straightLineDistanceEstimate(
3821 refpar->position(),
3822 refpar->momentum().unit()
3823 );
3824
3826
3827 if (distance < 0 && distsol.numberOfSolutions() > 0 && !cache.m_acceleration) {
3828 ATH_MSG_DEBUG("Obtaining upstream layers from Extrapolator");
3829
3830 const Surface *destsurf = &firstidhit->associatedSurface();
3831 std::unique_ptr<const TrackParameters> tmppar;
3832
3833 if (firstmuonhit != nullptr) {
3834 const bool caloEntranceIsValid = ensureValidEntranceCalo(ctx, cache);
3835 if (caloEntranceIsValid) {
3836 tmppar = m_extrapolator->extrapolateToVolume(ctx,
3837 *startmatpar1,
3838 *cache.m_caloEntrance,
3839 oppositeMomentum,
3840 Trk::nonInteracting);
3841
3842 if (tmppar != nullptr) {
3843 destsurf = &tmppar->associatedSurface();
3844 }
3845 }
3846 }
3847
3848 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
3850 *startmatpar1,
3851 *destsurf,
3853 false, matEffects) );
3854 matvec_used=false;
3855
3856 if (matvec && !matvec->empty()) {
3857 for (int i = (int)matvec->size() - 1; i > -1; i--) {
3858 const MaterialEffectsBase *meb = (*matvec)[i]->materialEffectsOnTrack();
3859 if (meb) {
3860 if (meb->derivedType() == MaterialEffectsBase::MATERIAL_EFFECTS_ON_TRACK) {
3861 const MaterialEffectsOnTrack *meot = static_cast < const MaterialEffectsOnTrack * >(meb);
3862 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
3863 const TrackParameters * newpars = (*matvec)[i]->trackParameters() != nullptr ? (*matvec)[i]->trackParameters()->clone() : nullptr;
3864 meff->setSigmaDeltaE(0);
3865 matstates.push_back(std::make_unique<GXFTrackState>(
3866 std::move(meff),
3867 std::unique_ptr<const TrackParameters>(newpars)
3868 ));
3869 matvec_used=true;
3870 }
3871 }
3872 }
3873 }
3874 }
3875 }
3876
3877 if ((lastidhit != nullptr) && trajectory.numberOfSiliconHits() > 0 && cache.m_idmat) {
3878 const DistanceSolution distsol = lastidhit->associatedSurface().straightLineDistanceEstimate(
3879 refpar->position(),
3880 refpar->momentum().unit()
3881 );
3882
3884
3885 if (distance > 0 && distsol.numberOfSolutions() > 0) {
3886 ATH_MSG_DEBUG(
"Obtaining downstream ID layers from Extrapolator");
3887 const Surface *destsurf = &lastidhit->associatedSurface();
3888 std::unique_ptr<const TrackParameters> tmppar;
3889 std::unique_ptr<Surface> calosurf;
3890 if (firstmuonhit != nullptr) {
3892 if (caloEntranceIsValid) {
3894 *startmatpar2,
3895 *cache.m_caloEntrance,
3898 }
3899
3900 if (tmppar != nullptr) {
3901 const CylinderSurface *cylcalosurf = nullptr;
3902
3904 cylcalosurf = static_cast<const CylinderSurface *>(&tmppar->associatedSurface());
3905
3906 const DiscSurface *disccalosurf = nullptr;
3907
3909 disccalosurf = static_cast<const DiscSurface *>(&tmppar->associatedSurface());
3910
3911 if (cylcalosurf != nullptr) {
3913 const CylinderBounds & cylbounds = cylcalosurf->bounds();
3914 const double radius = cylbounds.r();
3915 const double hlength = cylbounds.halflengthZ();
3916 calosurf = std::make_unique<CylinderSurface>(trans, radius - 1, hlength);
3917 } else if (disccalosurf != nullptr) {
3918 const double newz = (
3919 disccalosurf->center().
z() > 0 ?
3920 disccalosurf->center().z() - 1 :
3921 disccalosurf->center().z() + 1
3922 );
3923
3925 disccalosurf->center().x(),
3926 disccalosurf->center().y(),
3927 newz
3928 );
3929
3931 trans.translation() << newpos;
3932
3933 const DiscBounds *discbounds = static_cast<const DiscBounds *>(&disccalosurf->bounds());
3934 const double rmin = discbounds->rMin();
3935 const double rmax = discbounds->rMax();
3936 calosurf = std::make_unique<DiscSurface>(trans, rmin, rmax);
3937 }
3938 destsurf = calosurf.release();
3939 }
3940 }
3941
3942 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
3944 ctx, *startmatpar2, *destsurf,
alongMomentum,
false, matEffects));
3945 matvec_used = false;
3946
3947 if (matvec && !matvec->empty()) {
3948 for (const auto & i : *matvec) {
3949 const Trk::MaterialEffectsBase * meb =
i->materialEffectsOnTrack();
3950
3951 if (meb) {
3953 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
3954 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
3955 if (cache.m_fiteloss && (meot->energyLoss() != nullptr)) {
3956 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
3957 }
3958
3959 if (matEffects ==
electron && cache.m_asymeloss) {
3960 meff->setDeltaE(-5);
3961
3962 if (trajectory.numberOfTRTHits() == 0) {
3963 meff->setScatteringSigmas(0, 0);
3964 }
3965
3966 meff->setSigmaDeltaE(50);
3967 }
3968
3969 const TrackParameters * newparams =
i->trackParameters() !=
nullptr ?
i->trackParameters()->clone() :
nullptr;
3970
3971 matstates.push_back(std::make_unique<GXFTrackState>(
3972 std::move(meff),
3973 std::unique_ptr<const TrackParameters>(newparams)
3974 ));
3975 matvec_used=true;
3976 }
3977 }
3978 }
3979 } else {
3981 }
3982 }
3983 }
3984
3985 if (cache.m_calomat && (firstmuonhit != nullptr) && (firstidhit != nullptr)) {
3987
3988 std::vector<MaterialEffectsOnTrack> calomeots =
m_calotool->extrapolationSurfacesAndEffects(
3990 *prop,
3991 *lastidpar,
3992 firstmuonhit->associatedSurface(),
3995 );
3996
3997 if (calomeots.empty()) {
3999 return;
4000 }
4001
4002 std::unique_ptr<const TrackParameters> prevtrackpars =
unique_clone(lastidpar);
4003 if (lasthit == lastmuonhit) {
4004 for (
int i = 0;
i < (
int) calomeots.size();
i++) {
4006
4007 std::unique_ptr<const TrackParameters> layerpar(
m_propagator->propagateParameters(
4008 ctx,
4009 *prevtrackpars,
4010 calomeots[i].associatedSurface(),
4011 propdir,
4012 false,
4013 trajectory.m_fieldprop,
4015 ));
4016
4017 if (layerpar == nullptr) {
4019 return;
4020 }
4021
4022 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(calomeots[i]);
4023
4024 if (i == 2) {
4025 lastcalopar = layerpar.get();
4026 }
4027
4028 if (i == 1) {
4029 const double qoverp = layerpar->parameters()[
Trk::qOverP];
4030 double qoverpbrem = 0;
4031
4032 if (
4033 npseudomuon2 < 2 &&
4034 (firstmuonpar != nullptr) &&
4035 std::abs(firstmuonpar->parameters()[
Trk::qOverP]) > 1.e-9
4036 ) {
4037 qoverpbrem = firstmuonpar->parameters()[
Trk::qOverP];
4038 } else {
4039 const double sign = (qoverp > 0) ? 1 : -1;
4040 qoverpbrem =
sign / (1 / std::abs(qoverp) - std::abs(calomeots[i].energyLoss()->deltaE()));
4041 }
4042
4043 const AmgVector(5) & newpar = layerpar->parameters();
4044
4045 layerpar = layerpar->associatedSurface().createUniqueTrackParameters(
4046 newpar[0], newpar[1], newpar[2], newpar[3], qoverpbrem, std::nullopt
4047 );
4048 meff->setdelta_p(1000 * (qoverpbrem - qoverp));
4049 }
4050
4051 matstates.push_back(std::make_unique<GXFTrackState>(
4052 std::move(meff),
4053 std::unique_ptr<const TrackParameters>(layerpar != nullptr ? layerpar->clone() : nullptr)
4054 ));
4055 prevtrackpars = std::move(layerpar);
4056 }
4057 }
4058
4059 if (
4060 firsthit == firstmuonhit &&
4061 (!cache.m_getmaterialfromtrack || lasthit == lastidhit)
4062 ) {
4064 for (
int i = 0;
i < (
int) calomeots.size();
i++) {
4066 std::unique_ptr<const TrackParameters> layerpar(
m_propagator->propagateParameters(
4067 ctx,
4068 *prevtrackpars,
4069 calomeots[i].associatedSurface(),
4070 propdir,
4071 false,
4072 trajectory.m_fieldprop,
4074 ));
4075
4076 if (layerpar == nullptr) {
4078 return;
4079 }
4080
4081 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(calomeots[i]);
4082
4083 if (i == 2) {
4085 }
4086
4088
4089 if (i == 1) {
4090 const double qoverpbrem = layerpar->parameters()[
Trk::qOverP];
4091 double qoverp = 0;
4092
4093 if (
4094 npseudomuon1 < 2 &&
4095 (lastmuonpar != nullptr) &&
4096 std::abs(lastmuonpar->parameters()[
Trk::qOverP]) > 1.e-9
4097 ) {
4099 } else {
4100 const double sign = (qoverpbrem > 0) ? 1 : -1;
4101 qoverp =
sign / (1 / std::abs(qoverpbrem) + std::abs(calomeots[i].energyLoss()->deltaE()));
4102 }
4103
4104 meff->setdelta_p(1000 * (qoverpbrem - qoverp));
4105 const AmgVector(5) & newpar = layerpar->parameters();
4106
4107 prevtrackpars = layerpar->associatedSurface().createUniqueTrackParameters(
4108 newpar[0], newpar[1], newpar[2], newpar[3], qoverp, std::nullopt
4109 );
4110 }
4111
4112 matstates.insert(matstates.begin(), std::make_unique<GXFTrackState>(std::move(meff), std::move(layerpar)));
4113 }
4114 }
4115 }
4116
4117 if (lasthit == lastmuonhit && cache.m_extmat) {
4118 std::unique_ptr<const Trk::TrackParameters> muonpar1;
4119
4120 if (lastcalopar != nullptr) {
4122 if (msEntranceIsValid) {
4123 if (cache.m_msEntrance->inside(lastcalopar->position())) {
4125 *lastcalopar,
4126 *cache.m_msEntrance,
4129
4130 if (muonpar1 != nullptr) {
4136 rot.col(0) = curvU;
4137 rot.col(1) = curvV;
4138 rot.col(2) = trackdir;
4140 trans.linear().matrix() << rot;
4141 trans.translation() << muonpar1->position() - .1 * trackdir;
4142 PlaneSurface const curvlinsurf(trans);
4143
4144 std::unique_ptr<const TrackParameters> curvlinpar(
m_extrapolator->extrapolateDirectly(
4145 ctx,
4146 *muonpar1,
4147 curvlinsurf,
4150 ));
4151
4152 if (curvlinpar != nullptr) {
4153 muonpar1 = std::move(curvlinpar);
4154 }
4155 }
4156 } else {
4157 muonpar1 = std::unique_ptr<TrackParameters>(lastcalopar->clone());
4158 }
4159 }
4160 } else {
4161 muonpar1 = std::unique_ptr<TrackParameters>(refpar->clone());
4162 }
4163
4164 DistanceSolution distsol;
4165
4166 if (muonpar1 != nullptr) {
4167 distsol = lastmuonhit->associatedSurface().straightLineDistanceEstimate(
4168 muonpar1->position(),
4169 muonpar1->momentum().unit()
4170 );
4171 }
4172
4174
4175 if ((distance > 0) and(distsol.numberOfSolutions() >
4176 0) and (firstmuonhit != nullptr)) {
4177 distsol = firstmuonhit->associatedSurface().straightLineDistanceEstimate(
4178 muonpar1->position(),
4179 muonpar1->momentum().unit()
4180 );
4181
4183
4184 if (distsol.numberOfSolutions() == 1) {
4186 } else if (distsol.numberOfSolutions() == 2) {
4188 std::abs(distsol.first()) < std::abs(distsol.second()) ?
4189 distsol.first() :
4190 distsol.second()
4191 );
4192 }
4193
4194 if (distance < 0 && distsol.numberOfSolutions() > 0 && (firstidhit == nullptr)) {
4195 if (firstmuonpar != nullptr) {
4196 AmgVector(5) newpars = firstmuonpar->parameters();
4197
4198 if (trajectory.m_straightline &&
m_p != 0) {
4200 }
4201
4202 muonpar1 = firstmuonpar->associatedSurface().createUniqueTrackParameters(
4203 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
4204 );
4205 } else {
4206 std::unique_ptr<const TrackParameters> tmppar(
m_propagator->propagateParameters(
4207 ctx,
4208 *muonpar1,
4209 firstmuonhit->associatedSurface(),
4211 false,
4212 trajectory.m_fieldprop,
4214 ));
4215
4216 if (tmppar != nullptr) {
4217 muonpar1 = std::move(tmppar);
4218 }
4219 }
4220 }
4221
4223 ATH_MSG_DEBUG(
"Obtaining downstream layers from Extrapolator");
4224 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
4226 *prevtp,
4227 states.back()->associatedSurface(),
4229 false,
4231 matvec_used = false;
4232
4235 return;
4236 }
4237
4238 if (matvec && !matvec->empty()) {
4239 for (
int j = 0; j < (
int) matvec->size(); j++) {
4240 const MaterialEffectsBase *meb = (*matvec)[j]->materialEffectsOnTrack();
4241
4242 if (meb) {
4244 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
4245 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
4246
4247 if (
4248 !trajectory.m_straightline &&
4249 (meot->energyLoss() != nullptr) &&
4250 std::abs(meff->deltaE()) > 25 &&
4251 std::abs((*matvec)[j]->trackParameters()->position().z()) < 13000
4252 ) {
4253 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
4254 }
4255
4256 const TrackParameters * newparams = (*matvec)[j]->trackParameters() !=
nullptr ? (*matvec)[j]->trackParameters()->
clone() :
nullptr;
4257
4258 matstates.push_back(std::make_unique<GXFTrackState>(
4259 std::move(meff),
4260 std::unique_ptr<const TrackParameters>(newparams)
4261 ));
4262 matvec_used=true;
4263 }
4264 }
4265 }
4266 }
4267 }
4268 }
4269
4270 if (firsthit == firstmuonhit && cache.m_extmat && (firstcalopar != nullptr)) {
4271 std::unique_ptr<const Trk::TrackParameters> muonpar1;
4272
4274 if (msEntranceIsValid) {
4275 if (cache.m_msEntrance->inside(firstcalopar->position())) {
4277 *firstcalopar,
4278 *cache.m_msEntrance,
4281
4282 if (muonpar1 != nullptr) {
4288 rot.col(0) = curvU;
4289 rot.col(1) = curvV;
4290 rot.col(2) = trackdir;
4292 trans.linear().matrix() << rot;
4293 trans.translation() << muonpar1->position() - .1 * trackdir;
4294 const PlaneSurface curvlinsurf(trans);
4295
4296 std::unique_ptr<const TrackParameters> curvlinpar(
m_extrapolator->extrapolateDirectly(
4297 ctx,
4298 *muonpar1,
4299 curvlinsurf,
4302 ));
4303
4304 if (curvlinpar != nullptr) {
4305 muonpar1 = std::move(curvlinpar);
4306 }
4307 }
4308 } else {
4309 muonpar1 = std::unique_ptr<const TrackParameters>(firstcalopar->clone());
4310 }
4311 }
4312
4313 DistanceSolution distsol;
4314
4315 if (muonpar1 != nullptr) {
4316 distsol = firstmuonhit->associatedSurface().straightLineDistanceEstimate(
4317 muonpar1->position(),
4318 muonpar1->momentum().unit()
4319 );
4320 }
4321
4323
4324 if (distance < 0 && distsol.numberOfSolutions() > 0) {
4326 ATH_MSG_DEBUG(
"Collecting upstream muon material from extrapolator");
4327 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
4329 *prevtp,
4330 states[0]->associatedSurface(),
4332 false,
4334 matvec_used = false;
4335
4336 if (matvec && !matvec->empty()) {
4337 ATH_MSG_DEBUG(
"Retrieved " << matvec->size() <<
" material states");
4338
4339 for (
int j = 0; j < (
int) matvec->size(); j++) {
4340 const MaterialEffectsBase *meb = (*matvec)[j]->materialEffectsOnTrack();
4341
4342 if (meb != nullptr) {
4343
4344
4346 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
4347 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
4348
4349 if (
4350 !trajectory.m_straightline &&
4351 (meot->energyLoss() != nullptr) &&
4352 std::abs(meff->deltaE()) > 25 &&
4353 std::abs((*matvec)[j]->trackParameters()->position().z()) < 13000
4354 ) {
4355 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
4356 }
4357
4359 (*matvec)[j]->trackParameters() != nullptr
4360 ? (*matvec)[j]->trackParameters()->
clone()
4361 : nullptr;
4362
4363 matstates.insert(matstates.begin(), std::make_unique<GXFTrackState>(
4364 std::move(meff),
4365 std::unique_ptr<const TrackParameters>(tmpparams)
4366 ));
4367 matvec_used=true;
4368 }
4369 }
4370 }
4371 }
4372 }
4373 }
4374
4376
4377
4378 std::vector<std::unique_ptr<GXFTrackState>> & newstates =
states;
4379 std::vector<std::unique_ptr<GXFTrackState>> oldstates = std::move(newstates);
4380
4381 newstates.clear();
4382 newstates.reserve(oldstates.size() + matstates.size());
4383
4384 int layerno = 0;
4385 int firstlayerno = -1;
4386
4387 if (cache.m_acceleration) {
4388 trajectory.addBasicState(std::move(oldstates[0]));
4389 }
4390
4391 const double cosphi = std::cos(refpar->parameters()[
Trk::phi0]);
4392 const double sinphi = std::sin(refpar->parameters()[
Trk::phi0]);
4393
4394 for (int i = cache.m_acceleration ? 1 : 0; i < (int) oldstates.size(); i++) {
4395 bool addlayer = true;
4396
4397 while (addlayer && layerno < (int) matstates.size()) {
4398 addlayer = false;
4399 const TrackParameters *layerpar = matstates[layerno]->trackParameters();
4400
4401 const DistanceSolution distsol = oldstates[
i]->associatedSurface().straightLineDistanceEstimate(
4402 layerpar->position(),
4403 layerpar->momentum().unit()
4404 );
4405
4407
4408 if (distance > 0 && distsol.numberOfSolutions() > 0) {
4409 addlayer = true;
4410 }
4411
4413 const double cylinderradius = layerpar->associatedSurface().bounds().r();
4414 const double trackimpact = std::abs(-refpar->position().x() * sinphi + refpar->position().y() * cosphi);
4415
4416 if (trackimpact > cylinderradius - 5 * mm) {
4417 layerno++;
4418 continue;
4419 }
4420 }
4421
4422 if (i == (int) oldstates.size() - 1) {
4423 addlayer = true;
4424 }
4425
4426 if (addlayer) {
4427 GXFMaterialEffects *meff = matstates[layerno]->materialEffects();
4428
4429 if (meff->sigmaDeltaPhi() > .4 || (meff->sigmaDeltaPhi() == 0 && meff->sigmaDeltaE() <= 0)) {
4430 if (meff->sigmaDeltaPhi() > .4) {
4431 ATH_MSG_DEBUG(
"Material state with excessive scattering, skipping it");
4432 }
4433
4434 if (meff->sigmaDeltaPhi() == 0) {
4436 }
4437
4438 layerno++;
4439 continue;
4440 }
4441
4442 if (firstlayerno < 0) {
4443 firstlayerno = layerno;
4444 }
4445
4446 trajectory.addMaterialState(std::move(matstates[layerno]));
4447
4448 if ((layerpar !=
nullptr) && matEffects !=
pion && matEffects !=
muon) {
4449 const TrackingVolume *tvol =
m_navigator->volume(ctx,layerpar->position());
4450 const Layer *lay =
nullptr;
4451
4452 if (tvol != nullptr) {
4453 lay = (tvol->closestMaterialLayer(layerpar->position(),layerpar->momentum().normalized())).object;
4454 }
4455
4456 const MaterialProperties *matprop = lay != nullptr ? lay->fullUpdateMaterialProperties(*layerpar) : nullptr;
4457 meff->setMaterialProperties(matprop);
4458 }
4459
4460 layerno++;
4461 }
4462 }
4463 trajectory.addBasicState(std::move(oldstates[i]));
4464 }
4465
4466 ATH_MSG_DEBUG(
"Total X0: " << trajectory.totalX0() <<
" total eloss: " << trajectory.totalEnergyLoss());
4467
4468 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
4469 }
#define ATH_MSG_WARNING(x)
Gaudi::Property< double > m_p
Gaudi::Property< bool > m_rejectLargeNScat
ToolHandle< INavigator > m_navigator
ToolHandle< IExtrapolator > m_extrapolator
bool ensureValidEntranceMuonSpectrometer(const EventContext &ctx, Cache &cache) const
ToolHandle< IMaterialEffectsOnTrackProvider > m_calotool
@ MATERIAL_EFFECTS_ON_TRACK
virtual MaterialEffectsDerivedType derivedType() const =0
Returns the concrete derived type.
virtual ParametersBase< DIM, T > * clone() const override=0
clone method for polymorphic deep copy
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ BremPoint
This represents a brem point on the track, and so will contain TrackParameters and MaterialEffectsBas...
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Affine3d Transform3D
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Eigen::Matrix< double, 3, 1 > Vector3D
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
MeasurementType
enum describing the flavour of MeasurementBase
PropDirection
PropDirection, enum for direction of the propagation.
std::unique_ptr< T > unique_clone(const T *v)
@ z
global position (cartesian)
@ u
Enums for curvilinear frames.
static void objVectorDeleter(const std::vector< const T * > *ptr)