ATLAS Offline Software
Loading...
Searching...
No Matches
TauAnalysisTools Namespace Reference

Classes

class  BuildTruthTaus
class  BuildTruthTausAlg
class  CommonDiTauEfficiencyTool
class  CommonDiTauSmearingTool
class  CommonEfficiencyTool
class  CommonSmearingTool
class  DiTauEfficiencyCorrectionsTool
class  DiTauSelectionCut
class  DiTauSelectionCutAbsCharge
class  DiTauSelectionCutAbsEta
class  DiTauSelectionCutNSubjets
class  DiTauSelectionCutOmniIDWP
class  DiTauSelectionCutOmniScore
class  DiTauSelectionCutPt
class  DiTauSelectionTool
class  DiTauSmearingTool
class  DiTauTruthMatchingTool
class  IBuildTruthTaus
class  IDiTauEfficiencyCorrectionsTool
class  IDiTauSelectionTool
 Interface for tau selector tool. More...
class  IDiTauSmearingTool
class  IDiTauTruthMatchingTool
class  ITauEfficiencyCorrectionsTool
class  ITauSelectionTool
 Interface for tau selector tool. More...
class  ITauSmearingTool
class  ITauTruthMatchingTool
class  ITauTruthTrackMatchingTool
class  TauAnalysisToolsExampleAthena
class  TauEfficiencyCorrectionsTool
class  TauSelectionCut
class  TauSelectionCutAbsCharge
class  TauSelectionCutAbsEta
class  TauSelectionCutEleIDWP
class  TauSelectionCutGNTauScoreSigTrans
class  TauSelectionCutJetIDWP
class  TauSelectionCutMuonOLR
class  TauSelectionCutNTracks
class  TauSelectionCutPt
class  TauSelectionCutRNNEleScoreSigTrans
class  TauSelectionCutRNNJetScoreSigTrans
class  TauSelectionTool
class  TauSmearingTool
class  TauTruthMatchingTool
class  TauTruthTrackMatchingTool
class  TruthParticleTypeAccessor
 accessor for the truth particle type of a tau More...

Enumerations

enum  JetID {
  JETIDNONEUNCONFIGURED = 0 , JETIDNONE = 1 , JETIDBDTVERYLOOSE = 2 , JETIDBDTLOOSE = 3 ,
  JETIDBDTMEDIUM = 4 , JETIDBDTTIGHT = 5 , JETIDRNNVERYLOOSE = 6 , JETIDRNNLOOSE = 7 ,
  JETIDRNNMEDIUM = 8 , JETIDRNNTIGHT = 9 , JETIDGNTAUVERYLOOSE = 10 , JETIDGNTAULOOSE = 11 ,
  JETIDGNTAUMEDIUM = 12 , JETIDGNTAUTIGHT = 13
}
enum  OmniID {
  OMNIIDNONE = 0 , OMNIIDVERYLOOSE = 1 , OMNIIDLOOSE = 2 , OMNIIDMEDIUM = 3 ,
  OMNIIDTIGHT = 4
}
enum  EleID {
  ELEIDNONEUNCONFIGURED = 0 , ELEIDNONE = 1 , ELEIDRNNLOOSE = 2 , ELEIDRNNMEDIUM = 3 ,
  ELEIDRNNTIGHT = 4
}
enum  SelectionCuts {
  NoCut = 0 , CutPt = 1 , CutAbsEta = 1<<1 , CutPhi = 1<<2 ,
  CutNTrack = 1<<3 , CutAbsCharge = 1<<4 , CutJetIDWP = 1<<5 , CutEleRNNScoreSigTrans = 1<<6 ,
  CutEleIDWP = 1<<7 , CutMuonOLR = 1<<8 , CutJetRNNScoreSigTrans = 1<<9 , CutGNTauScoreSigTrans = 1<<10
}
enum  DiTauSelectionCuts {
  NoDiTauCut = 0 , DiTauCutPt = 1 , DiTauCutAbsEta = 1<<1 , DiTauCutNSubjets = 1<<2 ,
  DiTauCutAbsCharge = 1<<3 , DiTauCutOmniScore = 1<<4 , DiTauCutOmniIDWP = 1<<5
}
enum  EfficiencyCorrectionType {
  SFRecoHadTau = 0 , SFJetIDHadTau = 4 , SFEleIDHadTau = 8 , SFEleIDElectron = 10 ,
  SFTriggerHadTau = 12 , SFDecayModeHadTau = 16
}
enum  EfficiencyCorrectionSystematicType { STAT = 1 , SYST = 2 }
enum  TruthMatchedParticleType {
  Unknown = 0 , TruthHadronicTau = 1 , TruthLeptonicTau = 2 , TruthMuon = 3 ,
  TruthElectron = 4 , TruthJet = 5 , TruthHadronicDiTau = 6
}
enum  TrackType_t {
  UnclassifiedTrack = 0 , TauTrack = 1 , ConversionTrack = 2 , UnderlyingEventTrack = 3 ,
  SecondaryTrack = 4 , PileupTrack = 5 , FakeTrack = 6
}

