 |
ATLAS Offline Software
|
Go to the documentation of this file.
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;
154 tauTypeDecorator(*xTruthParticle) = tauType;
156 unsigned int particleOutCome;
159 unsigned 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;
DoubleProperty m_tau_pt_selection
Selection values for keeping taus and leptons.
int absPdgId() const
Absolute PDG ID code (often useful)
std::string find(const std::string &s)
return a remapped string
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)
SG::WriteHandleKey< xAOD::TruthParticleContainer > m_xaodTruthTauParticleContainerName
The key for the output xAOD truth containers.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_xaodTruthParticleContainerName
const std::string & key() const
Return the StoreGate ID for the referenced object.
xAODTruthParticleSlimmerTau(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Helper class to provide type-safe access to aux data.
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
virtual StatusCode initialize()
Function initialising the algorithm.
TruthParticle_v1 TruthParticle
Typedef to implementation.
virtual StatusCode execute()
Function executing the algorithm.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
constexpr int UNDEFINED_ID
ElementLink implementation for ROOT usage.
DoubleProperty m_abseta_selection
size_t nChildren() const
Number of children of this particle.
Helpers for checking error return status codes and reporting errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const TruthParticle_v1 * child(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
PublicToolHandle< IMCTruthClassifier > m_classifier
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
bool isSMNeutrino(const T &p)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
CLHEP::HepLorentzVector sumDaughterNeutrinos(const xAOD::TruthParticle *tau)
double abseta() const
The absolute pseudorapidity ( ) of the particle.