Function executing the algorithm.
62{
63
64 CLHEP::HepLorentzVector nutau;
65
66
68 {
69 ATH_MSG_WARNING(
"xAOD Tau Truth Particles are already available in the event");
70 return StatusCode::SUCCESS;
71 }
72
73
75 ATH_CHECK(xTruthTauParticleContainer.record(std::make_unique<xAOD::TruthParticleContainer>(), std::make_unique<xAOD::TruthParticleAuxContainer>()));
77
78
80 if ( !xTruthParticleContainer.
isValid() )
81 {
83 return StatusCode::FAILURE;
84 }
85
86
87
88 const static SG::AuxElement::Decorator<unsigned int> originDecorator("classifierParticleOrigin");
89 const static SG::AuxElement::Decorator<unsigned int> typeDecorator("classifierParticleType");
90 const static SG::AuxElement::Decorator<unsigned int> outcomeDecorator("classifierParticleOutCome");
91 const static SG::AuxElement::Decorator<unsigned int> classificationDecorator("Classification");
92 const static SG::AuxElement::Decorator<int> parenthadronPIDDecorator("parentHadronID");
93
94
95 const static SG::AuxElement::Decorator<CLHEP::HepLorentzVector> nuDecorator("nuVector");
96 const static SG::AuxElement::Decorator<int> tauTypeDecorator("tauType");
97
98
99
100 std::vector<int> uniqueID_list;
101 int zero_uniqueID=0;
102 int dup_uniqueID = 0;
103
104 unsigned int nParticles = xTruthParticleContainer->size();
105
106 for (unsigned int iPart = 0; iPart < nParticles; ++iPart)
107 {
108 ElementLink<xAOD::TruthParticleContainer> eltp(*xTruthParticleContainer, iPart);
110
113 zero_uniqueID++;
114 continue;
115 }
117 if (uniqueID_list.size() > 0){
118 found = (std::find(uniqueID_list.begin(), uniqueID_list.end(), my_uniqueID) != uniqueID_list.end());
119 if(found) {
120 dup_uniqueID++;
121 continue;}
122 }
123 uniqueID_list.push_back(my_uniqueID);
124
125 float this_abseta = theParticle->
abseta();
126 float this_pt = theParticle->
pt();
127
128
129
130
131
133 {
135
136 xTruthTauParticleContainer->push_back(xTruthParticle);
137
138 *xTruthParticle=*theParticle;
141
142 nuDecorator(*xTruthParticle) = nutau;
143
144 int tauType = 0;
146 {
148 tauType = 1;
150 tauType = 2;
152 tauType = 11;
153 }
154 tauTypeDecorator(*xTruthParticle) = tauType;
155
156unsigned int particleOutCome;
158unsigned int particleType;
159unsigned int particleOrigin;
160int hadron_pdg;
162 typeDecorator(*xTruthParticle) = particleType;
163 originDecorator(*xTruthParticle) = particleOrigin;
164 outcomeDecorator(*xTruthParticle) = particleOutCome;
165
166 classificationDecorator(*xTruthParticle) =
result;
167 parenthadronPIDDecorator(*xTruthParticle) = hadron_pdg;
168 }
169
170 }
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;
173}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
ServiceHandle< StoreGateSvc > & evtStore()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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 isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
TruthParticle_v1 TruthParticle
Typedef to implementation.