Functions

double TruthLeadPt (const xAOD::DiTauJet &xDiTau)
 return the truth vis pT of the leading pT matched particle.
double TruthSubleadPt (const xAOD::DiTauJet &xDiTau)
 return the truth vis pT of the subleading pT matched particle.
double TruthDeltaR (const xAOD::DiTauJet &xDiTau)
 return the dR of between the leading and subleading pT matched particle.
void split (const std::string &sInput, const char cDelim, std::vector< std::string > &vOut)
void split (TEnv &rEnv, const std::string &sIn, const char cDelim, std::vector< std::string > &vOut)
void split (TEnv &rEnv, const std::string &sIn, const char cDelim, std::vector< size_t > &vOut)
void split (TEnv &rEnv, const std::string &sIn, const char cDelim, std::vector< int > &vOut)
void split (TEnv &rEnv, const std::string &sIn, const char cDelim, std::vector< unsigned > &vOut)
void split (TEnv &rEnv, const std::string &sIn, const char cDelim, std::vector< float > &vOut)
void split (TEnv &rEnv, const std::string &sIn, const char cDelim, std::vector< double > &vOut)
double finalTauPt (const xAOD::TauJet &xTau)
 return MVA based tau pt in GeV
double finalTauEta (const xAOD::TauJet &xTau)
 return MVA based tau eta
double finalTauAbsEta (const xAOD::TauJet &xTau)
 return MVA based absolute tau eta
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)
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.
xAOD::TauJetParameters::DecayMode getTruthDecayMode (const xAOD::TauJet &xTau)
 Get the Truth Decay Mode from TruthTau particle.
int getNTauDecayParticles (const xAOD::TruthParticle &xTruthTau, int iPdgId, bool bCompareAbsoluteValues)
 Count truth matched decay particles of a particular PDGID.
bool testFileForEOFContainsCharacters (const std::string &sFileName)
 returns true if last line in file is empty or the line starts with the number sign
void createPi0Vectors (const xAOD::TauJet *xTau, std::vector< TLorentzVector > &vPi0s)
void correctedPi0Vectors (const xAOD::TauJet *xTau, std::vector< TLorentzVector > &correctedPi0s, TLorentzVector &TauP4)
TruthMatchedParticleType getTruthParticleType (const xAOD::TauJet &xTau)
 return TauJet match type
TruthMatchedParticleType getTruthParticleType (const xAOD::DiTauJet &xDiTau)
 return DiTauJet match type
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

Detailed Description

Author
Nils Krumnack

Enumeration Type Documentation

◆ DiTauSelectionCuts

◆ EfficiencyCorrectionSystematicType

◆ EfficiencyCorrectionType

Enumerator
SFRecoHadTau 
SFJetIDHadTau 
SFEleIDHadTau 
SFEleIDElectron 
SFTriggerHadTau 
SFDecayModeHadTau 

Definition at line 75 of file PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h.

76 {
77 SFRecoHadTau = 0,
78 // SFRecoJet = 1,
79 // SFRecoElectron = 2,
80 // SFRecoMuon = 3,
81
82 SFJetIDHadTau = 4,
83 // SFJetIDJet = 5,
84 // SFJetIDElectron = 6,
85 // SFJetIDMuon = 7,
86
87 SFEleIDHadTau = 8,
88 // SFEleIDJet = 9,
89 SFEleIDElectron = 10,
90 // SFEleIDMuon = 11,
91
92 SFTriggerHadTau = 12,
93 // SFEleIDJet = 13,
94 // SFEleIDElectron = 14,
95 // SFEleIDMuon = 15,
96
98 };

◆ EleID

◆ JetID

Enumerator
JETIDNONEUNCONFIGURED 
JETIDNONE 
JETIDBDTVERYLOOSE 
JETIDBDTLOOSE 
JETIDBDTMEDIUM 
JETIDBDTTIGHT 
JETIDRNNVERYLOOSE 
JETIDRNNLOOSE 
JETIDRNNMEDIUM 
JETIDRNNTIGHT 
JETIDGNTAUVERYLOOSE 
JETIDGNTAULOOSE 
JETIDGNTAUMEDIUM 
JETIDGNTAUTIGHT 

Definition at line 11 of file PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h.

