16 TauTruthTrackMatchingTool::TauTruthTrackMatchingTool(
const std::string&
name )
21 TauTruthTrackMatchingTool::~TauTruthTrackMatchingTool( )
27 return StatusCode::SUCCESS;
34 if (!m_bIsHadronicTrackAvailable.isValid())
37 bool avail = accIsHadronicTrack.
isAvailable(xTrackParticle);
38 m_bIsHadronicTrackAvailable.set (avail);
41 ATH_MSG_DEBUG(
"IsHadronicTrack decoration is available on first track processed, switched of rerun for further taus.");
42 ATH_MSG_DEBUG(
"If a truth track matching needs to be redone, please pass a shallow copy of the original track.");
45 if (*m_bIsHadronicTrackAvailable.ptr())
46 return StatusCode::SUCCESS;
48 ATH_CHECK(checkTrackIsTauInheritant(xTrackParticle));
49 ATH_CHECK(checkTrackType(xTrackParticle));
50 return StatusCode::SUCCESS;
54 StatusCode TauTruthTrackMatchingTool::classifyTracks(std::vector<const xAOD::TauTrack*>& vTrackParticles)
const
56 for (
auto xTrackParticle : vTrackParticles)
58 ATH_CHECK(checkTrackIsTauInheritant(*xTrackParticle));
59 ATH_CHECK(checkTrackType(*xTrackParticle));
61 return StatusCode::SUCCESS;
74 return StatusCode::SUCCESS;
79 if (accTruthMatchProbability(*(xTrackParticle.
track())) < 0.5)
82 return StatusCode::SUCCESS;
87 if (
static_cast<bool>(accIsHadronicTrack(xTrackParticle)) and accIsHadronicTrackDecayDepth(xTrackParticle) == 0)
90 return StatusCode::SUCCESS;
102 ATH_MSG_DEBUG(
"unique ID not available for this truth track. Will mark as UnclassifiedTrack ");
104 return StatusCode::SUCCESS;
111 return StatusCode::SUCCESS;
121 return StatusCode::SUCCESS;
127 return StatusCode::SUCCESS;
129 for (
size_t iIncomingParticle = 0; iIncomingParticle < xProdVertex->
nIncomingParticles(); ++iIncomingParticle )
134 ATH_MSG_WARNING(
"Truth parent of tau decay was not found in TruthParticles container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
136 return StatusCode::SUCCESS;
142 return StatusCode::SUCCESS;
146 size_t iElectrons = 0;
147 for (
size_t iOutgoingParticle = 0; iOutgoingParticle < xProdVertex->
nOutgoingParticles(); ++iOutgoingParticle )
152 ATH_MSG_WARNING(
"Truth daughter of tau decay was not found in TruthParticles container. Please ensure that this container has the full tau decay information or produce the TruthTaus container in AtlasDerivation.\nInformation on how to do this can be found here:\nhttps://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauPreRecommendations2015#Accessing_Tau_Truth_Information");
154 return StatusCode::SUCCESS;
160 return StatusCode::SUCCESS;
167 return StatusCode::SUCCESS;
170 return StatusCode::SUCCESS;
177 auto xTruthParticleLink = accTruthParticleLink(*(xTrackParticle.
track()));
179 if (xTruthParticleLink.isValid())
180 return (*xTruthParticleLink);
190 decIsHadronicTrack(xTrackParticle) = (
char)
false;
193 std::string sHistory =
"";
197 if (checkTruthParent(*xTruthParticle, iDepth, sHistory))
199 decIsHadronicTrack(xTrackParticle) = (
char)
true;
202 decIsHadronicTrackDecayDepth(xTrackParticle) = iDepth;
203 decDecayHistory(xTrackParticle) = sHistory;
205 return StatusCode::SUCCESS;
209 bool TauTruthTrackMatchingTool::checkTruthParent(
const xAOD::TruthParticle& xTruthParticle,
int& iDepth, std::string& sHistory)
const
220 if (xTruthParticleParent) {
229 return checkTruthParent(*xTruthParticleParent, iDepth, sHistory);
232 ATH_MSG_WARNING(
"vertex has incoming particles but no valid parent particle");