diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx index b58f5b522ea189b878066300a1ce0ef049f35702..9c991115063c652deea10e9c80d370d37b0e1e9d 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx @@ -167,7 +167,8 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con // Check the parameters are reasonable: if (tan(theta/2.0) < 0.0001) { - ATH_MSG_DEBUG (" Track has negative theta or is VERY close to beampipe! (tan(theta/2) < 0.0001). Returning default Pid values."); + ATH_MSG_DEBUG(" Track has negative theta or is VERY close to beampipe! " + "(tan(theta/2) < 0.0001). Returning default Pid values."); return PIDvalues; } @@ -189,12 +190,6 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con ATH_MSG_DEBUG ("check Got track: pT: " << pT << " eta: " << eta << " phi: " << phi); ATH_MSG_DEBUG ("check---------------------------------------------------------------------------------------"); - // Jared - Development Output... - /* - std::cout << "check---------------------------------------------------------------------------------------" << std::endl; - std::cout << "check Got track: pT: " << pT << " eta: " << eta << " phi: " << phi << std::endl; - std::cout << "check---------------------------------------------------------------------------------------" << std::endl; - */ // For calculation of HT probability: double pHTel_prod = 1.0; double pHTpi_prod = 1.0; @@ -225,7 +220,15 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con if (!measurement) continue; // Get drift circle (ensures that hit is from TRT): - const InDet::TRT_DriftCircleOnTrack *driftcircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>(measurement); + const InDet::TRT_DriftCircleOnTrack* driftcircle = nullptr; + if (measurement->type(Trk::MeasurementBaseType::RIO_OnTrack)) { + const Trk::RIO_OnTrack* tmpRio = + static_cast<const Trk::RIO_OnTrack*>(measurement); + if (tmpRio->rioType(Trk::RIO_OnTrackType::TRT_DriftCircle)) { + driftcircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(tmpRio); + } + } + if (!driftcircle) continue; // From now (May 2015) onwards, we ONLY USE MIDDLE HT BIT: @@ -324,31 +327,49 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con } } - ATH_MSG_DEBUG ("check Hit: " << nTRThits << " TrtPart: " << TrtPart << " GasType: " << GasType << " SL: " << StrawLayer - << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire << " Occ_Local: " << occ_local << " HTMB: " << isHTMB ); - - - // Jared - Development Output... - /* - std::cout << "check Hit: " << nTRThits << " TrtPart: " << TrtPart << " GasType: " << GasType << " SL: " << StrawLayer - << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire << " Occ_Local: " << occ_local - << " HTMB: " << isHTMB << std::endl; - */ + ATH_MSG_DEBUG("check Hit: " + << nTRThits << " TrtPart: " << TrtPart + << " GasType: " << GasType << " SL: " << StrawLayer + << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire + << " Occ_Local: " << occ_local << " HTMB: " << isHTMB); // Then call pHT functions with these values: // ------------------------------------------ - - double pHTel = HTcalc->getProbHT( pTrk, Trk::electron, TrtPart, GasType, StrawLayer, ZRpos[TrtPart], rTrkWire, occ_local, hasTrackParameters); - double pHTpi = HTcalc->getProbHT( pTrk, Trk::pion, TrtPart, GasType, StrawLayer, ZRpos[TrtPart], rTrkWire, occ_local, hasTrackParameters); + double pHTel = HTcalc->getProbHT(pTrk, + Trk::electron, + TrtPart, + GasType, + StrawLayer, + ZRpos[TrtPart], + rTrkWire, + occ_local, + hasTrackParameters); + double pHTpi = HTcalc->getProbHT(pTrk, + Trk::pion, + TrtPart, + GasType, + StrawLayer, + ZRpos[TrtPart], + rTrkWire, + occ_local, + hasTrackParameters); if (pHTel > 0.999 || pHTpi > 0.999 || pHTel < 0.001 || pHTpi < 0.001) { - ATH_MSG_DEBUG(" pHT outside allowed range! pHTel = " << pHTel << " pHTpi = " << pHTpi << " TrtPart: " << TrtPart << " SL: " << StrawLayer << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire << " Occ_Local: " << occ_local); + ATH_MSG_DEBUG(" pHT outside allowed range! pHTel = " + << pHTel << " pHTpi = " << pHTpi + << " TrtPart: " << TrtPart << " SL: " << StrawLayer + << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire + << " Occ_Local: " << occ_local); continue; } if (pHTel > 0.80 || pHTpi > 0.50 || pHTel < 0.025 || pHTpi < 0.010) { - ATH_MSG_DEBUG(" pHT has abnormal value! pHTel = " << pHTel << " pHTpi = " << pHTpi << " TrtPart: " << TrtPart << " SL: " << StrawLayer << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire << " Occ_Local: " << occ_local); + ATH_MSG_DEBUG(" pHT has abnormal value! pHTel = " + << pHTel << " pHTpi = " << pHTpi + << " TrtPart: " << TrtPart << " SL: " << StrawLayer + << " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire + << " Occ_Local: " << occ_local); continue; } @@ -371,19 +392,14 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con prob_El_HT = pHTel_prod / (pHTel_prod + pHTpi_prod); ATH_MSG_DEBUG ("check---------------------------------------------------------------------------------------"); - ATH_MSG_DEBUG ("check nTRThits: " << nTRThits << " : " << nTRThitsHTMB << " pHTel_prod: " << pHTel_prod << " pHTpi_prod: " << pHTpi_prod << " probEl: " << prob_El_HT); + ATH_MSG_DEBUG("check nTRThits: " << nTRThits << " : " << nTRThitsHTMB + << " pHTel_prod: " << pHTel_prod + << " pHTpi_prod: " << pHTpi_prod + << " probEl: " << prob_El_HT); ATH_MSG_DEBUG ("check---------------------------------------------------------------------------------------"); ATH_MSG_DEBUG (""); ATH_MSG_DEBUG (""); - // Jared - Development Output... - /* - std::cout << "check---------------------------------------------------------------------------------------" << std::endl; - std::cout << "check nTRThits: " << nTRThits << " : " << nTRThitsHTMB << " pHTel_prod: " << pHTel_prod << " pHTpi_prod: " << pHTpi_prod << " probEl: " << prob_El_HT << std::endl; - std::cout << "check---------------------------------------------------------------------------------------" << std::endl; - std::cout << std::endl << std::endl; - */ - // Jared - ToT Implementation dEdx = m_TRTdEdxTool->dEdx( &track, true, false, true); // Divide by L, exclude HT hits double usedHits = m_TRTdEdxTool->usedHits( &track, true, false); @@ -456,7 +472,14 @@ bool InDet::TRT_ElectronPidToolRun2::CheckGeometry(int BEC, int Layer, int Straw |*%%% a geometry check is performed every time here %%%%%%%%%%%%%%%%%%%%%%%*| \*****************************************************************************/ -double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk::ParticleHypothesis /*hypothesis*/, const int HitPart, const int Layer, const int StrawLayer) const { +double +InDet::TRT_ElectronPidToolRun2::probHT( + const double /*pTrk*/, + const Trk::ParticleHypothesis /*hypothesis*/, + const int HitPart, + const int Layer, + const int StrawLayer) const +{ if (not CheckGeometry(HitPart,Layer,StrawLayer) ){ ATH_MSG_ERROR("TRT geometry fail. Returning default value."); return 0.5; @@ -465,9 +488,26 @@ double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk: return 1.0; } - -double InDet::TRT_ElectronPidToolRun2::probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) const { - SG::ReadCondHandle<HTcalculator> readHandle{m_HTReadKey}; - bool hasTrackPar=true; - return (*readHandle)->getProbHT( pTrk, hypothesis, TrtPart, GasType, StrawLayer, ZR, rTrkWire, Occupancy, hasTrackPar ); +double +InDet::TRT_ElectronPidToolRun2::probHTRun2(float pTrk, + Trk::ParticleHypothesis hypothesis, + int TrtPart, + int GasType, + int StrawLayer, + float ZR, + float rTrkWire, + float Occupancy) const +{ + SG::ReadCondHandle<HTcalculator> readHandle{ m_HTReadKey }; + bool hasTrackPar = true; + return (*readHandle) + ->getProbHT(pTrk, + hypothesis, + TrtPart, + GasType, + StrawLayer, + ZR, + rTrkWire, + Occupancy, + hasTrackPar); }