12 {
14 JETIDNONE = 1,
16 JETIDBDTLOOSE = 3,
18 JETIDBDTTIGHT = 5,
20 JETIDRNNLOOSE = 7,
22 JETIDRNNTIGHT = 9,
24 JETIDGNTAULOOSE = 11,
26 JETIDGNTAUTIGHT = 13,
27 };

◆ OmniID

◆ SelectionCuts

Enumerator
NoCut 
CutPt 
CutAbsEta 
CutPhi 
CutNTrack 
CutAbsCharge 
CutJetIDWP 
CutEleRNNScoreSigTrans 
CutEleIDWP 
CutMuonOLR 
CutJetRNNScoreSigTrans 
CutGNTauScoreSigTrans 

Definition at line 47 of file PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/Enums.h.

48 {
49 // FIXME: harmonise names for RNN score cuts: "CutEleRNNScore" vs "CutJetRNNScoreSigTrans"
50 NoCut = 0, // 000000000000
51 CutPt = 1, // 000000000001
52 CutAbsEta = 1<<1, // 000000000010
53 CutPhi = 1<<2, // 000000000100
54 CutNTrack = 1<<3, // 000000001000
55 CutAbsCharge = 1<<4, // 000000010000
56 CutJetIDWP = 1<<5, // 000000100000
57 CutEleRNNScoreSigTrans = 1<<6, // 000001000000
58 CutEleIDWP = 1<<7, // 000010000000
59 CutMuonOLR = 1<<8, // 000100000000
60 CutJetRNNScoreSigTrans = 1<<9, // 001000000000
61 CutGNTauScoreSigTrans = 1<<10 // 010000000000
62 };

◆ TrackType_t

Enumerator
UnclassifiedTrack 
TauTrack 
ConversionTrack 
UnderlyingEventTrack 
SecondaryTrack 
PileupTrack 
FakeTrack 

Definition at line 27 of file TauTruthTrackMatchingTool.h.

28{
29 UnclassifiedTrack = 0, // Track is unclassified
30 TauTrack = 1, // Track is from direct tau decay
31 ConversionTrack = 2, // Track is from conversion
32 UnderlyingEventTrack = 3, // Track is from underlying event
33 SecondaryTrack = 4, // Track is a secondary track
34 PileupTrack = 5, // Track is from pileup
35 FakeTrack = 6 // Track is a fake
36};

◆ TruthMatchedParticleType

Function Documentation

◆ combineTauJetsWithMuonRM()

std::vector< const xAOD::TauJet * > TauAnalysisTools::combineTauJetsWithMuonRM ( const xAOD::TauJetContainer * taus_std,
const xAOD::TauJetContainer * taus_muonRM )

combine the standard taujets container with the muon removal container

Special function to combine the muon-removed taus with the standard taus. This can impact your MET calculation and OLR. You will know if you need this, otherwise please consult TauCP group.

Definition at line 477 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

477 {
481 // std::string message = "found " + std::to_string(taus_muonRM->size()) + " muon-removal taus";
482 // Info("TauAnalysisTools::getTauJetsWithMuonRM", message.c_str());
483 std::vector<const xAOD::TauJet*> taus_murm_vec(taus_muonRM->begin(), taus_muonRM->end());
484 std::vector<const xAOD::TauJet*> taus_combined;
486 originalTauJetAcc ("originalTauJet");
487 for(const xAOD::TauJet* tau_std : *taus_std){
488 auto replacement_itr = std::find_if(taus_murm_vec.begin(), taus_murm_vec.end(),
489 [&](const xAOD::TauJet* tau_murm){
490 auto link_to_ori_tau = originalTauJetAcc (*tau_murm);
491 if (!link_to_ori_tau.isValid()) { return false; }
492 if (*link_to_ori_tau == tau_std){ return true; }
493 return false;
494 }
495 );
496 if (replacement_itr == taus_murm_vec.end()) { taus_combined.push_back(tau_std); }
497 else {
498 // message = "replacement found at TauJets_MuonRM index " + std::to_string((*replacement_itr)->index()) + " for TauJets index " + std::to_string(tau_std->index());
499 // Info("TauAnalysisTools::getTauJetsWithMuonRM", message.c_str());
500 taus_combined.push_back(*replacement_itr);
501 taus_murm_vec.erase(replacement_itr);
502 // message = std::to_string(taus_murm_vec.size()) + " muon-removal taus left";
503 // Info("TauAnalysisTools::getTauJetsWithMuonRM", message.c_str());
504 }
505 }
506 // Every muon-removal tau should have been used, otherwise there is a problem.
507 assert(taus_murm_vec.empty());
508 return taus_combined;
509}
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.
TauJet_v3 TauJet
Definition of the current "tau version".
Definition TauJet.h:17

