3650 {
3651 if (refpar2 == nullptr) {
3652 return;
3653 }
3654 const MeasurementBase *firstmuonhit = nullptr;
3655 const MeasurementBase *lastmuonhit = nullptr;
3656 const MeasurementBase *firstidhit =
3657 nullptr;
3658 const MeasurementBase *lastidhit = nullptr;
3659 const MeasurementBase *firsthit = nullptr;
3660 const MeasurementBase *lasthit = nullptr;
3661 std::vector<std::unique_ptr<GXFTrackState>> &
states = trajectory.trackStates();
3662 std::vector<std::unique_ptr<GXFTrackState>> matstates;
3663 std::unique_ptr< const std::vector < const TrackStateOnSurface *>,
3664 void (*)(const std::vector<const TrackStateOnSurface *> *) >
3666 bool matvec_used=false;
3667 std::unique_ptr<TrackParameters> startmatpar1;
3668 std::unique_ptr<TrackParameters> startmatpar2;
3678
3679 int npseudomuon1 = 0;
3680 int npseudomuon2 = 0;
3681
3682 for (auto & state : states) {
3685 GXFMaterialEffects *meff = state->materialEffects();
3686
3688 if (firstidhit == nullptr) {
3689 npseudomuon1++;
3690 } else {
3691 npseudomuon2++;
3692 }
3693 continue;
3694 }
3695
3697 if (firsthit == nullptr) {
3698 firsthit = state->measurement();
3699 if (
cache.m_acceleration) {
3700 if (tp == nullptr) {
3702 ctx,
3703 *refpar2,
3704 state->associatedSurface(),
3706 false,
3707 matEffects
3708 ).release();
3709
3710 if (tp == nullptr) {
3711 return;
3712 }
3713
3714 state->setTrackParameters(std::unique_ptr<const TrackParameters>(tp));
3715 }
3716
3717 refpar2 = tp;
3718 }
3719 }
3720 lasthit = state->measurement();
3721 if (
3725 ) {
3726 if (firstidhit == nullptr) {
3727 firstidhit = state->measurement();
3728 }
3729
3730 if ((firstidpar == nullptr) && (tp != nullptr)) {
3731 firstidpar = tp;
3732 }
3733
3734 lastidhit = state->measurement();
3735 if (tp != nullptr) {
3736 lastidpar = tp;
3737 }
3738
3740 if (firstsiliconpar == nullptr) {
3741 firstsiliconpar = tp;
3742 }
3743 lastsiliconpar = tp;
3744 }
3745 }
3746
3747 if (
3754 ) {
3755 if (firstmuonhit == nullptr) {
3756 firstmuonhit = state->measurement();
3757 if (tp != nullptr) {
3758 firstmuonpar = tp;
3759 }
3760 }
3761 lastmuonhit = state->measurement();
3762 if (tp != nullptr) {
3763 lastmuonpar = tp;
3764 }
3765 }
3766 }
3768 if (meff->deltaE() == 0) {
3769 if (firstcalopar == nullptr) {
3770 firstcalopar = state->trackParameters();
3771 }
3772 lastcalopar = state->trackParameters();
3773 }
3774 if (firstmatpar == nullptr) {
3775 firstmatpar = state->trackParameters();
3776 }
3777 }
3778 }
3779
3780 std::unique_ptr<TrackParameters> refpar;
3781 AmgVector(5) newpars = refpar2->parameters();
3782
3783 if (trajectory.m_straightline &&
m_p != 0) {
3785 }
3786
3787 refpar = refpar2->associatedSurface().createUniqueTrackParameters(
3788 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3789 );
3790
3791 if (firstmatpar != nullptr) {
3794 }
3795
3796 if ((startmatpar1 == nullptr) || ((firstidhit != nullptr) && (firstmuonhit != nullptr))) {
3799
3800 const double mass = trajectory.mass();
3801 if (mass > 200 *
MeV) {
3802 const AmgVector(5) & newpars = startmatpar2->parameters();
3803 const double oldp = std::abs(1 / newpars[
Trk::qOverP]);
3805
3806 startmatpar2 = startmatpar2->associatedSurface().createUniqueTrackParameters(
3807 newpars[0], newpars[1], newpars[2], newpars[3],
3808 sign / std::sqrt(oldp * oldp + 2 * 100 *
MeV * std::sqrt(oldp * oldp + mass * mass) + 100 *
MeV * 100 *
MeV),
3809 std::nullopt
3810 );
3811 }
3812 }
else if (trajectory.m_straightline &&
m_p != 0) {
3813 AmgVector(5) newpars = startmatpar1->parameters();
3815
3816 startmatpar1 = startmatpar1->associatedSurface().createUniqueTrackParameters(
3817 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3818 );
3819
3820 newpars = startmatpar2->parameters();
3822
3823 startmatpar2 = startmatpar2->associatedSurface().createUniqueTrackParameters(
3824 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
3825 );
3826 }
3827
3828 if ((firstidhit !=
nullptr) && trajectory.numberOfSiliconHits() > 0 &&
cache.m_idmat) {
3829
3830 const DistanceSolution distsol = firstidhit->associatedSurface().straightLineDistanceEstimate(
3831 refpar->position(),
3832 refpar->momentum().unit()
3833 );
3834
3836
3837 if (distance < 0 && distsol.numberOfSolutions() > 0 && !
cache.m_acceleration) {
3838 ATH_MSG_DEBUG("Obtaining upstream layers from Extrapolator");
3839
3840 const Surface *destsurf = &firstidhit->associatedSurface();
3841 std::unique_ptr<const TrackParameters> tmppar;
3842
3843 if (firstmuonhit != nullptr) {
3844 const bool caloEntranceIsValid = ensureValidEntranceCalo(ctx, cache);
3845 if (caloEntranceIsValid) {
3846 tmppar = m_extrapolator->extrapolateToVolume(ctx,
3847 *startmatpar1,
3848 *cache.m_caloEntrance,
3849 oppositeMomentum,
3850 Trk::nonInteracting);
3851
3852 if (tmppar != nullptr) {
3853 destsurf = &tmppar->associatedSurface();
3854 }
3855 }
3856 }
3857
3858 if (matvec_used)
cache.m_matTempStore.push_back( std::move(matvec) );
3860 *startmatpar1,
3861 *destsurf,
3863 false, matEffects) );
3864 matvec_used=false;
3865
3866 if (matvec && !matvec->empty()) {
3867 for (int i = (int)matvec->size() - 1; i > -1; i--) {
3868 const MaterialEffectsBase *meb = (*matvec)[i]->materialEffectsOnTrack();
3869 if (meb) {
3870 if (meb->derivedType() == MaterialEffectsBase::MATERIAL_EFFECTS_ON_TRACK) {
3871 const MaterialEffectsOnTrack *meot = static_cast < const MaterialEffectsOnTrack * >(meb);
3872 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
3873 const TrackParameters * newpars = (*matvec)[i]->trackParameters() != nullptr ? (*matvec)[i]->trackParameters()->clone() : nullptr;
3874 meff->setSigmaDeltaE(0);
3875 matstates.push_back(std::make_unique<GXFTrackState>(
3876 std::move(meff),
3877 std::unique_ptr<const TrackParameters>(newpars)
3878 ));
3879 matvec_used=true;
3880 }
3881 }
3882 }
3883 }
3884 }
3885 }
3886
3887 if ((lastidhit !=
nullptr) && trajectory.numberOfSiliconHits() > 0 &&
cache.m_idmat) {
3888 const DistanceSolution distsol = lastidhit->associatedSurface().straightLineDistanceEstimate(
3889 refpar->position(),
3890 refpar->momentum().unit()
3891 );
3892
3894
3895 if (distance > 0 && distsol.numberOfSolutions() > 0) {
3896 ATH_MSG_DEBUG(
"Obtaining downstream ID layers from Extrapolator");
3897 const Surface *destsurf = &lastidhit->associatedSurface();
3898 std::unique_ptr<const TrackParameters> tmppar;
3899 std::unique_ptr<Surface> calosurf;
3900 if (firstmuonhit != nullptr) {
3902 if (caloEntranceIsValid) {
3904 *startmatpar2,
3905 *
cache.m_caloEntrance,
3908 }
3909
3910 if (tmppar != nullptr) {
3911 const CylinderSurface *cylcalosurf = nullptr;
3912
3914 cylcalosurf = static_cast<const CylinderSurface *>(&tmppar->associatedSurface());
3915
3916 const DiscSurface *disccalosurf = nullptr;
3917
3919 disccalosurf = static_cast<const DiscSurface *>(&tmppar->associatedSurface());
3920
3921 if (cylcalosurf != nullptr) {
3923 const CylinderBounds & cylbounds = cylcalosurf->bounds();
3924 const double radius = cylbounds.r();
3925 const double hlength = cylbounds.halflengthZ();
3926 calosurf = std::make_unique<CylinderSurface>(trans, radius - 1, hlength);
3927 } else if (disccalosurf != nullptr) {
3928 const double newz = (
3929 disccalosurf->center().
z() > 0 ?
3930 disccalosurf->center().z() - 1 :
3931 disccalosurf->center().z() + 1
3932 );
3933
3935 disccalosurf->center().x(),
3936 disccalosurf->center().y(),
3937 newz
3938 );
3939
3941 trans.translation() << newpos;
3942
3943 const DiscBounds *discbounds = static_cast<const DiscBounds *>(&disccalosurf->bounds());
3944 const double rmin = discbounds->rMin();
3945 const double rmax = discbounds->rMax();
3946 calosurf = std::make_unique<DiscSurface>(trans, rmin, rmax);
3947 }
3948 destsurf = calosurf.release();
3949 }
3950 }
3951
3952 if (matvec_used)
cache.m_matTempStore.push_back( std::move(matvec) );
3954 ctx, *startmatpar2, *destsurf,
alongMomentum,
false, matEffects));
3955 matvec_used = false;
3956
3957 if (matvec && !matvec->empty()) {
3958 for (const auto & i : *matvec) {
3959 const Trk::MaterialEffectsBase * meb =
i->materialEffectsOnTrack();
3960
3961 if (meb) {
3963 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
3964 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
3965 if (
cache.m_fiteloss && (meot->energyLoss() !=
nullptr)) {
3966 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
3967 }
3968
3970 meff->setDeltaE(-5);
3971
3972 if (trajectory.numberOfTRTHits() == 0) {
3973 meff->setScatteringSigmas(0, 0);
3974 }
3975
3976 meff->setSigmaDeltaE(50);
3977 }
3978
3979 const TrackParameters * newparams =
i->trackParameters() !=
nullptr ?
i->trackParameters()->clone() :
nullptr;
3980
3981 matstates.push_back(std::make_unique<GXFTrackState>(
3982 std::move(meff),
3983 std::unique_ptr<const TrackParameters>(newparams)
3984 ));
3985 matvec_used=true;
3986 }
3987 }
3988 }
3989 } else {
3991 }
3992 }
3993 }
3994
3995 if (
cache.m_calomat && (firstmuonhit !=
nullptr) && (firstidhit !=
nullptr)) {
3997
3998 std::vector<MaterialEffectsOnTrack> calomeots =
m_calotool->extrapolationSurfacesAndEffects(
4000 *prop,
4001 *lastidpar,
4002 firstmuonhit->associatedSurface(),
4005 );
4006
4007 if (calomeots.empty()) {
4009 return;
4010 }
4011
4012 std::unique_ptr<const TrackParameters> prevtrackpars =
unique_clone(lastidpar);
4013 if (lasthit == lastmuonhit) {
4014 for (
int i = 0;
i < (
int) calomeots.size();
i++) {
4016
4017 std::unique_ptr<const TrackParameters> layerpar(
m_propagator->propagateParameters(
4018 ctx,
4019 *prevtrackpars,
4020 calomeots[i].associatedSurface(),
4021 propdir,
4022 false,
4023 trajectory.m_fieldprop,
4025 ));
4026
4027 if (layerpar == nullptr) {
4029 return;
4030 }
4031
4032 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(calomeots[i]);
4033
4034 if (i == 2) {
4035 lastcalopar = layerpar.get();
4036 }
4037
4038 if (i == 1) {
4039 const double qoverp = layerpar->parameters()[
Trk::qOverP];
4040 double qoverpbrem = 0;
4041
4042 if (
4043 npseudomuon2 < 2 &&
4044 (firstmuonpar != nullptr) &&
4045 std::abs(firstmuonpar->parameters()[
Trk::qOverP]) > 1.e-9
4046 ) {
4047 qoverpbrem = firstmuonpar->parameters()[
Trk::qOverP];
4048 } else {
4049 const double sign = (qoverp > 0) ? 1 : -1;
4050 qoverpbrem =
sign / (1 / std::abs(qoverp) - std::abs(calomeots[i].energyLoss()->deltaE()));
4051 }
4052
4053 const AmgVector(5) & newpar = layerpar->parameters();
4054
4055 layerpar = layerpar->associatedSurface().createUniqueTrackParameters(
4056 newpar[0], newpar[1], newpar[2], newpar[3], qoverpbrem, std::nullopt
4057 );
4058 meff->setdelta_p(1000 * (qoverpbrem - qoverp));
4059 }
4060
4061 matstates.push_back(std::make_unique<GXFTrackState>(
4062 std::move(meff),
4063 std::unique_ptr<const TrackParameters>(layerpar != nullptr ? layerpar->clone() : nullptr)
4064 ));
4065 prevtrackpars = std::move(layerpar);
4066 }
4067 }
4068
4069 if (
4070 firsthit == firstmuonhit &&
4071 (!
cache.m_getmaterialfromtrack || lasthit == lastidhit)
4072 ) {
4074 for (
int i = 0;
i < (
int) calomeots.size();
i++) {
4076 std::unique_ptr<const TrackParameters> layerpar(
m_propagator->propagateParameters(
4077 ctx,
4078 *prevtrackpars,
4079 calomeots[i].associatedSurface(),
4080 propdir,
4081 false,
4082 trajectory.m_fieldprop,
4084 ));
4085
4086 if (layerpar == nullptr) {
4088 return;
4089 }
4090
4091 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(calomeots[i]);
4092
4093 if (i == 2) {
4095 }
4096
4098
4099 if (i == 1) {
4100 const double qoverpbrem = layerpar->parameters()[
Trk::qOverP];
4101 double qoverp = 0;
4102
4103 if (
4104 npseudomuon1 < 2 &&
4105 (lastmuonpar != nullptr) &&
4106 std::abs(lastmuonpar->parameters()[
Trk::qOverP]) > 1.e-9
4107 ) {
4109 } else {
4110 const double sign = (qoverpbrem > 0) ? 1 : -1;
4111 qoverp =
sign / (1 / std::abs(qoverpbrem) + std::abs(calomeots[i].energyLoss()->deltaE()));
4112 }
4113
4114 meff->setdelta_p(1000 * (qoverpbrem - qoverp));
4115 const AmgVector(5) & newpar = layerpar->parameters();
4116
4117 prevtrackpars = layerpar->associatedSurface().createUniqueTrackParameters(
4118 newpar[0], newpar[1], newpar[2], newpar[3], qoverp, std::nullopt
4119 );
4120 }
4121
4122 matstates.insert(matstates.begin(), std::make_unique<GXFTrackState>(std::move(meff), std::move(layerpar)));
4123 }
4124 }
4125 }
4126
4127 if (lasthit == lastmuonhit &&
cache.m_extmat) {
4128 std::unique_ptr<const Trk::TrackParameters> muonpar1;
4129
4130 if (lastcalopar != nullptr) {
4132 if (msEntranceIsValid) {
4133 if (
cache.m_msEntrance->inside(lastcalopar->position())) {
4135 *lastcalopar,
4136 *
cache.m_msEntrance,
4139
4140 if (muonpar1 != nullptr) {
4146 rot.col(0) = curvU;
4147 rot.col(1) = curvV;
4148 rot.col(2) = trackdir;
4150 trans.linear().matrix() << rot;
4151 trans.translation() << muonpar1->position() - .1 * trackdir;
4152 PlaneSurface const curvlinsurf(trans);
4153
4154 std::unique_ptr<const TrackParameters> curvlinpar(
m_extrapolator->extrapolateDirectly(
4155 ctx,
4156 *muonpar1,
4157 curvlinsurf,
4160 ));
4161
4162 if (curvlinpar != nullptr) {
4163 muonpar1 = std::move(curvlinpar);
4164 }
4165 }
4166 } else {
4167 muonpar1 = std::unique_ptr<TrackParameters>(lastcalopar->clone());
4168 }
4169 }
4170 } else {
4171 muonpar1 = std::unique_ptr<TrackParameters>(refpar->clone());
4172 }
4173
4174 DistanceSolution distsol;
4175
4176 if (muonpar1 != nullptr) {
4177 distsol = lastmuonhit->associatedSurface().straightLineDistanceEstimate(
4178 muonpar1->position(),
4179 muonpar1->momentum().unit()
4180 );
4181 }
4182
4184
4185 if ((distance > 0) and(distsol.numberOfSolutions() >
4186 0) and (firstmuonhit != nullptr)) {
4187 distsol = firstmuonhit->associatedSurface().straightLineDistanceEstimate(
4188 muonpar1->position(),
4189 muonpar1->momentum().unit()
4190 );
4191
4193
4194 if (distsol.numberOfSolutions() == 1) {
4196 } else if (distsol.numberOfSolutions() == 2) {
4198 std::abs(distsol.first()) < std::abs(distsol.second()) ?
4199 distsol.first() :
4200 distsol.second()
4201 );
4202 }
4203
4204 if (distance < 0 && distsol.numberOfSolutions() > 0 && (firstidhit == nullptr)) {
4205 if (firstmuonpar != nullptr) {
4206 AmgVector(5) newpars = firstmuonpar->parameters();
4207
4208 if (trajectory.m_straightline &&
m_p != 0) {
4210 }
4211
4212 muonpar1 = firstmuonpar->associatedSurface().createUniqueTrackParameters(
4213 newpars[0], newpars[1], newpars[2], newpars[3], newpars[4], std::nullopt
4214 );
4215 } else {
4216 std::unique_ptr<const TrackParameters> tmppar(
m_propagator->propagateParameters(
4217 ctx,
4218 *muonpar1,
4219 firstmuonhit->associatedSurface(),
4221 false,
4222 trajectory.m_fieldprop,
4224 ));
4225
4226 if (tmppar != nullptr) {
4227 muonpar1 = std::move(tmppar);
4228 }
4229 }
4230 }
4231
4233 ATH_MSG_DEBUG(
"Obtaining downstream layers from Extrapolator");
4234 if (matvec_used)
cache.m_matTempStore.push_back( std::move(matvec) );
4236 *prevtp,
4237 states.back()->associatedSurface(),
4239 false,
4241 matvec_used = false;
4242
4245 return;
4246 }
4247
4248 if (matvec && !matvec->empty()) {
4249 for (
int j = 0;
j < (
int) matvec->size();
j++) {
4250 const MaterialEffectsBase *meb = (*matvec)[
j]->materialEffectsOnTrack();
4251
4252 if (meb) {
4254 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
4255 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
4256
4257 if (
4258 !trajectory.m_straightline &&
4259 (meot->energyLoss() != nullptr) &&
4260 std::abs(meff->deltaE()) > 25 &&
4261 std::abs((*matvec)[j]->trackParameters()->position().z()) < 13000
4262 ) {
4263 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
4264 }
4265
4266 const TrackParameters * newparams = (*matvec)[
j]->trackParameters() !=
nullptr ? (*matvec)[
j]->trackParameters()->
clone() :
nullptr;
4267
4268 matstates.push_back(std::make_unique<GXFTrackState>(
4269 std::move(meff),
4270 std::unique_ptr<const TrackParameters>(newparams)
4271 ));
4272 matvec_used=true;
4273 }
4274 }
4275 }
4276 }
4277 }
4278 }
4279
4280 if (firsthit == firstmuonhit &&
cache.m_extmat && (firstcalopar !=
nullptr)) {
4281 std::unique_ptr<const Trk::TrackParameters> muonpar1;
4282
4284 if (msEntranceIsValid) {
4285 if (
cache.m_msEntrance->inside(firstcalopar->position())) {
4287 *firstcalopar,
4288 *
cache.m_msEntrance,
4291
4292 if (muonpar1 != nullptr) {
4298 rot.col(0) = curvU;
4299 rot.col(1) = curvV;
4300 rot.col(2) = trackdir;
4302 trans.linear().matrix() << rot;
4303 trans.translation() << muonpar1->position() - .1 * trackdir;
4304 const PlaneSurface curvlinsurf(trans);
4305
4306 std::unique_ptr<const TrackParameters> curvlinpar(
m_extrapolator->extrapolateDirectly(
4307 ctx,
4308 *muonpar1,
4309 curvlinsurf,
4312 ));
4313
4314 if (curvlinpar != nullptr) {
4315 muonpar1 = std::move(curvlinpar);
4316 }
4317 }
4318 } else {
4319 muonpar1 = std::unique_ptr<const TrackParameters>(firstcalopar->clone());
4320 }
4321 }
4322
4323 DistanceSolution distsol;
4324
4325 if (muonpar1 != nullptr) {
4326 distsol = firstmuonhit->associatedSurface().straightLineDistanceEstimate(
4327 muonpar1->position(),
4328 muonpar1->momentum().unit()
4329 );
4330 }
4331
4333
4334 if (distance < 0 && distsol.numberOfSolutions() > 0) {
4336 ATH_MSG_DEBUG(
"Collecting upstream muon material from extrapolator");
4337 if (matvec_used)
cache.m_matTempStore.push_back( std::move(matvec) );
4339 *prevtp,
4340 states[0]->associatedSurface(),
4342 false,
4344 matvec_used = false;
4345
4346 if (matvec && !matvec->empty()) {
4347 ATH_MSG_DEBUG(
"Retrieved " << matvec->size() <<
" material states");
4348
4349 for (
int j = 0;
j < (
int) matvec->size();
j++) {
4350 const MaterialEffectsBase *meb = (*matvec)[
j]->materialEffectsOnTrack();
4351
4352 if (meb != nullptr) {
4353
4354
4356 const MaterialEffectsOnTrack *meot = static_cast<const MaterialEffectsOnTrack *>(meb);
4357 std::unique_ptr<GXFMaterialEffects> meff = std::make_unique<GXFMaterialEffects>(*meot);
4358
4359 if (
4360 !trajectory.m_straightline &&
4361 (meot->energyLoss() != nullptr) &&
4362 std::abs(meff->deltaE()) > 25 &&
4363 std::abs((*matvec)[j]->trackParameters()->position().z()) < 13000
4364 ) {
4365 meff->setSigmaDeltaE(meot->energyLoss()->sigmaDeltaE());
4366 }
4367
4369 (*matvec)[
j]->trackParameters() !=
nullptr
4370 ? (*matvec)[
j]->trackParameters()->
clone()
4371 : nullptr;
4372
4373 matstates.insert(matstates.begin(), std::make_unique<GXFTrackState>(
4374 std::move(meff),
4375 std::unique_ptr<const TrackParameters>(tmpparams)
4376 ));
4377 matvec_used=true;
4378 }
4379 }
4380 }
4381 }
4382 }
4383 }
4384
4386
4387
4388 std::vector<std::unique_ptr<GXFTrackState>> & newstates =
states;
4389 std::vector<std::unique_ptr<GXFTrackState>> oldstates = std::move(newstates);
4390
4391 newstates.clear();
4392 newstates.reserve(oldstates.size() + matstates.size());
4393
4394 int layerno = 0;
4395 int firstlayerno = -1;
4396
4397 if (
cache.m_acceleration) {
4398 trajectory.addBasicState(std::move(oldstates[0]));
4399 }
4400
4401 const double cosphi = std::cos(refpar->parameters()[
Trk::phi0]);
4402 const double sinphi = std::sin(refpar->parameters()[
Trk::phi0]);
4403
4404 for (
int i =
cache.m_acceleration ? 1 : 0; i < (
int) oldstates.size(); i++) {
4405 bool addlayer = true;
4406
4407 while (addlayer && layerno < (int) matstates.size()) {
4408 addlayer = false;
4409 const TrackParameters *layerpar = matstates[layerno]->trackParameters();
4410
4411 const DistanceSolution distsol = oldstates[
i]->associatedSurface().straightLineDistanceEstimate(
4412 layerpar->position(),
4413 layerpar->momentum().unit()
4414 );
4415
4417
4418 if (distance > 0 && distsol.numberOfSolutions() > 0) {
4419 addlayer = true;
4420 }
4421
4423 const double cylinderradius = layerpar->associatedSurface().bounds().r();
4424 const double trackimpact = std::abs(-refpar->position().x() * sinphi + refpar->position().y() * cosphi);
4425
4426 if (trackimpact > cylinderradius - 5 * mm) {
4427 layerno++;
4428 continue;
4429 }
4430 }
4431
4432 if (i == (int) oldstates.size() - 1) {
4433 addlayer = true;
4434 }
4435
4436 if (addlayer) {
4437 GXFMaterialEffects *meff = matstates[layerno]->materialEffects();
4438
4439 if (meff->sigmaDeltaPhi() > .4 || (meff->sigmaDeltaPhi() == 0 && meff->sigmaDeltaE() <= 0)) {
4440 if (meff->sigmaDeltaPhi() > .4) {
4441 ATH_MSG_DEBUG(
"Material state with excessive scattering, skipping it");
4442 }
4443
4444 if (meff->sigmaDeltaPhi() == 0) {
4446 }
4447
4448 layerno++;
4449 continue;
4450 }
4451
4452 if (firstlayerno < 0) {
4453 firstlayerno = layerno;
4454 }
4455
4456 trajectory.addMaterialState(std::move(matstates[layerno]));
4457
4458 if ((layerpar !=
nullptr) && matEffects !=
pion && matEffects !=
muon) {
4459 const TrackingVolume *tvol =
m_navigator->volume(ctx,layerpar->position());
4460 const Layer *lay =
nullptr;
4461
4462 if (tvol != nullptr) {
4463 lay = (tvol->closestMaterialLayer(layerpar->position(),layerpar->momentum().normalized())).object;
4464 }
4465
4466 const MaterialProperties *matprop = lay != nullptr ? lay->fullUpdateMaterialProperties(*layerpar) : nullptr;
4467 meff->setMaterialProperties(matprop);
4468 }
4469
4470 layerno++;
4471 }
4472 }
4473 trajectory.addBasicState(std::move(oldstates[i]));
4474 }
4475
4476 ATH_MSG_DEBUG(
"Total X0: " << trajectory.totalX0() <<
" total eloss: " << trajectory.totalEnergyLoss());
4477
4478 if (matvec_used)
cache.m_matTempStore.push_back( std::move(matvec) );
4479 }
#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)
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
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.
prop(alg, name, default=_UNSET)
static void objVectorDeleter(const std::vector< const T * > *ptr)