ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6
7// local include(s)
11#include "TF1.h"
12
13#ifdef ASGTOOL_ATHENA
14#include "CLHEP/Units/SystemOfUnits.h"
15using CLHEP::GeV;
16#else
17#define GeV 1000
18#endif
19
20#include <cmath>
21#include <fstream>
22#include <set>
23#include <sstream>
24
25using namespace TauAnalysisTools;
26
27//______________________________________________________________________________
28void TauAnalysisTools::split(const std::string& sInput, const char cDelim, std::vector<std::string>& vOut)
29{
30 std::stringstream sSS(sInput);
31 std::string sItem;
32 while (std::getline(sSS, sItem, cDelim))
33 vOut.push_back(sItem);
34}
35
36//______________________________________________________________________________
37void TauAnalysisTools::split(TEnv& rEnv, const std::string& sKey, const char cDelim, std::vector<std::string>& vOut)
38{
39 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
40 std::string sItem;
41 while (std::getline(sSS, sItem, cDelim))
42 vOut.push_back(sItem);
43}
44
45//______________________________________________________________________________
46void TauAnalysisTools::split(TEnv& rEnv, const std::string& sKey, const char cDelim, std::vector<size_t>& vOut)
47{
48 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
49 std::string sItem;
50 while (std::getline(sSS, sItem, cDelim))
51 vOut.push_back(size_t(stoi(sItem)));
52}
53
54//______________________________________________________________________________
55void TauAnalysisTools::split(TEnv& rEnv, const std::string& sKey, const char cDelim, std::vector<int>& vOut)
56{
57 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
58 std::string sItem;
59 while (std::getline(sSS, sItem, cDelim))
60 vOut.push_back(stoi(sItem));
61}
62
63//______________________________________________________________________________
64void TauAnalysisTools::split(TEnv& rEnv, const std::string& sKey, const char cDelim, std::vector<unsigned>& vOut)
65{
66 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
67 std::string sItem;
68 while (std::getline(sSS, sItem, cDelim))
69 vOut.push_back(stoi(sItem));
70}
71
72//______________________________________________________________________________
73void TauAnalysisTools::split(TEnv& rEnv, const std::string& sKey, const char cDelim, std::vector<float>& vOut)
74{
75 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
76 std::string sItem;
77 while (std::getline(sSS, sItem, cDelim))
78 vOut.push_back(stof(sItem));
79}
80
81//______________________________________________________________________________
82void TauAnalysisTools::split(TEnv& rEnv, const std::string& sKey, const char cDelim, std::vector<double>& vOut)
83{
84 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
85 std::string sItem;
86 while (std::getline(sSS, sItem, cDelim))
87 vOut.push_back(stod(sItem));
88}
89
90//______________________________________________________________________________
92{
93 // return MVA based tau pt in GeV
94 return xTau.ptFinalCalib()/GeV;
95}
96
97//______________________________________________________________________________
99{
100 // return MVA based tau eta
101 return xTau.etaFinalCalib();
102}
103
104//______________________________________________________________________________
106{
107 // return MVA based absolute tau eta
108 return std::abs(xTau.etaFinalCalib());
109}
110
111//______________________________________________________________________________
113{
114 // return truth visible tau Pt in GeV
116
117 // if there is a truth tau return visible pT, otherwise return 0 (getTruth will print an error)
118 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
119 static const SG::ConstAccessor<double> accPtVis("pt_vis");
120 if (xTruthTau!=nullptr && accIsHadronicTau (*xTruthTau))
121 return (accPtVis(*xTruthTau)/GeV);
122 else
123 return 0.;
124}
125//______________________________________________________________________________
127{
128 // return truth tau absolute eta
130
131 // if there is a truth tau return absolute eta, otherwise return -5 (getTruth will print an error)
132 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
133 if (xTruthTau!=nullptr && accIsHadronicTau (*xTruthTau))
134 return std::abs(xTruthTau->eta());
135 else
136 return -5.;
137}
138
139//______________________________________________________________________________
141{
142 // return truth tau decay mode.
143 int iDecayMode = getTruthDecayMode(xTau);
144 return static_cast<double>(iDecayMode);
145}
146
147//______________________________________________________________________________
149{
151
152 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
153 if (xTruthTau!=nullptr && accIsHadronicTau(*xTruthTau))
154 return getTruthDecayMode(*xTruthTau);
155 else
157}
158
159//______________________________________________________________________________
161{
162 static const SG::ConstAccessor<size_t> accNumCharged ("numCharged");
163 if (!(accNumCharged.isAvailable(xTruthTau)))
164 {
165 // passed truth particle is not a truth tau
167 }
168
169 int iCharged = getNTauDecayParticles(xTruthTau,MC::PIPLUS, true) + getNTauDecayParticles(xTruthTau,MC::KPLUS, true);
170 int iNeutral = getNTauDecayParticles(xTruthTau,MC::PI0, true);
171 if (iCharged == 1)
172 {
173 if (iNeutral == 0) return xAOD::TauJetParameters::DecayMode::Mode_1p0n;
174 if (iNeutral == 1) return xAOD::TauJetParameters::DecayMode::Mode_1p1n;
175 if (iNeutral >= 2) return xAOD::TauJetParameters::DecayMode::Mode_1pXn;
176 }
177 else if (iCharged == 3)
178 {
179 if (iNeutral == 0) return xAOD::TauJetParameters::DecayMode::Mode_3p0n;
180 if (iNeutral >= 1) return xAOD::TauJetParameters::DecayMode::Mode_3pXn;
181 }
182
183 if (iCharged == 2 or iCharged == 4 or iCharged == 5)
185 if (iCharged == 0 or iCharged >=6)
187
188 // if you got here, something should have gone wrong
190}
191
192//______________________________________________________________________________
193int TauAnalysisTools::getNTauDecayParticles(const xAOD::TruthParticle& xTruthTau, int iPdgId, bool bCompareAbsoluteValues)
194{
195 int iNum = 0;
196 static const SG::ConstAccessor<std::vector<int> > accDecayModeVector("DecayModeVector");
197 if (!accDecayModeVector.isAvailable(xTruthTau))
198 {
199 Warning("TauAnalysisTools::getNTauDecayParticles", "passed truth particle is not a truth tau, return 0");
200 return 0;
201 }
202
203 for(auto iPdgId2 : accDecayModeVector(xTruthTau))
204 if (!bCompareAbsoluteValues)
205 {
206 if (iPdgId2 == iPdgId) iNum++;
207 }
208 else
209 {
210 if (std::abs(iPdgId2) == std::abs(iPdgId)) iNum++;
211 }
212 return iNum;
213}
214
215//______________________________________________________________________________
217{
218 // returns true if last line in file is empty or the line starts with the
219 // number sign #
220
221 std::ifstream fInputFile;
222 fInputFile.open(sFileName);
223 if(!fInputFile.is_open())
224 return true;
225
226 fInputFile.seekg(-1,fInputFile.end);
227
228 bool bKeepLooping = true;
229 while(bKeepLooping)
230 {
231 char ch;
232 fInputFile.get(ch);
233
234 if(static_cast<int>(fInputFile.tellg()) <= 1)
235 {
236 fInputFile.seekg(0);
237 bKeepLooping = false;
238 }
239 else if(ch == '\n')
240 bKeepLooping = false;
241 else
242 fInputFile.seekg(-2,fInputFile.cur);
243 }
244
245 std::string sLastLine;
246 getline(fInputFile,sLastLine);
247 fInputFile.close();
248
249 return (sLastLine.size() == 0 or sLastLine[0] == '#');
250}
251
252//______________________________________________________________________________
253void TauAnalysisTools::createPi0Vectors(const xAOD::TauJet* xTau, std::vector<TLorentzVector>& vPi0s)
254{
255 // reset the pi0s
256 vPi0s.clear();
257
258 // Since the PFO links as they come out of reconstruction, only correspond to
259 // calorimeter clusters, whereas we want the consts_pi0 vectors to correspond
260 // to real pi0s, we need to be careful to collect the PFOs correctly to pi0s
261 // for the cases where number of pi0s does not match to the decay mode:
262 size_t iNumPi0PFO = xTau->nPi0PFOs();
263
264 int iDecayMode = -1;
265
267 {
268 Error("TauAnalysisTools::createPi0Vectors", "Failed to retrieve panTauDetail decay mode.");
269 return;
270 }
271
272 if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1p1n && iNumPi0PFO > 1)
273 {
274 // float fMassPi0 = ParticleConstants::piZeroMassInMeV;
276
277 // combine both photons (with 0 mass from Pantau) to one pi0 vector:
278 const xAOD::PFO* xPfo1 = xTau->pi0PFO(0);
279 const xAOD::PFO* xPfo2 = xTau->pi0PFO(1);
280 vPi0s.push_back(xPfo1->p4() + xPfo2->p4());
281
282 // re-set the mass to one pi0:
283 double dNewMomentum = std::sqrt(vPi0s[0].E() * vPi0s[0].E() - fMassPi0Squared);
284 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
285 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
286 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
287 vPi0s[0].E());
288 }
289 else if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1pXn && iNumPi0PFO == 1)
290 {
291 // make a single pi0 from a PFO that contains two pi0s:
292 const xAOD::PFO* xPfo = xTau->pi0PFO(0);
293 // add the 2-pi0 vector preliminarily to the pi0vector:
294 vPi0s.push_back(xPfo->p4());
295
296 // re-set the mass back to one pi0:
297 double dNewMomentum = std::sqrt(vPi0s[0].E() / 2 * vPi0s[0].E() / 2 - vPi0s[0].M() / 2. * vPi0s[0].M() / 2.);
298 vPi0s[0].SetVectM(vPi0s[0].Vect() * (dNewMomentum / vPi0s[0].P()), vPi0s[0].M() / 2.);
299
300 // create another pi0 from the same vector:
301 vPi0s.push_back(vPi0s[0]);
302 }
303 else
304 {
305 // if it's not any of the special cases above then just collect the PFOs:
306 for (size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++)
307 {
308 vPi0s.push_back(xTau->pi0PFO(iPFO)->p4());
309 }
310 }
311}
312
313
314//______________________________________________________________________________
315void TauAnalysisTools::correctedPi0Vectors(const xAOD::TauJet* xTau, std::vector<TLorentzVector>& correctedPi0s, TLorentzVector& TauP4){
316 //reset the pi0s
317 correctedPi0s.clear();
318
319 int iDecayMode = -1;
320
322 {
323 Error("TauAnalysisTools::correctedPi0Vectors", "Failed to retrieve panTauDetail decay mode.");
324 return;
325 }
326
327 //Reading in the pi0 vector from createPi0Vectors
328 std::vector<TLorentzVector> vPi0s;
329 createPi0Vectors(xTau,vPi0s);
330
332 //Adding up Pi0 P4s from createPi0Vectors
333 TLorentzVector Sum_vPi0s;
334 for(unsigned int i = 0; i < vPi0s.size() ; i++){
335 Sum_vPi0s += vPi0s[i];
336 }
337
338 //Get sum of the chargedPFO (i.e. tau track) p4
339 TLorentzVector Sum_ChrgPFOP4;
340 for(const xAOD::TauTrack* track : xTau->tracks()) {
341 Sum_ChrgPFOP4 += track->track()->p4();
342 }
343
344 //Get tau FinalCalib P4 (explicitly requiring p4(xAOD::TauJetParameters::TauCalibType::FinalCalib) should be superfluous, as FinalCalib is the default p4)
345 TLorentzVector FinalCalibP4 = xTau->p4();
346
347 //Calculate the difference 3-vector between FinalCalib and Sum of chargedPFOP4
348 double px = FinalCalibP4.Px() - Sum_ChrgPFOP4.Px();
349 double py = FinalCalibP4.Py() - Sum_ChrgPFOP4.Py();
350 double pz = FinalCalibP4.Pz() - Sum_ChrgPFOP4.Pz();
351
352 double p_correctedPi0s = std::sqrt( std::pow(px,2.) + std::pow(py,2.) + std::pow(pz,2.) );
353 double p_vPi0s = Sum_vPi0s.P();
354
355 //Calucate scale factor for the pi0 3-vector momentum
356 double X = p_correctedPi0s/p_vPi0s;
357
358 //Scale the pi0s with X and recalculate the new pi0 energy
359 double px_scaled, py_scaled, pz_scaled, e;
361 for(unsigned int i = 0; i < vPi0s.size() ; i++){
362 px_scaled = vPi0s[i].Px() * X;
363 py_scaled = vPi0s[i].Py() * X;
364 pz_scaled = vPi0s[i].Pz() * X;
365 e = std::sqrt( std::pow(px_scaled,2.) + std::pow(py_scaled,2.) + std::pow(pz_scaled,2.) + std::pow(mPi0,2.) );
366
367 //Append the corrected pi0P4 to correctedPi0s
368 TLorentzVector P4_correctedPi0s;
369 P4_correctedPi0s.SetPxPyPzE(px_scaled,py_scaled,pz_scaled,e);
370 correctedPi0s.push_back(P4_correctedPi0s);
371 }
372 }else{
373 correctedPi0s = std::move(vPi0s);
374 }
375
376 //Correct angles between pi0s for 1pXn decays with 1 cluster
377 if(iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1pXn && xTau->nPi0PFOs() == 1){
378
379 //Get Function of Delta R between the two Pi0s
380 TF1 DeltaRdist("DeltaRdist", "pol3", 0, 67500);
381 DeltaRdist.SetParameter(0, 0.07924);
382 DeltaRdist.SetParameter(1, -2.078/1000000.);
383 DeltaRdist.SetParameter(2, 2.619/100000000000.);
384 DeltaRdist.SetParameter(3, -1.238/10000000000000000.);
385
386 //Get Sum of pi0 P4.Pt()
387 TLorentzVector SumPi0_P4;
388 for( unsigned int i = 0 ; i < correctedPi0s.size() ; i++){
389 SumPi0_P4 += correctedPi0s[i];
390 }
391
392 float SumPi0_pt = SumPi0_P4.Pt();
393
394 //Get delta R value (mean of true DeltaR distribution)
395 float deltaR;
396 if(SumPi0_pt >= 67500){
397 deltaR = 0.020; // = DeltaRdist.Eval(67500);
398 } else{
399 deltaR = DeltaRdist.Eval(SumPi0_pt);
400 }
401
402 TLorentzVector correctedPi0_0, correctedPi0_1;
403 correctedPi0_0.SetPtEtaPhiM( correctedPi0s[0].Pt()/cos(0.5*deltaR/std::sqrt(2.0)), correctedPi0s[0].Eta()+0.5*deltaR/std::sqrt(2.0), correctedPi0s[0].Phi()+0.5*deltaR/std::sqrt(2.0), correctedPi0s[0].M() );
404 correctedPi0_1.SetPtEtaPhiM( correctedPi0s[1].Pt()/cos(0.5*deltaR/std::sqrt(2.0)), correctedPi0s[1].Eta()-0.5*deltaR/std::sqrt(2.0), correctedPi0s[1].Phi()-0.5*deltaR/std::sqrt(2.0), correctedPi0s[1].M() );
405
406 std::vector<TLorentzVector> AngleCorrectedPi0s;
407 AngleCorrectedPi0s.push_back(correctedPi0_0);
408 AngleCorrectedPi0s.push_back(correctedPi0_1);
409
410 //Reparametrise: Delta R -> mass of pi0 Cluster
411 TLorentzVector PionCluster_angleCorrected = AngleCorrectedPi0s[0]+AngleCorrectedPi0s[1];
412
413 double dNewMomentum = std::sqrt(PionCluster_angleCorrected.E()/2. * PionCluster_angleCorrected.E()/2. - PionCluster_angleCorrected.M() / 2. * PionCluster_angleCorrected.M() / 2.);
414 correctedPi0s[0].SetVectM(PionCluster_angleCorrected.Vect() * (dNewMomentum / PionCluster_angleCorrected.P()), PionCluster_angleCorrected.M() / 2.);
415 correctedPi0s[1] = correctedPi0s[0];
416 }
417
418 //Calculate the new tau P4
419 for(const xAOD::TauTrack* track : xTau->tracks()) {
420 TauP4 += track->track()->p4();
421 }
422
423 for(unsigned int iPi0=0; iPi0 < correctedPi0s.size(); iPi0++) {
424 TauP4 += correctedPi0s[iPi0];
425 }
426
427}
428
429//______________________________________________________________________________
431{
433 static const SG::ConstAccessor< Link_t > accTruthParticleLink("truthParticleLink");
434 if (!accTruthParticleLink.isAvailable(xTau))
435 Error("TauAnalysisTools::getTruthParticleType", "No truth match information available. Please run TauTruthMatchingTool first.");
436
437 const xAOD::TruthParticle* xTruthParticle = xAOD::TauHelpers::getTruthParticle(&xTau);
438 if (xTruthParticle)
439 {
440 if (xTruthParticle->isTau())
441 {
442 static const SG::ConstAccessor<char> accIsHadronicTau("IsHadronicTau");
443 if (static_cast<bool>(accIsHadronicTau(*xTruthParticle)))
444 return TruthHadronicTau;
445 else
446 return TruthLeptonicTau;
447 }
448 if (xTruthParticle->isMuon())
449 return TruthMuon;
450 if (xTruthParticle->isElectron())
451 return TruthElectron;
452 }
453
454 // TODO: use const xAOD::Jet* xTruthJet = xAOD::TauHelpers::getLink<xAOD::Jet>(&xTau, "truthJetLink");
455 // currently it is unavailable as templated class is not in icc file
456 static const SG::ConstAccessor< ElementLink< xAOD::JetContainer > > accTruthJetLink("truthJetLink");
457 const ElementLink< xAOD::JetContainer > lTruthParticleLink = accTruthJetLink(xTau);
458 if (lTruthParticleLink.isValid())
459 return TruthJet;
460
461 return Unknown;
462}
463
465{
466 static const SG::ConstAccessor<char> accIsTruthHadronic("IsTruthHadronic");
467 if (!accIsTruthHadronic.isAvailable(xDiTau))
468 Error("TauAnalysisTools::getTruthParticleType", "No truth match information available. Please run DiTauTruthMatchingTool first");
469
470 TruthMatchedParticleType eTruthMatchedParticleType = Unknown;
471
472 if (accIsTruthHadronic(xDiTau))
473 eTruthMatchedParticleType = TruthHadronicDiTau;
474
475 return eTruthMatchedParticleType;
476}
477
478namespace
479{
480// Recursively search through ancestor chain to find b, c, light hadron
481// origin. Higher-priority classifications found further up the chain override
482// lower ones. Priority: b-hadron (1) > c-hadron (2) > light hadron (3) > none
483// (0). If e.g. a charm hadron came from a b hadron, assign class 1.
484int classifyAncestor(const xAOD::TruthParticle* particle, std::set<const xAOD::TruthParticle *>& visited)
485{
486 if (!particle || visited.count(particle))
487 return 0; // no classification
488 visited.insert(particle);
489
490 // Classify this particle
491 int thisClass = 0;
492
493 if (particle->isBottomHadron())
494 thisClass = 1;
495 else if (particle->isCharmHadron())
496 thisClass = 2;
497 else if (particle->isLightHadron())
498 thisClass = 3;
499
500 // Guard against going all the way back up to the beam
501 if (particle->nParents() == 0)
502 return thisClass;
503
504 // Recurse into parents; ancestors further up override current classification
505 int bestClass = thisClass;
506 const xAOD::TruthParticle *grandparent = particle->parent(0);
507 // Also if nParents > 1 this is a sign that we've gone past the hadron that
508 // produced the tau, so shouldn't recurse
509 if (particle->nParents() == 1)
510 {
511 int ancClass = classifyAncestor(grandparent, visited);
512 // A non-zero ancestor class with higher priority (lower number, but >0) overrides
513 if (ancClass > 0 && (bestClass == 0 || ancClass <= bestClass))
514 bestClass = ancClass;
515 }
516 return bestClass;
517}
518}
519
521{
522 // Guard against missing truth match information
524 static const SG::ConstAccessor< Link_t > accTruthParticleLink("truthParticleLink");
525 if (!accTruthParticleLink.isAvailable(xTau))
526 Error("TauAnalysisTools::tauOrigin", "No truth match information available. Please run TauTruthMatchingTool first.");
527
528 // Loop over truth particles to get truth tau candidate
529 const xAOD::TruthParticle* xTruthCandidate = xAOD::TauHelpers::getTruthParticle(&xTau);
530 // Check if xTruthCandidate has just a single tau parent --> generator
531 // correction, so replace xTruthCandidate with its parent
532 if (xTruthCandidate)
533 {
534 // Keep following tau parents (generator corrections) until we reach a tau
535 // with a non-tau parent. The set stops a self-referential truth record from
536 // looping forever.
537 std::set<const xAOD::TruthParticle *> seen;
538 while (seen.insert(xTruthCandidate).second)
539 {
540 const xAOD::TruthParticle* parent = xTruthCandidate->parent(0);
541 // No recorded parent: the ancestry can't be followed, so no hadron origin can be found
542 if (!parent)
543 return 0;
544 if (parent->pdgId() == xTruthCandidate->pdgId())
545 xTruthCandidate = parent;
546 else
547 break;
548 }
549 }
550 else return -1;
551
552 // Classify the hadron origin of the truth tau from its ancestor chain
553 std::set<const xAOD::TruthParticle *> visited;
554 return classifyAncestor(xTruthCandidate, visited);
555}
556
557std::vector<const xAOD::TauJet*> TauAnalysisTools::combineTauJetsWithMuonRM(const xAOD::TauJetContainer* taus_std, const xAOD::TauJetContainer* taus_muonRM){
561 // std::string message = "found " + std::to_string(taus_muonRM->size()) + " muon-removal taus";
562 // Info("TauAnalysisTools::getTauJetsWithMuonRM", message.c_str());
563 std::vector<const xAOD::TauJet*> taus_murm_vec(taus_muonRM->begin(), taus_muonRM->end());
564 std::vector<const xAOD::TauJet*> taus_combined;
566 originalTauJetAcc ("originalTauJet");
567 for(const xAOD::TauJet* tau_std : *taus_std){
568 auto replacement_itr = std::find_if(taus_murm_vec.begin(), taus_murm_vec.end(),
569 [&](const xAOD::TauJet* tau_murm){
570 auto link_to_ori_tau = originalTauJetAcc (*tau_murm);
571 if (!link_to_ori_tau.isValid()) { return false; }
572 if (*link_to_ori_tau == tau_std){ return true; }
573 return false;
574 }
575 );
576 if (replacement_itr == taus_murm_vec.end()) { taus_combined.push_back(tau_std); }
577 else {
578 // message = "replacement found at TauJets_MuonRM index " + std::to_string((*replacement_itr)->index()) + " for TauJets index " + std::to_string(tau_std->index());
579 // Info("TauAnalysisTools::getTauJetsWithMuonRM", message.c_str());
580 taus_combined.push_back(*replacement_itr);
581 taus_murm_vec.erase(replacement_itr);
582 // message = std::to_string(taus_murm_vec.size()) + " muon-removal taus left";
583 // Info("TauAnalysisTools::getTauJetsWithMuonRM", message.c_str());
584 }
585 }
586 // Every muon-removal tau should have been used, otherwise there is a problem.
587 assert(taus_murm_vec.empty());
588 return taus_combined;
589}
Scalar deltaR(const MatrixBase< Derived > &vec) const
ATLAS-specific HepMC functions.
static Double_t P(Double_t *tt, Double_t *par)
ElementLink< xAOD::TruthParticleContainer > Link_t
A number of constexpr particle constants to avoid hardcoding them directly in various places.
@ Phi
Definition RPCdef.h:8
@ Eta
Definition RPCdef.h:8
if(pathvar)
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition PFO_v1.cxx:95
double etaFinalCalib() const
const PFO * pi0PFO(size_t i) const
Get the pointer to a given pi0 PFO associated with this tau.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition TauJet_v3.cxx:96
size_t nPi0PFOs() const
Get the number of pi0 PFO particles associated with this tau.
double ptFinalCalib() const
bool panTauDetail(TauJetParameters::PanTauDetails panTauDetail, int &value) const
Get and set values of pantau details variables via enum.
std::vector< const TauTrack * > tracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
Get the v<const pointer> to a given tauTrack collection associated with this tau.
int pdgId() const
PDG ID code.
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
bool isElectron() const
Whether the particle is an electron (or positron).
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
bool isTau() const
Whether the particle is a tau (or antitau).
bool isMuon() const
Whether the particle is a muon (or antimuon).
static const int PI0
static const int KPLUS
static const int PIPLUS
constexpr double piZeroMassInMeV
the mass of the pi zero (in MeV)
double finalTauEta(const xAOD::TauJet &xTau)
return MVA based tau eta
int tauOrigin(const xAOD::TauJet &xTau)
return truth origin class of the tau: -1 no truth match, 0 no hadron ancestor, 1 b-hadron,...
TruthMatchedParticleType getTruthParticleType(const xAOD::TauJet &xTau)
return TauJet match type
void split(const std::string &sInput, const char cDelim, std::vector< std::string > &vOut)
double finalTauPt(const xAOD::TauJet &xTau)
return MVA based tau pt in GeV
std::vector< const xAOD::TauJet * > combineTauJetsWithMuonRM(const xAOD::TauJetContainer *taus_std, const xAOD::TauJetContainer *taus_muonRM)
combine the standard taujets container with the muon removal container
void correctedPi0Vectors(const xAOD::TauJet *xTau, std::vector< TLorentzVector > &correctedPi0s, TLorentzVector &TauP4)
double finalTauAbsEta(const xAOD::TauJet &xTau)
return MVA based absolute tau eta
void createPi0Vectors(const xAOD::TauJet *xTau, std::vector< TLorentzVector > &vPi0s)
int getNTauDecayParticles(const xAOD::TruthParticle &xTruthTau, int iPdgId, bool bCompareAbsoluteValues)
Count truth matched decay particles of a particular PDGID.
double truthVisTauPt(const xAOD::TauJet &xTau)
return truth match visible tau pt in GeV (if hadronic truth tau match)
double truthTauAbsEta(const xAOD::TauJet &xTau)
return truth match tau eta (if hadronic truth tau match)
bool testFileForEOFContainsCharacters(const std::string &sFileName)
returns true if last line in file is empty or the line starts with the number sign
double truthDecayMode(const xAOD::TauJet &xTau)
return truth decay mode (if hadronic truth tau match)
xAOD::TauJetParameters::DecayMode getTruthDecayMode(const xAOD::TruthParticle &xTruthTau)
Get the Truth Decay Mode from TruthTau particle.
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle *, bool debug=false)
return the truthParticle associated to the given IParticle (if any)
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17
TauTrack_v1 TauTrack
Definition of the current version.
Definition TauTrack.h:16
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17
TruthParticle_v1 TruthParticle
Typedef to implementation.
DiTauJet_v1 DiTauJet
Definition of the current version.
Definition DiTauJet.h:17
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".