17 TauTruthTrackMatchingTool::TauTruthTrackMatchingTool(
const std::string&
name )
23 TauTruthTrackMatchingTool::~TauTruthTrackMatchingTool( )
30 return StatusCode::SUCCESS;
37 if (!m_bIsHadronicTrackAvailable.isValid())
40 bool avail = accIsHadronicTrack.
isAvailable(xTrackParticle);
41 m_bIsHadronicTrackAvailable.set (avail);
44 ATH_MSG_DEBUG(
"IsHadronicTrack decoration is available on first track processed, switched of rerun for further taus.");
45 ATH_MSG_DEBUG(
"If a truth track matching needs to be redone, please pass a shallow copy of the original track.");
48 if (*m_bIsHadronicTrackAvailable.ptr())
49 return StatusCode::SUCCESS;
51 ATH_CHECK(checkTrackIsTauInheritant(xTrackParticle));
52 ATH_CHECK(checkTrackType(xTrackParticle));
53 return StatusCode::SUCCESS;
57 StatusCode TauTruthTrackMatchingTool::classifyTracks(std::vector<const xAOD::TauTrack*>& vTrackParticles)
const
59 for (
auto xTrackParticle : vTrackParticles)
61 ATH_CHECK(checkTrackIsTauInheritant(*xTrackParticle));
62 ATH_CHECK(checkTrackType(*xTrackParticle));
64 return StatusCode::SUCCESS;
77 return StatusCode::SUCCESS;
82 if (accTruthMatchProbability(*(xTrackParticle.
track())) < 0.5)
85 return StatusCode::SUCCESS;
90 if ((
bool)accIsHadronicTrack(xTrackParticle) and accIsHadronicTrackDecayDepth(xTrackParticle) == 0)
93 return StatusCode::SUCCESS;
100 else if (iBarcode >= 200000)
ATH_CHECK(classifyConversion(xTrackParticle, *xTruthParticle));
101 else ATH_MSG_WARNING(
"No truth classification possible for barcode "<<iBarcode);
103 return StatusCode::SUCCESS;
113 return StatusCode::SUCCESS;
119 return StatusCode::SUCCESS;
121 for (
size_t iIncomingParticle = 0; iIncomingParticle < xProdVertex->
nIncomingParticles(); ++iIncomingParticle )
126 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");
128 return StatusCode::SUCCESS;
134 return StatusCode::SUCCESS;
138 size_t iElectrons = 0;
139 for (
size_t iOutgoingParticle = 0; iOutgoingParticle < xProdVertex->
nOutgoingParticles(); ++iOutgoingParticle )
144 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");
146 return StatusCode::SUCCESS;
152 return StatusCode::SUCCESS;
159 return StatusCode::SUCCESS;
162 return StatusCode::SUCCESS;
169 auto xTruthParticleLink = accTruthParticleLink(*(xTrackParticle.
track()));
171 if (xTruthParticleLink.isValid())
172 return (*xTruthParticleLink);
182 decIsHadronicTrack(xTrackParticle) = (
char)
false;
185 std::string sHistory =
"";
189 if (checkTruthParent(*xTruthParticle, iDepth, sHistory))
191 decIsHadronicTrack(xTrackParticle) = (
char)
true;
194 decIsHadronicTrackDecayDepth(xTrackParticle) = iDepth;
195 decDecayHistory(xTrackParticle) = sHistory;
197 return StatusCode::SUCCESS;
201 bool TauTruthTrackMatchingTool::checkTruthParent(
const xAOD::TruthParticle& xTruthParticle,
int& iDepth, std::string& sHistory)
const
212 if (xTruthParticleParent) {
221 return checkTruthParent(*xTruthParticleParent, iDepth, sHistory);
224 ATH_MSG_WARNING(
"vertex has incoming particles but no valid parent particle");