◆ correctedPi0Vectors()

void TauAnalysisTools::correctedPi0Vectors ( const xAOD::TauJet * xTau,
std::vector< TLorentzVector > & correctedPi0s,
TLorentzVector & TauP4 )

Definition at line 314 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

314 {
315 //reset the pi0s
316 correctedPi0s.clear();
317
318 int iDecayMode = -1;
319
321 {
322 Error("TauAnalysisTools::correctedPi0Vectors", "Failed to retrieve panTauDetail decay mode.");
323 return;
324 }
325
326 //Reading in the pi0 vector from createPi0Vectors
327 std::vector<TLorentzVector> vPi0s;
328 createPi0Vectors(xTau,vPi0s);
329
331 //Adding up Pi0 P4s from createPi0Vectors
332 TLorentzVector Sum_vPi0s;
333 for(unsigned int i = 0; i < vPi0s.size() ; i++){
334 Sum_vPi0s += vPi0s[i];
335 }
336
337 //Get sum of the chargedPFO (i.e. tau track) p4
338 TLorentzVector Sum_ChrgPFOP4;
339 for(const xAOD::TauTrack* track : xTau->tracks()) {
340 Sum_ChrgPFOP4 += track->track()->p4();
341 }
342
343 //Get tau FinalCalib P4 (explicitly requiring p4(xAOD::TauJetParameters::TauCalibType::FinalCalib) should be superfluous, as FinalCalib is the default p4)
344 TLorentzVector FinalCalibP4 = xTau->p4();
345
346 //Calculate the difference 3-vector between FinalCalib and Sum of chargedPFOP4
347 double px = FinalCalibP4.Px() - Sum_ChrgPFOP4.Px();
348 double py = FinalCalibP4.Py() - Sum_ChrgPFOP4.Py();
349 double pz = FinalCalibP4.Pz() - Sum_ChrgPFOP4.Pz();
350
351 double p_correctedPi0s = std::sqrt( std::pow(px,2.) + std::pow(py,2.) + std::pow(pz,2.) );
352 double p_vPi0s = Sum_vPi0s.P();
353
354 //Calucate scale factor for the pi0 3-vector momentum
355 double X = p_correctedPi0s/p_vPi0s;
356
357 //Scale the pi0s with X and recalculate the new pi0 energy
358 double px_scaled, py_scaled, pz_scaled, e;
360 for(unsigned int i = 0; i < vPi0s.size() ; i++){
361 px_scaled = vPi0s[i].Px() * X;
362 py_scaled = vPi0s[i].Py() * X;
363 pz_scaled = vPi0s[i].Pz() * X;
364 e = std::sqrt( std::pow(px_scaled,2.) + std::pow(py_scaled,2.) + std::pow(pz_scaled,2.) + std::pow(mPi0,2.) );
365
366 //Append the corrected pi0P4 to correctedPi0s
367 TLorentzVector P4_correctedPi0s;
368 P4_correctedPi0s.SetPxPyPzE(px_scaled,py_scaled,pz_scaled,e);
369 correctedPi0s.push_back(P4_correctedPi0s);
370 }
371 }else{
372 correctedPi0s = std::move(vPi0s);
373 }
374
375 //Correct angles between pi0s for 1pXn decays with 1 cluster
376 if(iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1pXn && xTau->nPi0PFOs() == 1){
377
378 //Get Function of Delta R between the two Pi0s
379 TF1 DeltaRdist("DeltaRdist", "pol3", 0, 67500);
380 DeltaRdist.SetParameter(0, 0.07924);
381 DeltaRdist.SetParameter(1, -2.078/1000000.);
382 DeltaRdist.SetParameter(2, 2.619/100000000000.);
383 DeltaRdist.SetParameter(3, -1.238/10000000000000000.);
384
385 //Get Sum of pi0 P4.Pt()
386 TLorentzVector SumPi0_P4;
387 for( unsigned int i = 0 ; i < correctedPi0s.size() ; i++){
388 SumPi0_P4 += correctedPi0s[i];
389 }
390
391 float SumPi0_pt = SumPi0_P4.Pt();
392
393 //Get delta R value (mean of true DeltaR distribution)
394 float deltaR;
395 if(SumPi0_pt >= 67500){
396 deltaR = 0.020; // = DeltaRdist.Eval(67500);
397 } else{
398 deltaR = DeltaRdist.Eval(SumPi0_pt);
399 }
400
401 TLorentzVector correctedPi0_0, correctedPi0_1;
402 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() );
403 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() );
404
405 std::vector<TLorentzVector> AngleCorrectedPi0s;
406 AngleCorrectedPi0s.push_back(correctedPi0_0);
407 AngleCorrectedPi0s.push_back(correctedPi0_1);
408
409 //Reparametrise: Delta R -> mass of pi0 Cluster
410 TLorentzVector PionCluster_angleCorrected = AngleCorrectedPi0s[0]+AngleCorrectedPi0s[1];
411
412 double dNewMomentum = std::sqrt(PionCluster_angleCorrected.E()/2. * PionCluster_angleCorrected.E()/2. - PionCluster_angleCorrected.M() / 2. * PionCluster_angleCorrected.M() / 2.);
413 correctedPi0s[0].SetVectM(PionCluster_angleCorrected.Vect() * (dNewMomentum / PionCluster_angleCorrected.P()), PionCluster_angleCorrected.M() / 2.);
414 correctedPi0s[1] = correctedPi0s[0];
415 }
416
417 //Calculate the new tau P4
418 for(const xAOD::TauTrack* track : xTau->tracks()) {
419 TauP4 += track->track()->p4();
420 }
421
422 for(unsigned int iPi0=0; iPi0 < correctedPi0s.size(); iPi0++) {
423 TauP4 += correctedPi0s[iPi0];
424 }
425
426}
Scalar deltaR(const MatrixBase< Derived > &vec) const
@ Phi
Definition RPCdef.h:8
@ Eta
Definition RPCdef.h:8
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.
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.
constexpr double piZeroMassInMeV
the mass of the pi zero (in MeV)
void createPi0Vectors(const xAOD::TauJet *xTau, std::vector< TLorentzVector > &vPi0s)
TauTrack_v1 TauTrack
Definition of the current version.
Definition TauTrack.h:16

