Skip to content
Snippets Groups Projects

Remove dynamic_cast in TRT_ElectronPidToolRun2

1 file
+ 78
38
Compare changes
  • Side-by-side
  • Inline
@@ -167,7 +167,8 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
@@ -167,7 +167,8 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
// Check the parameters are reasonable:
// Check the parameters are reasonable:
if (tan(theta/2.0) < 0.0001) {
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;
return PIDvalues;
}
}
@@ -189,12 +190,6 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
@@ -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 Got track: pT: " << pT << " eta: " << eta << " phi: " << phi);
ATH_MSG_DEBUG ("check---------------------------------------------------------------------------------------");
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:
// For calculation of HT probability:
double pHTel_prod = 1.0;
double pHTel_prod = 1.0;
double pHTpi_prod = 1.0;
double pHTpi_prod = 1.0;
@@ -225,7 +220,15 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
@@ -225,7 +220,15 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
if (!measurement) continue;
if (!measurement) continue;
// Get drift circle (ensures that hit is from TRT):
// 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;
if (!driftcircle) continue;
// From now (May 2015) onwards, we ONLY USE MIDDLE HT BIT:
// From now (May 2015) onwards, we ONLY USE MIDDLE HT BIT:
@@ -324,31 +327,49 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
@@ -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
ATH_MSG_DEBUG("check Hit: "
<< " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire << " Occ_Local: " << occ_local << " HTMB: " << isHTMB );
<< nTRThits << " TrtPart: " << TrtPart
<< " GasType: " << GasType << " SL: " << StrawLayer
<< " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire
// Jared - Development Output...
<< " Occ_Local: " << occ_local << " HTMB: " << isHTMB);
/*
std::cout << "check Hit: " << nTRThits << " TrtPart: " << TrtPart << " GasType: " << GasType << " SL: " << StrawLayer
<< " ZRpos: " << ZRpos[TrtPart] << " TWdist: " << rTrkWire << " Occ_Local: " << occ_local
<< " HTMB: " << isHTMB << std::endl;
*/
// Then call pHT functions with these values:
// Then call pHT functions with these values:
// ------------------------------------------
// ------------------------------------------
double pHTel = HTcalc->getProbHT(pTrk,
double pHTel = HTcalc->getProbHT( pTrk, Trk::electron, TrtPart, GasType, StrawLayer, ZRpos[TrtPart], rTrkWire, occ_local, hasTrackParameters);
Trk::electron,
double pHTpi = HTcalc->getProbHT( pTrk, Trk::pion, TrtPart, GasType, StrawLayer, ZRpos[TrtPart], rTrkWire, occ_local, hasTrackParameters);
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) {
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;
continue;
}
}
if (pHTel > 0.80 || pHTpi > 0.50 || pHTel < 0.025 || pHTpi < 0.010) {
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;
continue;
}
}
@@ -371,19 +392,14 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
@@ -371,19 +392,14 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con
prob_El_HT = pHTel_prod / (pHTel_prod + pHTpi_prod);
prob_El_HT = pHTel_prod / (pHTel_prod + pHTpi_prod);
ATH_MSG_DEBUG ("check---------------------------------------------------------------------------------------");
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 ("check---------------------------------------------------------------------------------------");
ATH_MSG_DEBUG ("");
ATH_MSG_DEBUG ("");
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
// Jared - ToT Implementation
dEdx = m_TRTdEdxTool->dEdx( &track, true, false, true); // Divide by L, exclude HT hits
dEdx = m_TRTdEdxTool->dEdx( &track, true, false, true); // Divide by L, exclude HT hits
double usedHits = m_TRTdEdxTool->usedHits( &track, true, false);
double usedHits = m_TRTdEdxTool->usedHits( &track, true, false);
@@ -456,7 +472,14 @@ bool InDet::TRT_ElectronPidToolRun2::CheckGeometry(int BEC, int Layer, int Straw
@@ -456,7 +472,14 @@ bool InDet::TRT_ElectronPidToolRun2::CheckGeometry(int BEC, int Layer, int Straw
|*%%% a geometry check is performed every time here %%%%%%%%%%%%%%%%%%%%%%%*|
|*%%% 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) ){
if (not CheckGeometry(HitPart,Layer,StrawLayer) ){
ATH_MSG_ERROR("TRT geometry fail. Returning default value.");
ATH_MSG_ERROR("TRT geometry fail. Returning default value.");
return 0.5;
return 0.5;
@@ -465,9 +488,26 @@ double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk:
@@ -465,9 +488,26 @@ double InDet::TRT_ElectronPidToolRun2::probHT( const double /*pTrk*/, const Trk:
return 1.0;
return 1.0;
}
}
double
double InDet::TRT_ElectronPidToolRun2::probHTRun2( float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy ) const {
InDet::TRT_ElectronPidToolRun2::probHTRun2(float pTrk,
SG::ReadCondHandle<HTcalculator> readHandle{m_HTReadKey};
Trk::ParticleHypothesis hypothesis,
bool hasTrackPar=true;
int TrtPart,
return (*readHandle)->getProbHT( pTrk, hypothesis, TrtPart, GasType, StrawLayer, ZR, rTrkWire, Occupancy, hasTrackPar );
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);
}
}
Loading