6#include "AthLinks/ElementLink.h"
12#include "GaudiKernel/MsgStream.h"
13#include "GaudiKernel/DataSvc.h"
14#include "GaudiKernel/PhysicalConstants.h"
39 return StatusCode::SUCCESS;
44 CLHEP::HepLorentzVector nu(0, 0, 0, 0);
52 if (!part->hasDecayVtx())
55 for (
size_t n = 0; n < part->nChildren(); ++n)
64 CLHEP::HepLorentzVector nutau;
69 ATH_MSG_WARNING(
"xAOD Tau Truth Particles are already available in the event");
70 return StatusCode::SUCCESS;
75 ATH_CHECK(xTruthTauParticleContainer.
record(std::make_unique<xAOD::TruthParticleContainer>(), std::make_unique<xAOD::TruthParticleAuxContainer>()));
80 if ( !xTruthParticleContainer.
isValid() )
83 return StatusCode::FAILURE;
100 std::vector<int> uniqueID_list;
102 int dup_uniqueID = 0;
104 unsigned int nParticles = xTruthParticleContainer->size();
106 for (
unsigned int iPart = 0; iPart < nParticles; ++iPart)
117 if (uniqueID_list.size() > 0){
118 found = (std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
123 uniqueID_list.push_back(my_uniqueID);
125 float this_abseta = theParticle->
abseta();
126 float this_pt = theParticle->
pt();
136 xTruthTauParticleContainer->push_back(xTruthParticle);
138 *xTruthParticle=*theParticle;
142 nuDecorator(*xTruthParticle) = nutau;
145 for (
size_t n = 0; n < tau->
nChildren(); ++n)
154 tauTypeDecorator(*xTruthParticle) = tauType;
156unsigned int particleOutCome;
159unsigned int particleOrigin;
163 originDecorator(*xTruthParticle) = particleOrigin;
164 outcomeDecorator(*xTruthParticle) = particleOutCome;
166 classificationDecorator(*xTruthParticle) =
result;
167 parenthadronPIDDecorator(*xTruthParticle) = hadron_pdg;
171 if(zero_uniqueID!=0 || dup_uniqueID != 0)
ATH_MSG_INFO(
"Found " << zero_uniqueID <<
" uniqueID=0 particles and " << dup_uniqueID <<
" duplicated");
172 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helpers for checking error return status codes and reporting errors.
ATLAS-specific HepMC functions.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore()
ElementLink implementation for ROOT usage.
SG::Decorator< T, ALLOC > Decorator
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAODTruthParticleSlimmerTau(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
virtual StatusCode execute()
Function executing the algorithm.
virtual StatusCode initialize()
Function initialising the algorithm.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerName
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthTauParticleContainerName
The key for the output xAOD truth containers.
PublicToolHandle< IMCTruthClassifier > m_classifier
DoubleProperty m_abseta_selection
CLHEP::HepLorentzVector sumDaughterNeutrinos(const xAOD::TruthParticle *tau)
DoubleProperty m_tau_pt_selection
Selection values for keeping taus and leptons.
const TruthParticle_v1 * child(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
double abseta() const
The absolute pseudorapidity ( ) of the particle.
int absPdgId() const
Absolute PDG ID code (often useful)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
size_t nChildren() const
Number of children of this particle.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
void classify(ToolHandle< IMCTruthClassifier > &m_classif, const xAOD::TruthParticle *theParticle, unsigned int &particleOutCome, unsigned int &result, int &hadron_pdg, unsigned int &particleType, unsigned int &particleOrigin)
constexpr int UNDEFINED_ID
bool isSMNeutrino(const T &p)
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
TruthParticle_v1 TruthParticle
Typedef to implementation.