◆ createPi0Vectors()

void TauAnalysisTools::createPi0Vectors ( const xAOD::TauJet * xTau,
std::vector< TLorentzVector > & vPi0s )

Definition at line 252 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

253{
254 // reset the pi0s
255 vPi0s.clear();
256
257 // Since the PFO links as they come out of reconstruction, only correspond to
258 // calorimeter clusters, whereas we want the consts_pi0 vectors to correspond
259 // to real pi0s, we need to be careful to collect the PFOs correctly to pi0s
260 // for the cases where number of pi0s does not match to the decay mode:
261 size_t iNumPi0PFO = xTau->nPi0PFOs();
262
263 int iDecayMode = -1;
264
266 {
267 Error("TauAnalysisTools::createPi0Vectors", "Failed to retrieve panTauDetail decay mode.");
268 return;
269 }
270
271 if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1p1n && iNumPi0PFO > 1)
272 {
273 // float fMassPi0 = ParticleConstants::piZeroMassInMeV;
275
276 // combine both photons (with 0 mass from Pantau) to one pi0 vector:
277 const xAOD::PFO* xPfo1 = xTau->pi0PFO(0);
278 const xAOD::PFO* xPfo2 = xTau->pi0PFO(1);
279 vPi0s.push_back(xPfo1->p4() + xPfo2->p4());
280
281 // re-set the mass to one pi0:
282 double dNewMomentum = std::sqrt(vPi0s[0].E() * vPi0s[0].E() - fMassPi0Squared);
283 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
284 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
285 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
286 vPi0s[0].E());
287 }
288 else if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1pXn && iNumPi0PFO == 1)
289 {
290 // make a single pi0 from a PFO that contains two pi0s:
291 const xAOD::PFO* xPfo = xTau->pi0PFO(0);
292 // add the 2-pi0 vector preliminarily to the pi0vector:
293 vPi0s.push_back(xPfo->p4());
294
295 // re-set the mass back to one pi0:
296 double dNewMomentum = std::sqrt(vPi0s[0].E() / 2 * vPi0s[0].E() / 2 - vPi0s[0].M() / 2. * vPi0s[0].M() / 2.);
297 vPi0s[0].SetVectM(vPi0s[0].Vect() * (dNewMomentum / vPi0s[0].P()), vPi0s[0].M() / 2.);
298
299 // create another pi0 from the same vector:
300 vPi0s.push_back(vPi0s[0]);
301 }
302 else
303 {
304 // if it's not any of the special cases above then just collect the PFOs:
305 for (size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++)
306 {
307 vPi0s.push_back(xTau->pi0PFO(iPFO)->p4());
308 }
309 }
310}
static Double_t P(Double_t *tt, Double_t *par)
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition PFO_v1.cxx:95
const PFO * pi0PFO(size_t i) const
Get the pointer to a given pi0 PFO associated with this tau.
PFO_v1 PFO
Definition of the current "pfo version".
Definition PFO.h:17

◆ finalTauAbsEta()

