10 std::pair<ParticleType, ParticleOrigin>
18 if (!genPart)
return std::make_pair(parttype, partorig);
20 return particleTruthClassifier(genPart,
info);
23 std::pair<ParticleType, ParticleOrigin>
35 return std::make_pair(parttype, partorig);
37 genPart = getGenPart(trkPtr);
39 #ifndef XAOD_ANALYSIS // cluster matching available only in Athena
41 genPart = egammaClusMatch(clus,
true,
info);
43 ATH_MSG_WARNING(
"Forward Electron classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
48 if (!genPart)
return std::make_pair(parttype, partorig);
50 return particleTruthClassifier(genPart,
info);
53 std::pair<ParticleType, ParticleOrigin>
60 if (!clus)
return std::make_pair(parttype, partorig);
61 if (std::fabs(clus->
eta()) > 10.0 || std::fabs(clus->
phi()) > 6.28 || (clus->
et()) <= 0.)
return std::make_pair(parttype, partorig);
64 if (VxCvPtr !=
nullptr) {
66 if (itrk > 1)
continue;
68 if (!trkPtr)
continue;
70 std::pair<ParticleType, ParticleOrigin> classif = particleTruthClassifier(thePart,
info);
72 info->cnvPhotTrkPtr.push_back(trkPtr);
73 info->cnvPhotTrkToTruthPart.push_back(thePart);
74 info->cnvPhotPartType.push_back(classif.first);
75 info->cnvPhotPartOrig.push_back(classif.second);
81 #ifndef XAOD_ANALYSIS // Fwd electron available only in Athena
82 genPart = egammaClusMatch(clus,
false,
info);
84 ATH_MSG_WARNING(
"Photon Classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
86 if (!genPart)
return std::make_pair(parttype, partorig);
89 return particleTruthClassifier(genPart,
info);
92 std::pair<ParticleType, ParticleOrigin>
99 if (
mu->primaryTrackParticleLink().isValid()) trkPtr = *
mu->primaryTrackParticleLink();
100 else if (
mu->combinedTrackParticleLink().isValid()) trkPtr = *
mu->combinedTrackParticleLink();
101 else if (
mu->inDetTrackParticleLink().isValid()) trkPtr = *
mu->combinedTrackParticleLink();
102 else if (
mu->muonSpectrometerTrackParticleLink().isValid()) trkPtr = *
mu->muonSpectrometerTrackParticleLink();
104 if (!trkPtr)
return std::make_pair(parttype, partorig);
107 if (!genPart)
return std::make_pair(parttype, partorig);
110 return particleTruthClassifier(genPart,
info);
113 std::pair<ParticleType, ParticleOrigin>
116 ATH_MSG_DEBUG(
"Executing egamma photon Classifier with cluster Input");
119 if (!clus)
return std::make_pair(parttype, partorig);
120 if (std::fabs(clus->
eta()) > 10.0 || std::fabs(clus->
phi()) >
M_PI || (clus->
et()) <= 0.)
return std::make_pair(parttype, partorig);
122 #ifndef XAOD_ANALYSIS // Fwd electron available only in Athena
123 genPart = egammaClusMatch(clus,
false,
info);
125 ATH_MSG_WARNING(
"Cluster Classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
127 if (!genPart)
return std::make_pair(parttype, partorig);
130 return particleTruthClassifier(genPart,
info);
133 std::pair<ParticleType, ParticleOrigin>
140 std::set<const xAOD::TruthParticle*> allJetMothers;
141 std::set<const xAOD::TruthParticle*> constituents;
142 if (!
jet)
return std::make_pair(parttype, partorig);
143 allJetMothers.clear();
144 constituents.clear();
145 findJetConstituents(
jet, constituents, DR);
149 for (
const auto& thePart: constituents) {
154 tempparttype = particleTruthClassifier(thePart,
info).first;
155 if (tempparttype !=
Hadron)
continue;
163 if (parttype !=
BJet) parttype =
CJet;
167 if (parttype !=
BJet && parttype !=
CJet) parttype =
LJet;
174 allJetMothers.clear();
175 constituents.clear();
177 return std::make_pair(parttype, partorig);
185 if (!trk)
return nullptr;
187 info->deltaRMatch = -999.;
188 info->deltaPhi = -999.;
189 info->probTrkToTruth = 0;
190 info->numOfSiHits = 0;
199 ATH_MSG_DEBUG(
"Track particle is not associated to truth particle");
203 const auto& truthLink = tPL(*trk);
204 if (!truthLink.isValid()) {
210 if (!theGenParticle) {
218 info->probTrkToTruth = tMP(*trk);
228 if (
MC::isDecayed(theGenParticle) && (std::abs(theGenParticle->
pdgId()) == 11 || std::abs(theGenParticle->
pdgId()) == 13)) {
232 if (EndVrtx !=
nullptr) {
235 theGenPartTmp =
nullptr;
237 if (!theDaugt)
continue;
238 if (theDaugt->pdgId() == theGenParticle->
pdgId()) theGenPartTmp = theDaugt;
239 if (theDaugt->pdgId() != theGenParticle->
pdgId() && !
MC::isPhoton(theDaugt)) theGenPartTmp =
nullptr;
246 EndVrtx = theGenPartTmp ? theGenPartTmp->
decayVtx() :
nullptr;
247 }
while (theGenPartTmp && theGenPartTmp->
pdgId() == theGenParticle->
pdgId() &&
MC::isDecayed(theGenPartTmp) && EndVrtx !=
nullptr);
249 if (theGenPartTmp && theGenPartTmp->
pdgId() == theGenParticle->
pdgId()) theGenParticle = theGenPartTmp;
256 uint8_t NumOfSiHits = NumOfSCTHits + NumOfPixHits;
259 float deteta = detEta(theGenParticle->
eta(), trk->
eta());
260 float deltaRMatch = std::hypot(
deltaPhi, deteta);
261 if ((NumOfSiHits > m_NumOfSiHitsCut && deltaRMatch > m_deltaRMatchCut) ||
262 (NumOfSiHits <= m_NumOfSiHitsCut && deltaPhi > m_deltaPhiMatchCut)) theGenParticle =
nullptr;
265 info->deltaRMatch = deltaRMatch;
267 info->numOfSiHits = NumOfSiHits;
270 return (theGenParticle);
274 std::set<const xAOD::TruthParticle*>& constituents,
282 if (!truthParticleContainerReadHandle.
isValid()) {
283 ATH_MSG_WARNING(
" Invalid ReadHandle for xAOD::TruthParticleContainer with key: " << truthParticleContainerReadHandle.
key());
286 ATH_MSG_DEBUG(
"xAODTruthParticleContainer with key " << truthParticleContainerReadHandle.
key() <<
" has valid ReadHandle ");
288 for (
const auto *
const thePart : *truthParticleContainerReadHandle) {
290 if (
MC::isStable(thePart) && thePart->p4().DeltaR(
jet->p4()) < m_jetPartDRMatch) {
291 constituents.insert(thePart);
297 for (
const auto *particle0 :
vec) {
300 constituents.insert(thePart);
307 std::set<const xAOD::TruthParticle*> constituents;
308 std::set<const xAOD::TruthParticle*> daughters;
309 std::set<const xAOD::TruthParticle*>
intersect;
311 findJetConstituents(
jet, constituents, DR);
313 if (daughters.empty()) daughters.insert(thePart);
321 if (nparts)
return 1.0*
intersect.size() / daughters.size();
324 for (
const auto *daughter : daughters) { tot += daughter->pt();}