|
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"
28 :
AthAlgorithm(
name, svcLoc), m_classifier(
"MCTruthClassifier/MCTruthClassifier")
43 return StatusCode::SUCCESS;
48 CLHEP::HepLorentzVector nu(0, 0, 0, 0);
56 if (!
part->hasDecayVtx())
59 for (
size_t n = 0;
n <
part->nChildren(); ++
n)
68 CLHEP::HepLorentzVector nutau;
74 ATH_MSG_WARNING(
"xAOD Tau Truth Particles are already available in the event");
75 return StatusCode::SUCCESS;
83 xTruthTauParticleContainer->setStore(xTruthTauParticleAuxContainer);
91 return StatusCode::FAILURE;
108 std::vector<int> uniqueID_list;
110 int dup_uniqueID = 0;
112 unsigned int nParticles = xTruthParticleContainer->
size();
114 for (
unsigned int iPart = 0; iPart < nParticles; ++iPart)
125 if (uniqueID_list.size() > 0){
126 found = (
std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
131 uniqueID_list.push_back(my_uniqueID);
133 float this_abseta = theParticle->
abseta();
134 float this_pt = theParticle->
pt();
144 xTruthTauParticleContainer->
push_back(xTruthParticle);
146 *xTruthParticle=*theParticle;
150 nuDecorator(*xTruthParticle) = nutau;
162 tauTypeDecorator(*xTruthParticle) = tauType;
164 unsigned int particleOutCome;
167 unsigned int particleOrigin;
171 originDecorator(*xTruthParticle) = particleOrigin;
172 outcomeDecorator(*xTruthParticle) = particleOutCome;
174 classificationDecorator(*xTruthParticle) =
result;
175 parenthadronPIDDecorator(*xTruthParticle) = hadron_pdg;
179 if(zero_uniqueID!=0 || dup_uniqueID != 0)
ATH_MSG_INFO(
"Found " << zero_uniqueID <<
" uniqueID=0 particles and " << dup_uniqueID <<
" duplicated");
180 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
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)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
bool m_forceRerun
a flag to force rerunning (useful for rerunning on ESDs)
double m_abseta_selection
xAODTruthParticleSlimmerTau(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
double m_tau_pt_selection
Selection values for keeping taus and leptons.
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.
Auxiliary store for the truth vertices.
TruthParticleAuxContainer_v1 TruthParticleAuxContainer
Declare the latest version of the truth particle auxiliary container.
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.
std::string m_xaodTruthParticleContainerName
TruthParticle_v1 TruthParticle
Typedef to implementation.
virtual StatusCode execute()
Function executing the algorithm.
#define CHECK(...)
Evaluate an expression and check for errors.
constexpr int UNDEFINED_ID
ElementLink implementation for ROOT usage.
ToolHandle< IMCTruthClassifier > m_classifier
size_t nChildren() const
Number of children of this particle.
std::string m_xaodTruthTauParticleContainerName
The key for the output xAOD truth containers.
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.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
#define ATH_MSG_WARNING(x)
const TruthParticle_v1 * child(size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
CLHEP::HepLorentzVector sumDaughterNeutrinos(const xAOD::TruthParticle *tau)
size_type size() const noexcept
Returns the number of elements in the collection.
double abseta() const
The absolute pseudorapidity ( ) of the particle.