double TauAnalysisTools::finalTauAbsEta ( const xAOD::TauJet & xTau)

return MVA based absolute tau eta

Definition at line 104 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

105{
106 // return MVA based absolute tau eta
107 return std::abs(xTau.etaFinalCalib());
108}
double etaFinalCalib() const

◆ finalTauEta()

double TauAnalysisTools::finalTauEta ( const xAOD::TauJet & xTau)

return MVA based tau eta

Definition at line 97 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

98{
99 // return MVA based tau eta
100 return xTau.etaFinalCalib();
101}

◆ finalTauPt()

double TauAnalysisTools::finalTauPt ( const xAOD::TauJet & xTau)

return MVA based tau pt in GeV

Definition at line 90 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

91{
92 // return MVA based tau pt in GeV
93 return xTau.ptFinalCalib()/GeV;
94}
double ptFinalCalib() const

◆ getNTauDecayParticles()

int TauAnalysisTools::getNTauDecayParticles ( const xAOD::TruthParticle & xTruthTau,
int iPdgId,
bool bCompareAbsoluteValues )

Count truth matched decay particles of a particular PDGID.

Parameters
xTruthTauTruthTau
iPdgIdPDGID to count over
bCompareAbsoluteValuestrue to ignore pdgid charge
Returns
int

Definition at line 192 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

193{
194 int iNum = 0;
195 static const SG::ConstAccessor<std::vector<int> > accDecayModeVector("DecayModeVector");
196 if (!accDecayModeVector.isAvailable(xTruthTau))
197 {
198 Warning("TauAnalysisTools::getNTauDecayParticles", "passed truth particle is not a truth tau, return 0");
199 return 0;
200 }
201
202 for(auto iPdgId2 : accDecayModeVector(xTruthTau))
203 if (!bCompareAbsoluteValues)
204 {
205 if (iPdgId2 == iPdgId) iNum++;
206 }
207 else
208 {
209 if (std::abs(iPdgId2) == std::abs(iPdgId)) iNum++;
210 }
211 return iNum;
212}

◆ getTruthDecayMode() [1/2]

xAOD::TauJetParameters::DecayMode TauAnalysisTools::getTruthDecayMode ( const xAOD::TauJet & xTau)

Get the Truth Decay Mode from TruthTau particle.

check hadronic truth match and get getTruthDecayMode from truth particle

Definition at line 147 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

148{
150
151 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
152 if (xTruthTau!=nullptr && accIsHadronicTau(*xTruthTau))
153 return getTruthDecayMode(*xTruthTau);
154 else
156}
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)
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ getTruthDecayMode() [2/2]

xAOD::TauJetParameters::DecayMode TauAnalysisTools::getTruthDecayMode ( const xAOD::TruthParticle & xTruthTau)

Get the Truth Decay Mode from TruthTau particle.

Counts p0 and charged Kaons and pions

Parameters
xTruthTauTruthParticle
Returns
xAOD::TauJetParameters::DecayMode
Note
Method returns Mode_Error if TruthParticle is not decorated as hadronic TruthTau

Definition at line 159 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

160{
161 static const SG::ConstAccessor<size_t> accNumCharged ("numCharged");
162 if (!(accNumCharged.isAvailable(xTruthTau)))
163 {
164 // passed truth particle is not a truth tau
166 }
167
168 int iCharged = getNTauDecayParticles(xTruthTau,MC::PIPLUS, true) + getNTauDecayParticles(xTruthTau,MC::KPLUS, true);
169 int iNeutral = getNTauDecayParticles(xTruthTau,MC::PI0, true);
170 if (iCharged == 1)
171 {
172 if (iNeutral == 0) return xAOD::TauJetParameters::DecayMode::Mode_1p0n;
173 if (iNeutral == 1) return xAOD::TauJetParameters::DecayMode::Mode_1p1n;
174 if (iNeutral >= 2) return xAOD::TauJetParameters::DecayMode::Mode_1pXn;
175 }
176 else if (iCharged == 3)
177 {
178 if (iNeutral == 0) return xAOD::TauJetParameters::DecayMode::Mode_3p0n;
179 if (iNeutral >= 1) return xAOD::TauJetParameters::DecayMode::Mode_3pXn;
180 }
181
182 if (iCharged == 2 or iCharged == 4 or iCharged == 5)
184 if (iCharged == 0 or iCharged >=6)
186
187 // if you got here, something should have gone wrong
189}
static const int PI0
static const int KPLUS
static const int PIPLUS
int getNTauDecayParticles(const xAOD::TruthParticle &xTruthTau, int iPdgId, bool bCompareAbsoluteValues)
Count truth matched decay particles of a particular PDGID.

◆ getTruthParticleType() [1/2]

