24 declareInterface<ITrackSelectorTool>(
this);
34 return StatusCode::SUCCESS;
43 evt->beamPosSigmaX(),
evt->beamPosSigmaY(),
evt->beamPosSigmaZ(),
44 evt->beamTiltXZ(),
evt->beamTiltYZ(),
evt->beamPosSigmaXY());
47 ATH_MSG_WARNING(
" Cannot get beamSpot center from xAOD::EventInfo. Using (0,0,0)... " );
52 if (beamSpotHandle.isValid()) {
55 ATH_MSG_WARNING(
" Cannot get beamSpot center from BeamSpotData. Using (0,0,0)... " );
67 double abs_eta = (tanThetaOver2 == 0) ? 999.0 : std::fabs(
std::log(tanThetaOver2) );
80 const EventContext& ctx = Gaudi::Hive::currentContext();
83 const bool vertexSuppliedByUser{vx!=
nullptr};
86 if (not vertexSuppliedByUser) {
91 for (
const auto *
i : *
track.trackParameters()){
100 firstmeaspar=
track.perigeeParameters();
102 ATH_MSG_WARNING(
" First measurment on track is missing. Using perigee Parameters, but they are missing: 0 pointer! Track selection failed " );
104 if (not vertexSuppliedByUser)
delete myVertex;
115 track.info().particleHypothesis()).release();
116 perigee = extrapolatedParameters
117 ?
dynamic_cast<const Trk::Perigee*
>(extrapolatedParameters)
119 if (perigee==
nullptr || !perigee->covariance() ) {
121 if (extrapolatedParameters!=
nullptr) {
122 ATH_MSG_WARNING(
"The return object of the extrapolator was not a perigee even if a perigeeSurface was used!");
123 delete extrapolatedParameters;
124 if (not vertexSuppliedByUser)
delete myVertex;
127 if (not vertexSuppliedByUser)
delete myVertex;
133 double d0 = perigee->parameters()[
Trk::d0];
134 double z0 = perigee->parameters()[
Trk::z0];
137 double ratioTrk = 1.0;
139 bool isSilicon = (nclus > 0);
142 int ntrt = nTrtHits + nTrtOutliers;
147 ATH_MSG_FATAL(
"eProbabilityHT not available for Trk::Tracks only xAOD::TrackParticle objects" );
156 (ntrt>15 && ntrt<=25 && ratioTrk>=
m_trRatio2) ||
157 (ntrt>25 && ratioTrk>=
m_trRatio3)) pass =
true;
168 if ( ratioTrk >= trRatioTRT ) pass =
true;
175 double sd0sq =
err(0,0);
176 double sd0 = (sd0sq>0.)?std::sqrt(sd0sq):0.;
177 double sz0sq =
err(1,1);
178 double sz0 = (sz0sq>0.)?std::sqrt(sz0sq):0.;
186 ATH_MSG_FATAL(
"eProbabilityHT not available for Trk::Tracks only xAOD::TrackParticle objects" );
192 if (not vertexSuppliedByUser)
delete myVertex;
193 if (perigee!=
track.perigeeParameters())
delete perigee;
199 const EventContext& ctx = Gaudi::Hive::currentContext();
204 const bool vertexSuppliedByUser{vx!=
nullptr};
206 if (not vertexSuppliedByUser) {
212 for (
const auto *
i :
track.trackParameters()){
220 firstmeaspar=&(
track.definingParameters());
222 ATH_MSG_WARNING(
" Track Paraemters at first measurement not found. Perigee not found. Cannot do TrackSelection..." );
223 if (not vertexSuppliedByUser)
delete myVertex;
230 perigee = extrapolatedParameters
231 ?
dynamic_cast<const Trk::Perigee*
>(extrapolatedParameters)
233 if (perigee ==
nullptr || !perigee->covariance()) {
235 if (extrapolatedParameters!=
nullptr) {
236 ATH_MSG_WARNING(
"The return object of the extrapolator was not a perigee even if a perigeeSurface was used!" );
237 delete extrapolatedParameters;
238 if (not vertexSuppliedByUser)
delete myVertex;
241 if (not vertexSuppliedByUser)
delete myVertex;
247 double d0 = perigee->parameters()[
Trk::d0];
248 double z0 = perigee->parameters()[
Trk::z0];
251 double ratioTrk = 1.0;
253 bool isSilicon = (nclus > 0);
256 int ntrt = nTrtHits + nTrtOutliers;
262 ATH_MSG_FATAL(
"eProbabilityHT not available for Trk::TrackParticleBase only xAOD::TrackParticle objects" );
271 (ntrt>15 && ntrt<=25 && ratioTrk>=
m_trRatio2) ||
272 (ntrt>25 && ratioTrk>=
m_trRatio3)) pass =
true;
283 if ( ratioTrk >= trRatioTRT ) pass =
true;
290 double sd0sq =
err(0,0);
291 double sd0 = (sd0sq>0.)?std::sqrt(sd0sq):0.;
292 double sz0sq =
err(1,1);
293 double sz0 = (sz0sq>0.)?std::sqrt(sz0sq):0.;
302 ATH_MSG_FATAL(
"eProbabilityHT not available for Trk::TrackParticleBase only xAOD::TrackParticle objects" );
307 if (not vertexSuppliedByUser)
delete myVertex;
308 if (perigee!=&(
track.definingParameters()))
delete perigee;
315 const EventContext& ctx,
319 return vertex->position();
330 if (beamSpotHandle.isValid()) {
331 return beamSpotHandle->beamVtx().position();
340 const EventContext& ctx = Gaudi::Hive::currentContext();
349 if (extrapolatedParameters ==
nullptr) {
350 ATH_MSG_WARNING(
"Extrapolation to the vertex failed: " << perigeeSurface
357 double d0 = extrapolatedParameters->parameters()[
Trk::d0];
358 double z0 = extrapolatedParameters->parameters()[
Trk::z0];
360 double ratioTrk = 1.0;
362 bool isSilicon = (nclus > 0);
365 int ntrt = nTrtHits + nTrtOutliers;
381 (ntrt>15 && ntrt<=25 && ratioTrk>=
m_trRatio2) ||
382 (ntrt>25 && ratioTrk>=
m_trRatio3)) pass =
true;
393 if ( ratioTrk >= trRatioTRT ) pass =
true;
400 double sd0sq =
err(0,0);
401 double sd0 = (sd0sq>0.)?std::sqrt(sd0sq):0.;
402 double sz0sq =
err(1,1);
403 double sz0 = (sz0sq>0.)?std::sqrt(sz0sq):0.;
417 delete extrapolatedParameters;