10std::pair<ParticleType, ParticleOrigin>
17 if (info) info->genPart = genPart;
18 if (!genPart)
return std::make_pair(parttype, partorig);
23std::pair<ParticleType, ParticleOrigin>
35 return std::make_pair(parttype, partorig);
43 ATH_MSG_WARNING(
"Forward Electron classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
47 if (info) info->genPart = genPart;
48 if (!genPart)
return std::make_pair(parttype, partorig);
53std::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;
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);
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);
87 if (info) info->genPart = genPart;
92std::pair<ParticleType, ParticleOrigin>
98 const xAOD::TrackParticle* trkPtr = mu->trackParticle(xAOD::Muon::TrackParticleType::Primary);
100 if (!trkPtr)
return std::make_pair(parttype, partorig);
103 if (!genPart)
return std::make_pair(parttype, partorig);
104 if (info) info->genPart = genPart;
109std::pair<ParticleType, ParticleOrigin>
112 ATH_MSG_DEBUG(
"Executing egamma photon Classifier with cluster Input");
115 if (!clus)
return std::make_pair(parttype, partorig);
116 if (std::fabs(clus->
eta()) > 10.0 || std::fabs(clus->
phi()) >
M_PI || (clus->
et()) <= 0.)
return std::make_pair(parttype, partorig);
121 ATH_MSG_WARNING(
"Cluster Classification using extrapolation to Calo is available only in Athena , check your enviroment. ");
123 if (!genPart)
return std::make_pair(parttype, partorig);
125 if (info)
info->genPart = genPart;
129std::pair<ParticleType, ParticleOrigin>
136 std::set<const xAOD::TruthParticle*> allJetMothers;
137 std::set<const xAOD::TruthParticle*> constituents;
138 if (!
jet)
return std::make_pair(parttype, partorig);
139 allJetMothers.clear();
140 constituents.clear();
146 if (!truthParticleContainerReadHandle.
isValid()) {
147 ATH_MSG_WARNING(
" Invalid ReadHandle for xAOD::TruthParticleContainer with key: " << truthParticleContainerReadHandle.
key());
150 ATH_MSG_DEBUG(
"xAODTruthParticleContainer with key " << truthParticleContainerReadHandle.
key() <<
" has valid ReadHandle ");
152 for (
const auto *
const thePart : *truthParticleContainerReadHandle) {
155 constituents.insert(thePart);
162 for (
const auto *particle0 :
vec) {
165 constituents.insert(thePart);
172 for (
const auto& thePart: constituents) {
178 if (tempparttype !=
Hadron)
continue;
186 if (parttype !=
BJet) parttype =
CJet;
190 if (parttype !=
BJet && parttype !=
CJet) parttype =
LJet;
197 allJetMothers.clear();
198 constituents.clear();
200 return std::make_pair(parttype, partorig);
208 if (!trk)
return nullptr;
210 info->deltaRMatch = -999.;
211 info->deltaPhi = -999.;
212 info->probTrkToTruth = 0;
213 info->numOfSiHits = 0;
216 uint8_t NumOfPixHits = 0;
217 uint8_t NumOfSCTHits = 0;
220 static const SG::AuxElement::Accessor<TruthLink_t> tPL(
"truthParticleLink");
221 if (!tPL.isAvailable(*trk)) {
222 ATH_MSG_DEBUG(
"Track particle is not associated to truth particle");
226 const auto& truthLink = tPL(*trk);
227 if (!truthLink.isValid()) {
233 if (!theGenParticle) {
239 static const SG::AuxElement::Accessor<float> tMP(
"truthMatchProbability");
240 if (tMP.isAvailable(*trk)) {
241 info->probTrkToTruth = tMP(*trk);
247 if (theGenParticle->
status() == 3) {
260 if (EndVrtx !=
nullptr) {
263 theGenPartTmp =
nullptr;
265 if (!theDaugt)
continue;
266 if (theDaugt->pdgId() == theGenParticle->
pdgId()) theGenPartTmp = theDaugt;
267 if (theDaugt->pdgId() != theGenParticle->
pdgId() && !
MC::isPhoton(theDaugt)) theGenPartTmp =
nullptr;
274 EndVrtx = theGenPartTmp ? theGenPartTmp->
decayVtx() :
nullptr;
275 }
while (theGenPartTmp && theGenPartTmp->
pdgId() == theGenParticle->
pdgId() &&
MC::isDecayed(theGenPartTmp) && EndVrtx !=
nullptr);
277 if (theGenPartTmp && theGenPartTmp->
pdgId() == theGenParticle->
pdgId()) theGenParticle = theGenPartTmp;
284 uint8_t NumOfSiHits = NumOfSCTHits + NumOfPixHits;
286 float deltaPhi = std::abs(std::remainder(theGenParticle->
phi() - trk->
phi(), 2*std::numbers::pi));
287 float deteta = std::abs(theGenParticle->
eta() - trk->
eta());
288 float deltaRMatch = std::hypot(
deltaPhi, deteta);
290 (NumOfSiHits <= m_NumOfSiHitsCut && deltaPhi >
m_deltaPhiMatchCut)) theGenParticle =
nullptr;
293 info->deltaRMatch = deltaRMatch;
295 info->numOfSiHits = NumOfSiHits;
298 return (theGenParticle);
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_WARNING(x)
std::vector< size_t > vec
ElementLink< xAOD::TruthParticleContainer > TruthLink_t
ElementLink implementation for ROOT usage.
virtual std::pair< MCTruthPartClassifier::ParticleType, MCTruthPartClassifier::ParticleOrigin > particleTruthClassifier(const xAOD::TruthParticle *, IMCTruthClassifier::Info *info) const override final
virtual const xAOD::TruthParticle * egammaClusMatch(const xAOD::CaloCluster *, bool, IMCTruthClassifier::Info *info) const override final
virtual const xAOD::TruthParticle * getGenPart(const xAOD::TrackParticle *, IMCTruthClassifier::Info *info=nullptr) const override final
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleContainerKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
uint16_t author(uint16_t bitmask=EgammaParameters::AuthorALL) const
Get author.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
const xAOD::TrackParticle * trackParticle(size_t index=0) const
Pointer to the xAOD::TrackParticle/s that match the electron candidate.
A vector of jet constituents at the scale used during jet finding.
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
int status() const
Status code.
int pdgId() const
PDG ID code.
const TruthVertex_v1 * decayVtx() const
The decay vertex of this particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
std::vector< const TruthParticle * > particles_out() const
Get the outgoing particles.
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
ParticleOrigin defJetOrig(const T &allJetMothers)
ParticleType defTypeOfHadron(int pdg)
bool isPhoton(const T &p)
bool isElectron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
void findParticleAncestors(T thePart, std::set< T > &allancestors)
Function to find all ancestors of the particle.
bool isDecayed(const T &p)
Identify if the particle decayed.
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Jet_v1 Jet
Definition of the current "jet version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TruthVertex_v1 TruthVertex
Typedef to implementation.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
Photon_v1 Photon
Definition of the current "egamma version".
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Electron_v1 Electron
Definition of the current "egamma version".