TruthMatchedParticleType TauAnalysisTools::getTruthParticleType ( const xAOD::DiTauJet & xDiTau)

return DiTauJet match type

Definition at line 463 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

464{
465 static const SG::ConstAccessor<char> accIsTruthHadronic("IsTruthHadronic");
466 if (!accIsTruthHadronic.isAvailable(xDiTau))
467 Error("TauAnalysisTools::getTruthParticleType", "No truth match information available. Please run DiTauTruthMatchingTool first");
468
469 TruthMatchedParticleType eTruthMatchedParticleType = Unknown;
470
471 if (accIsTruthHadronic(xDiTau))
472 eTruthMatchedParticleType = TruthHadronicDiTau;
473
474 return eTruthMatchedParticleType;
475}

◆ getTruthParticleType() [2/2]

TruthMatchedParticleType TauAnalysisTools::getTruthParticleType ( const xAOD::TauJet & xTau)

return TauJet match type

Definition at line 429 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

430{
432 static const SG::ConstAccessor< Link_t > accTruthParticleLink("truthParticleLink");
433 if (!accTruthParticleLink.isAvailable(xTau))
434 Error("TauAnalysisTools::getTruthParticleType", "No truth match information available. Please run TauTruthMatchingTool first.");
435
436 const xAOD::TruthParticle* xTruthParticle = xAOD::TauHelpers::getTruthParticle(&xTau);
437 if (xTruthParticle)
438 {
439 if (xTruthParticle->isTau())
440 {
441 static const SG::ConstAccessor<char> accIsHadronicTau("IsHadronicTau");
442 if (static_cast<bool>(accIsHadronicTau(*xTruthParticle)))
443 return TruthHadronicTau;
444 else
445 return TruthLeptonicTau;
446 }
447 if (xTruthParticle->isMuon())
448 return TruthMuon;
449 if (xTruthParticle->isElectron())
450 return TruthElectron;
451 }
452
453 // TODO: use const xAOD::Jet* xTruthJet = xAOD::TauHelpers::getLink<xAOD::Jet>(&xTau, "truthJetLink");
454 // currently it is unavailable as templated class is not in icc file
455 static const SG::ConstAccessor< ElementLink< xAOD::JetContainer > > accTruthJetLink("truthJetLink");
456 const ElementLink< xAOD::JetContainer > lTruthParticleLink = accTruthJetLink(xTau);
457 if (lTruthParticleLink.isValid())
458 return TruthJet;
459
460 return Unknown;
461}
ElementLink< xAOD::TruthParticleContainer > Link_t
bool isElectron() const
Whether the particle is an electron (or positron).
bool isTau() const
Whether the particle is a tau (or antitau).
bool isMuon() const
Whether the particle is a muon (or antimuon).
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570

◆ split() [1/7]

void TauAnalysisTools::split ( const std::string & sInput,
const char cDelim,
std::vector< std::string > & vOut )

Definition at line 27 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

28{
29 std::stringstream sSS(sInput);
30 std::string sItem;
31 while (std::getline(sSS, sItem, cDelim))
32 vOut.push_back(sItem);
33}

◆ split() [2/7]

void TauAnalysisTools::split ( TEnv & rEnv,
const std::string & sIn,
const char cDelim,
std::vector< double > & vOut )

Definition at line 81 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

82{
83 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
84 std::string sItem;
85 while (std::getline(sSS, sItem, cDelim))
86 vOut.push_back(stod(sItem));
87}

◆ split() [3/7]

void TauAnalysisTools::split ( TEnv & rEnv,
const std::string & sIn,
const char cDelim,
std::vector< float > & vOut )

Definition at line 72 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

73{
74 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
75 std::string sItem;
76 while (std::getline(sSS, sItem, cDelim))
77 vOut.push_back(stof(sItem));
78}

◆ split() [4/7]

void TauAnalysisTools::split ( TEnv & rEnv,
const std::string & sIn,
const char cDelim,
std::vector< int > & vOut )

Definition at line 54 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

55{
56 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
57 std::string sItem;
58 while (std::getline(sSS, sItem, cDelim))
59 vOut.push_back(stoi(sItem));
60}

◆ split() [5/7]

void TauAnalysisTools::split ( TEnv & rEnv,
const std::string & sIn,
const char cDelim,
std::vector< size_t > & vOut )

Definition at line 45 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

46{
47 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
48 std::string sItem;
49 while (std::getline(sSS, sItem, cDelim))
50 vOut.push_back(size_t(stoi(sItem)));
51}

◆ split() [6/7]

void TauAnalysisTools::split ( TEnv & rEnv,
const std::string & sIn,
const char cDelim,
std::vector< std::string > & vOut )

