3637 {
3638 if (refpar2 == nullptr) {
3639 return;
3640 }
3641 const MeasurementBase *firstmuonhit = nullptr;
3642 const MeasurementBase *lastmuonhit = nullptr;
3643 const MeasurementBase *firstidhit =
3644 nullptr;
3645 const MeasurementBase *lastidhit = nullptr;
3646 const MeasurementBase *firsthit = nullptr;
3647 const MeasurementBase *lasthit = nullptr;
3648 std::vector<std::unique_ptr<GXFTrackState>> &
states = trajectory.trackStates();
3649 std::vector<std::unique_ptr<GXFTrackState>> matstates;
3650 std::unique_ptr< const std::vector < const TrackStateOnSurface *>,
3651 void (*)(const std::vector<const TrackStateOnSurface *> *) >
3653 bool matvec_used=false;
3654 std::unique_ptr<TrackParameters> startmatpar1;
3655 std::unique_ptr<TrackParameters> startmatpar2;
3665
3666 int npseudomuon1 = 0;
3667 int npseudomuon2 = 0;
3668
3669 for (auto & state : states) {
3672 GXFMaterialEffects *meff = state->materialEffects();
3673
3675 if (firstidhit == nullptr) {
3676 npseudomuon1++;
3677 } else {
3678 npseudomuon2++;
3679 }
3680 continue;
3681 }
3682
3684 if (firsthit == nullptr) {
3685 firsthit = state->measurement();
3686 if (cache.m_acceleration) {
3687 if (tp == nullptr) {
3689 ctx,
3690 *refpar2,
3691 state->associatedSurface(),
3693 false,
3694 matEffects
3695 ).release();
3696
3697 if (tp == nullptr) {
3698 return;
3699 }
3700
3701 state->setTrackParameters(std::unique_ptr<const TrackParameters>(tp));
3702 }
3703
3705 }
3706 }
3707 lasthit = state->measurement();
3708 if (
3712 ) {
3713 if (firstidhit == nullptr) {
3714 firstidhit = state->measurement();
3715 }
3716
3717 if ((firstidpar == nullptr) && (tp != nullptr)) {
3719 }
3720
3721 lastidhit = state->measurement();
3722 if (tp != nullptr) {
3724 }
3725
3727 if (firstsiliconpar == nullptr) {
3728 firstsiliconpar =
tp;
3729 }
3730 lastsiliconpar =
tp;
3731 }
3732 }
3733
3734 if (
3741 ) {
3742 if (firstmuonhit == nullptr) {
3743 firstmuonhit = state->measurement();
3744 if (tp != nullptr) {
3746 }
3747 }
3748 lastmuonhit = state->measurement();
3749 if (tp != nullptr) {
3751 }
3752 }
3753 }
3755 if (meff->deltaE() == 0) {
3756 if (firstcalopar == nullptr) {
3757 firstcalopar = state->trackParameters();
3758 }
3759 lastcalopar = state->trackParameters();
3760 }
3761 if (firstmatpar == nullptr) {
3762 firstmatpar = state->trackParameters();
3763 }
3764 }
3765 }
3766
3767 std::unique_ptr<TrackParameters> refpar;
3768 AmgVector(5) newpars = refpar2->parameters();
3769
3770 if (trajectory.m_straightline &&
m_p != 0) {
3772 }
3773
3774 refpar = refpar2->associatedSurface().createUniqueTrackParameters(
3775 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3776 );
3777
3778 if (firstmatpar != nullptr) {
3781 }
3782
3783 if ((startmatpar1 == nullptr) || ((firstidhit != nullptr) && (firstmuonhit != nullptr))) {
3786
3787 const double mass = trajectory.mass();
3788 if (mass > 200 * MeV) {
3789 const AmgVector(5) & newpars = startmatpar2->parameters();
3790 const double oldp = std::abs(1 / newpars[
Trk::qOverP]);
3792
3793 startmatpar2 = startmatpar2->associatedSurface().createUniqueTrackParameters(
3794 newpars[0], newpars[1], newpars[2], newpars[3],
3795 sign / std::sqrt(oldp * oldp + 2 * 100 * MeV * std::sqrt(oldp * oldp + mass * mass) + 100 * MeV * 100 * MeV),
3796 std::nullopt
3797 );
3798 }
3799 }
else if (trajectory.m_straightline &&
m_p != 0) {
3800 AmgVector(5) newpars = startmatpar1->parameters();
3802
3803 startmatpar1 = startmatpar1->associatedSurface().createUniqueTrackParameters(
3804 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3805 );
3806
3807 newpars = startmatpar2->parameters();
3809
3810 startmatpar2 = startmatpar2->associatedSurface().createUniqueTrackParameters(
3811 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3812 );
3813 }
3814
3815 if ((firstidhit !=
nullptr) && trajectory.numberOfSiliconHits() > 0 && cache.m_idmat) {
3816
3817 const DistanceSolution distsol = firstidhit->associatedSurface().straightLineDistanceEstimate(
3818 refpar->position(),
3819 refpar->momentum().unit()
3820 );
3821
3823
3824 if (distance < 0 && distsol.numberOfSolutions() > 0 && !cache.m_acceleration) {
3825 ATH_MSG_DEBUG("Obtaining upstream layers from Extrapolator");
3826
3827 const Surface *destsurf = &firstidhit->associatedSurface();
3828 std::unique_ptr<const TrackParameters> tmppar;
3829
3830 if (firstmuonhit != nullptr) {
3831 const bool caloEntranceIsValid = ensureValidEntranceCalo(ctx, cache);
3832 if (caloEntranceIsValid) {
3833 tmppar = m_extrapolator->extrapolateToVolume(ctx,
3834 *startmatpar1,
3835 *cache.m_caloEntrance,
3836 oppositeMomentum,
3837 Trk::nonInteracting);
3838
3839 if (tmppar != nullptr) {
3840 destsurf = &tmppar->associatedSurface();
3841 }
3842 }
3843 }
3844
3845 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
3847 *startmatpar1,
3848 *destsurf,
3850 false, matEffects) );
3851 matvec_used=false;
3852
3853 if (matvec && !matvec->empty()) {
3854 for (int i = (int)matvec->size() - 1; i > -1; i--) {
3855 const MaterialEffectsBase *meb = (*matvec)[i]->materialEffectsOnTrack();
3856 if (meb) {
3857 if (meb->derivedType() == MaterialEffectsBase::MATERIAL_EFFECTS_ON_TRACK) {
3858 const MaterialEffectsOnTrack *meot = static_cast < const MaterialEffectsOnTrack * >(meb);
3859 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
3860 const TrackParameters * newpars = (*matvec)[i]->trackParameters() != nullptr ? (*matvec)[i]->trackParameters()->clone() : nullptr;
3861 meff->setSigmaDeltaE(0);
3862 matstates.push_back(std::make_unique<GXFTrackState>(
3863 std::move(meff),
3864 std::unique_ptr<const TrackParameters>(newpars)
3865 ));
3866 matvec_used=true;
3867 }
3868 }
3869 }
3870 }
3871 }
3872 }
3873
3874 if ((lastidhit != nullptr) && trajectory.numberOfSiliconHits() > 0 && cache.m_idmat) {
3875 const DistanceSolution distsol = lastidhit->associatedSurface().straightLineDistanceEstimate(
3876 refpar->position(),
3877 refpar->momentum().unit()
3878 );
3879
3881
3882 if (distance > 0 && distsol.numberOfSolutions() > 0) {
3883 ATH_MSG_DEBUG(
"Obtaining downstream ID layers from Extrapolator");
3884 const Surface *destsurf = &lastidhit->associatedSurface();
3885 std::unique_ptr<const TrackParameters> tmppar;
3886 std::unique_ptr<Surface> calosurf;
3887 if (firstmuonhit != nullptr) {
3889 if (caloEntranceIsValid) {
3891 *startmatpar2,
3892 *cache.m_caloEntrance,
3895 }
3896
3897 if (tmppar != nullptr) {
3898 const CylinderSurface *cylcalosurf = nullptr;
3899
3901 cylcalosurf = static_cast<const CylinderSurface *>(&tmppar->associatedSurface());
3902
3903 const DiscSurface *disccalosurf = nullptr;
3904
3906 disccalosurf = static_cast<const DiscSurface *>(&tmppar->associatedSurface());
3907
3908 if (cylcalosurf != nullptr) {
3910 const CylinderBounds & cylbounds = cylcalosurf->bounds();
3911 const double radius = cylbounds.r();
3912 const double hlength = cylbounds.halflengthZ();
3913 calosurf = std::make_unique<CylinderSurface>(trans, radius - 1, hlength);
3914 } else if (disccalosurf != nullptr) {
3915 const double newz = (
3916 disccalosurf->center().
z() > 0 ?
3917 disccalosurf->center().z() - 1 :
3918 disccalosurf->center().z() + 1
3919 );
3920
3922 disccalosurf->center().x(),
3923 disccalosurf->center().y(),
3924 newz
3925 );
3926
3928 trans.translation() << newpos;
3929
3930 const DiscBounds *discbounds = static_cast<const DiscBounds *>(&disccalosurf->bounds());
3931 const double rmin = discbounds->rMin();
3932 const double rmax = discbounds->rMax();
3933 calosurf = std::make_unique<DiscSurface>(trans, rmin, rmax);
3934 }
3935 destsurf = calosurf.release();
3936 }
3937 }
3938
3939 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
3941 ctx, *startmatpar2, *destsurf,
alongMomentum,
false, matEffects));
3942 matvec_used = false;
3943
3944 if (matvec && !matvec->empty()) {
3945 for (const auto & i : *matvec) {
3946 const Trk::MaterialEffectsBase * meb =
i->materialEffectsOnTrack();
3947
3948 if (meb) {
3950 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
3951 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
3952 if (cache.m_fiteloss && (meot->energyLoss() != nullptr)) {
3953 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
3954 }
3955
3956 if (matEffects ==
electron && cache.m_asymeloss) {
3957 meff->setDeltaE(-5);
3958
3959 if (trajectory.numberOfTRTHits() == 0) {
3960 meff->setScatteringSigmas(0, 0);
3961 }
3962
3963 meff->setSigmaDeltaE(50);
3964 }
3965
3966 const TrackParameters * newparams =
i->trackParameters() !=
nullptr ?
i->trackParameters()->clone() :
nullptr;
3967
3968 matstates.push_back(std::make_unique<GXFTrackState>(
3969 std::move(meff),
3970 std::unique_ptr<const TrackParameters>(newparams)
3971 ));
3972 matvec_used=true;
3973 }
3974 }
3975 }
3976 } else {
3978 }
3979 }
3980 }
3981
3982 if (cache.m_calomat && (firstmuonhit != nullptr) && (firstidhit != nullptr)) {
3984
3985 std::vector<MaterialEffectsOnTrack> calomeots =
m_calotool->extrapolationSurfacesAndEffects(
3987 *prop,
3988 *lastidpar,
3989 firstmuonhit->associatedSurface(),
3992 );
3993
3994 if (calomeots.empty()) {
3996 return;
3997 }
3998
3999 std::unique_ptr<const TrackParameters> prevtrackpars =
unique_clone(lastidpar);
4000 if (lasthit == lastmuonhit) {
4001 for (
int i = 0;
i < (
int) calomeots.size();
i++) {
4003
4004 std::unique_ptr<const TrackParameters> layerpar(
m_propagator->propagateParameters(
4005 ctx,
4006 *prevtrackpars,
4007 calomeots[i].associatedSurface(),
4008 propdir,
4009 false,
4010 trajectory.m_fieldprop,
4012 ));
4013
4014 if (layerpar == nullptr) {
4016 return;
4017 }
4018
4019 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(calomeots[i]);
4020
4021 if (i == 2) {
4022 lastcalopar = layerpar.get();
4023 }
4024
4025 if (i == 1) {
4026 const double qoverp = layerpar->parameters()[
Trk::qOverP];
4027 double qoverpbrem = 0;
4028
4029 if (
4030 npseudomuon2 < 2 &&
4031 (firstmuonpar != nullptr) &&
4032 std::abs(firstmuonpar->parameters()[
Trk::qOverP]) > 1.e-9
4033 ) {
4034 qoverpbrem = firstmuonpar->parameters()[
Trk::qOverP];
4035 } else {
4036 const double sign = (qoverp > 0) ? 1 : -1;
4037 qoverpbrem =
sign / (1 / std::abs(qoverp) - std::abs(calomeots[i].energyLoss()->deltaE()));
4038 }
4039
4040 const AmgVector(5) & newpar = layerpar->parameters();
4041
4042 layerpar = layerpar->associatedSurface().createUniqueTrackParameters(
4043 newpar[0], newpar[1], newpar[2], newpar[3], qoverpbrem, std::nullopt
4044 );
4045 meff->setdelta_p(1000 * (qoverpbrem - qoverp));
4046 }
4047
4048 matstates.push_back(std::make_unique<GXFTrackState>(
4049 std::move(meff),
4050 std::unique_ptr<const TrackParameters>(layerpar != nullptr ? layerpar->clone() : nullptr)
4051 ));
4052 prevtrackpars = std::move(layerpar);
4053 }
4054 }
4055
4056 if (
4057 firsthit == firstmuonhit &&
4058 (!cache.m_getmaterialfromtrack || lasthit == lastidhit)
4059 ) {
4061 for (
int i = 0;
i < (
int) calomeots.size();
i++) {
4063 std::unique_ptr<const TrackParameters> layerpar(
m_propagator->propagateParameters(
4064 ctx,
4065 *prevtrackpars,
4066 calomeots[i].associatedSurface(),
4067 propdir,
4068 false,
4069 trajectory.m_fieldprop,
4071 ));
4072
4073 if (layerpar == nullptr) {
4075 return;
4076 }
4077
4078 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(calomeots[i]);
4079
4080 if (i == 2) {
4082 }
4083
4085
4086 if (i == 1) {
4087 const double qoverpbrem = layerpar->parameters()[
Trk::qOverP];
4088 double qoverp = 0;
4089
4090 if (
4091 npseudomuon1 < 2 &&
4092 (lastmuonpar != nullptr) &&
4093 std::abs(lastmuonpar->parameters()[
Trk::qOverP]) > 1.e-9
4094 ) {
4096 } else {
4097 const double sign = (qoverpbrem > 0) ? 1 : -1;
4098 qoverp =
sign / (1 / std::abs(qoverpbrem) + std::abs(calomeots[i].energyLoss()->deltaE()));
4099 }
4100
4101 meff->setdelta_p(1000 * (qoverpbrem - qoverp));
4102 const AmgVector(5) & newpar = layerpar->parameters();
4103
4104 prevtrackpars = layerpar->associatedSurface().createUniqueTrackParameters(
4105 newpar[0], newpar[1], newpar[2], newpar[3], qoverp, std::nullopt
4106 );
4107 }
4108
4109 matstates.insert(matstates.begin(), std::make_unique<GXFTrackState>(std::move(meff), std::move(layerpar)));
4110 }
4111 }
4112 }
4113
4114 if (lasthit == lastmuonhit && cache.m_extmat) {
4115 std::unique_ptr<const Trk::TrackParameters> muonpar1;
4116
4117 if (lastcalopar != nullptr) {
4119 if (msEntranceIsValid) {
4120 if (cache.m_msEntrance->inside(lastcalopar->position())) {
4122 *lastcalopar,
4123 *cache.m_msEntrance,
4126
4127 if (muonpar1 != nullptr) {
4133 rot.col(0) = curvU;
4134 rot.col(1) = curvV;
4135 rot.col(2) = trackdir;
4137 trans.linear().matrix() << rot;
4138 trans.translation() << muonpar1->position() - .1 * trackdir;
4139 PlaneSurface const curvlinsurf(trans);
4140
4141 std::unique_ptr<const TrackParameters> curvlinpar(
m_extrapolator->extrapolateDirectly(
4142 ctx,
4143 *muonpar1,
4144 curvlinsurf,
4147 ));
4148
4149 if (curvlinpar != nullptr) {
4150 muonpar1 = std::move(curvlinpar);
4151 }
4152 }
4153 } else {
4154 muonpar1 = std::unique_ptr<TrackParameters>(lastcalopar->clone());
4155 }
4156 }
4157 } else {
4158 muonpar1 = std::unique_ptr<TrackParameters>(refpar->clone());
4159 }
4160
4161 DistanceSolution distsol;
4162
4163 if (muonpar1 != nullptr) {
4164 distsol = lastmuonhit->associatedSurface().straightLineDistanceEstimate(
4165 muonpar1->position(),
4166 muonpar1->momentum().unit()
4167 );
4168 }
4169
4171
4172 if ((distance > 0) and(distsol.numberOfSolutions() >
4173 0) and (firstmuonhit != nullptr)) {
4174 distsol = firstmuonhit->associatedSurface().straightLineDistanceEstimate(
4175 muonpar1->position(),
4176 muonpar1->momentum().unit()
4177 );
4178
4180
4181 if (distsol.numberOfSolutions() == 1) {
4183 } else if (distsol.numberOfSolutions() == 2) {
4185 std::abs(distsol.first()) < std::abs(distsol.second()) ?
4186 distsol.first() :
4187 distsol.second()
4188 );
4189 }
4190
4191 if (distance < 0 && distsol.numberOfSolutions() > 0 && (firstidhit == nullptr)) {
4192 if (firstmuonpar != nullptr) {
4193 AmgVector(5) newpars = firstmuonpar->parameters();
4194
4195 if (trajectory.m_straightline &&
m_p != 0) {
4197 }
4198
4199 muonpar1 = firstmuonpar->associatedSurface().createUniqueTrackParameters(
4200 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
4201 );
4202 } else {
4203 std::unique_ptr<const TrackParameters> tmppar(
m_propagator->propagateParameters(
4204 ctx,
4205 *muonpar1,
4206 firstmuonhit->associatedSurface(),
4208 false,
4209 trajectory.m_fieldprop,
4211 ));
4212
4213 if (tmppar != nullptr) {
4214 muonpar1 = std::move(tmppar);
4215 }
4216 }
4217 }
4218
4220 ATH_MSG_DEBUG(
"Obtaining downstream layers from Extrapolator");
4221 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
4223 *prevtp,
4224 states.back()->associatedSurface(),
4226 false,
4228 matvec_used = false;
4229
4232 return;
4233 }
4234
4235 if (matvec && !matvec->empty()) {
4236 for (
int j = 0; j < (
int) matvec->size(); j++) {
4237 const MaterialEffectsBase *meb = (*matvec)[j]->materialEffectsOnTrack();
4238
4239 if (meb) {
4241 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
4242 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
4243
4244 if (
4245 !trajectory.m_straightline &&
4246 (meot->energyLoss() != nullptr) &&
4247 std::abs(meff->deltaE()) > 25 &&
4248 std::abs((*matvec)[j]->trackParameters()->position().z()) < 13000
4249 ) {
4250 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
4251 }
4252
4253 const TrackParameters * newparams = (*matvec)[j]->trackParameters() !=
nullptr ? (*matvec)[j]->trackParameters()->
clone() :
nullptr;
4254
4255 matstates.push_back(std::make_unique<GXFTrackState>(
4256 std::move(meff),
4257 std::unique_ptr<const TrackParameters>(newparams)
4258 ));
4259 matvec_used=true;
4260 }
4261 }
4262 }
4263 }
4264 }
4265 }
4266
4267 if (firsthit == firstmuonhit && cache.m_extmat && (firstcalopar != nullptr)) {
4268 std::unique_ptr<const Trk::TrackParameters> muonpar1;
4269
4271 if (msEntranceIsValid) {
4272 if (cache.m_msEntrance->inside(firstcalopar->position())) {
4274 *firstcalopar,
4275 *cache.m_msEntrance,
4278
4279 if (muonpar1 != nullptr) {
4285 rot.col(0) = curvU;
4286 rot.col(1) = curvV;
4287 rot.col(2) = trackdir;
4289 trans.linear().matrix() << rot;
4290 trans.translation() << muonpar1->position() - .1 * trackdir;
4291 const PlaneSurface curvlinsurf(trans);
4292
4293 std::unique_ptr<const TrackParameters> curvlinpar(
m_extrapolator->extrapolateDirectly(
4294 ctx,
4295 *muonpar1,
4296 curvlinsurf,
4299 ));
4300
4301 if (curvlinpar != nullptr) {
4302 muonpar1 = std::move(curvlinpar);
4303 }
4304 }
4305 } else {
4306 muonpar1 = std::unique_ptr<const TrackParameters>(firstcalopar->clone());
4307 }
4308 }
4309
4310 DistanceSolution distsol;
4311
4312 if (muonpar1 != nullptr) {
4313 distsol = firstmuonhit->associatedSurface().straightLineDistanceEstimate(
4314 muonpar1->position(),
4315 muonpar1->momentum().unit()
4316 );
4317 }
4318
4320
4321 if (distance < 0 && distsol.numberOfSolutions() > 0) {
4323 ATH_MSG_DEBUG(
"Collecting upstream muon material from extrapolator");
4324 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
4326 *prevtp,
4327 states[0]->associatedSurface(),
4329 false,
4331 matvec_used = false;
4332
4333 if (matvec && !matvec->empty()) {
4334 ATH_MSG_DEBUG(
"Retrieved " << matvec->size() <<
" material states");
4335
4336 for (
int j = 0; j < (
int) matvec->size(); j++) {
4337 const MaterialEffectsBase *meb = (*matvec)[j]->materialEffectsOnTrack();
4338
4339 if (meb != nullptr) {
4340
4341
4343 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
4344 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
4345
4346 if (
4347 !trajectory.m_straightline &&
4348 (meot->energyLoss() != nullptr) &&
4349 std::abs(meff->deltaE()) > 25 &&
4350 std::abs((*matvec)[j]->trackParameters()->position().z()) < 13000
4351 ) {
4352 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
4353 }
4354
4356 (*matvec)[j]->trackParameters() != nullptr
4357 ? (*matvec)[j]->trackParameters()->
clone()
4358 : nullptr;
4359
4360 matstates.insert(matstates.begin(), std::make_unique<GXFTrackState>(
4361 std::move(meff),
4362 std::unique_ptr<const TrackParameters>(tmpparams)
4363 ));
4364 matvec_used=true;
4365 }
4366 }
4367 }
4368 }
4369 }
4370 }
4371
4373
4374
4375 std::vector<std::unique_ptr<GXFTrackState>> & newstates =
states;
4376 std::vector<std::unique_ptr<GXFTrackState>> oldstates = std::move(newstates);
4377
4378 newstates.clear();
4379 newstates.reserve(oldstates.size() + matstates.size());
4380
4381 int layerno = 0;
4382 int firstlayerno = -1;
4383
4384 if (cache.m_acceleration) {
4385 trajectory.addBasicState(std::move(oldstates[0]));
4386 }
4387
4388 const double cosphi = std::cos(refpar->parameters()[
Trk::phi0]);
4389 const double sinphi = std::sin(refpar->parameters()[
Trk::phi0]);
4390
4391 for (int i = cache.m_acceleration ? 1 : 0; i < (int) oldstates.size(); i++) {
4392 bool addlayer = true;
4393
4394 while (addlayer && layerno < (int) matstates.size()) {
4395 addlayer = false;
4396 const TrackParameters *layerpar = matstates[layerno]->trackParameters();
4397
4398 const DistanceSolution distsol = oldstates[
i]->associatedSurface().straightLineDistanceEstimate(
4399 layerpar->position(),
4400 layerpar->momentum().unit()
4401 );
4402
4404
4405 if (distance > 0 && distsol.numberOfSolutions() > 0) {
4406 addlayer = true;
4407 }
4408
4410 const double cylinderradius = layerpar->associatedSurface().bounds().r();
4411 const double trackimpact = std::abs(-refpar->position().x() * sinphi + refpar->position().y() * cosphi);
4412
4413 if (trackimpact > cylinderradius - 5 * mm) {
4414 layerno++;
4415 continue;
4416 }
4417 }
4418
4419 if (i == (int) oldstates.size() - 1) {
4420 addlayer = true;
4421 }
4422
4423 if (addlayer) {
4424 GXFMaterialEffects *meff = matstates[layerno]->materialEffects();
4425
4426 if (meff->sigmaDeltaPhi() > .4 || (meff->sigmaDeltaPhi() == 0 && meff->sigmaDeltaE() <= 0)) {
4427 if (meff->sigmaDeltaPhi() > .4) {
4428 ATH_MSG_DEBUG(
"Material state with excessive scattering, skipping it");
4429 }
4430
4431 if (meff->sigmaDeltaPhi() == 0) {
4433 }
4434
4435 layerno++;
4436 continue;
4437 }
4438
4439 if (firstlayerno < 0) {
4440 firstlayerno = layerno;
4441 }
4442
4443 trajectory.addMaterialState(std::move(matstates[layerno]));
4444
4445 if ((layerpar !=
nullptr) && matEffects !=
pion && matEffects !=
muon) {
4446 const TrackingVolume *tvol =
m_navigator->volume(ctx,layerpar->position());
4447 const Layer *lay =
nullptr;
4448
4449 if (tvol != nullptr) {
4450 lay = (tvol->closestMaterialLayer(layerpar->position(),layerpar->momentum().normalized())).object;
4451 }
4452
4453 const MaterialProperties *matprop = lay != nullptr ? lay->fullUpdateMaterialProperties(*layerpar) : nullptr;
4454 meff->setMaterialProperties(matprop);
4455 }
4456
4457 layerno++;
4458 }
4459 }
4460 trajectory.addBasicState(std::move(oldstates[i]));
4461 }
4462
4463 ATH_MSG_DEBUG(
"Total X0: " << trajectory.totalX0() <<
" total eloss: " << trajectory.totalEnergyLoss());
4464
4465 if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) );
4466 }
#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)