Definition at line 36 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

37{
38 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
39 std::string sItem;
40 while (std::getline(sSS, sItem, cDelim))
41 vOut.push_back(sItem);
42}

◆ split() [7/7]

void TauAnalysisTools::split ( TEnv & rEnv,
const std::string & sIn,
const char cDelim,
std::vector< unsigned > & vOut )

Definition at line 63 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

64{
65 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
66 std::string sItem;
67 while (std::getline(sSS, sItem, cDelim))
68 vOut.push_back(stoi(sItem));
69}

◆ testFileForEOFContainsCharacters()

bool TauAnalysisTools::testFileForEOFContainsCharacters ( const std::string & sFileName)

returns true if last line in file is empty or the line starts with the number sign

Definition at line 215 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

216{
217 // returns true if last line in file is empty or the line starts with the
218 // number sign #
219
220 std::ifstream fInputFile;
221 fInputFile.open(sFileName);
222 if(!fInputFile.is_open())
223 return true;
224
225 fInputFile.seekg(-1,fInputFile.end);
226
227 bool bKeepLooping = true;
228 while(bKeepLooping)
229 {
230 char ch;
231 fInputFile.get(ch);
232
233 if(static_cast<int>(fInputFile.tellg()) <= 1)
234 {
235 fInputFile.seekg(0);
236 bKeepLooping = false;
237 }
238 else if(ch == '\n')
239 bKeepLooping = false;
240 else
241 fInputFile.seekg(-2,fInputFile.cur);
242 }
243
244 std::string sLastLine;
245 getline(fInputFile,sLastLine);
246 fInputFile.close();
247
248 return (sLastLine.size() == 0 or sLastLine[0] == '#');
249}

◆ truthDecayMode()

double TauAnalysisTools::truthDecayMode ( const xAOD::TauJet & xTau)

return truth decay mode (if hadronic truth tau match)

Definition at line 139 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

140{
141 // return truth tau decay mode.
142 int iDecayMode = getTruthDecayMode(xTau);
143 return static_cast<double>(iDecayMode);
144}

◆ TruthDeltaR()

double TauAnalysisTools::TruthDeltaR ( const xAOD::DiTauJet & xDiTau)

return the dR of between the leading and subleading pT matched particle.

Definition at line 463 of file CommonDiTauEfficiencyTool.cxx.

464{
465 // return truth taus distance delta R
466 static const SG::ConstAccessor< float > acc( "TruthVisDeltaR" );
467 return acc( xDiTau );
468}

◆ TruthLeadPt()

double TauAnalysisTools::TruthLeadPt ( const xAOD::DiTauJet & xDiTau)

return the truth vis pT of the leading pT matched particle.

Definition at line 447 of file CommonDiTauEfficiencyTool.cxx.

448{
449 // return leading truth tau pt in GeV
450 static const SG::ConstAccessor< float > acc( "TruthVisLeadPt" );
451 return acc( xDiTau ) * 0.001;
452}

◆ TruthSubleadPt()

double TauAnalysisTools::TruthSubleadPt ( const xAOD::DiTauJet & xDiTau)

return the truth vis pT of the subleading pT matched particle.

Definition at line 455 of file CommonDiTauEfficiencyTool.cxx.

456{
457 // return subleading truth tau pt in GeV
458 static const SG::ConstAccessor< float > acc( "TruthVisSubleadPt" );
459 return acc( xDiTau ) * 0.001;
460}

◆ truthTauAbsEta()

double TauAnalysisTools::truthTauAbsEta ( const xAOD::TauJet & xTau)

return truth match tau eta (if hadronic truth tau match)

Definition at line 125 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

126{
127 // return truth tau absolute eta
129
130 // if there is a truth tau return absolute eta, otherwise return -5 (getTruth will print an error)
131 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
132 if (xTruthTau!=nullptr && accIsHadronicTau (*xTruthTau))
133 return std::abs(xTruthTau->eta());
134 else
135 return -5.;
136}
virtual double eta() const override final
The pseudorapidity ( ) of the particle.

◆ truthVisTauPt()

double TauAnalysisTools::truthVisTauPt ( const xAOD::TauJet & xTau)

return truth match visible tau pt in GeV (if hadronic truth tau match)

Definition at line 111 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

112{
113 // return truth visible tau Pt in GeV
115
116 // if there is a truth tau return visible pT, otherwise return 0 (getTruth will print an error)
117 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
118 static const SG::ConstAccessor<double> accPtVis("pt_vis");
119 if (xTruthTau!=nullptr && accIsHadronicTau (*xTruthTau))
120 return (accPtVis(*xTruthTau)/GeV);
121 else
122 return 0.;
123}