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

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

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 473 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

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

◆ correctedPi0Vectors()

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

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

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

249{
250 // reset the pi0s
251 vPi0s.clear();
252
253 // Since the PFO links as they come out of reconstruction, only correspond to
254 // calorimeter clusters, whereas we want the consts_pi0 vectors to correspond
255 // to real pi0s, we need to be careful to collect the PFOs correctly to pi0s
256 // for the cases where number of pi0s does not match to the decay mode:
257 size_t iNumPi0PFO = xTau->nPi0PFOs();
258
259 int iDecayMode = -1;
260
262 {
263 Error("TauAnalysisTools::createPi0Vectors", "Failed to retrieve panTauDetail decay mode.");
264 return;
265 }
266
267 if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1p1n && iNumPi0PFO > 1)
268 {
269 // float fMassPi0 = ParticleConstants::piZeroMassInMeV;
271
272 // combine both photons (with 0 mass from Pantau) to one pi0 vector:
273 const xAOD::PFO* xPfo1 = xTau->pi0PFO(0);
274 const xAOD::PFO* xPfo2 = xTau->pi0PFO(1);
275 vPi0s.push_back(xPfo1->p4() + xPfo2->p4());
276
277 // re-set the mass to one pi0:
278 double dNewMomentum = std::sqrt(vPi0s[0].E() * vPi0s[0].E() - fMassPi0Squared);
279 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
280 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
281 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
282 vPi0s[0].E());
283 }
284 else if (iDecayMode == xAOD::TauJetParameters::DecayMode::Mode_1pXn && iNumPi0PFO == 1)
285 {
286 // make a single pi0 from a PFO that contains two pi0s:
287 const xAOD::PFO* xPfo = xTau->pi0PFO(0);
288 // add the 2-pi0 vector preliminarily to the pi0vector:
289 vPi0s.push_back(xPfo->p4());
290
291 // re-set the mass back to one pi0:
292 double dNewMomentum = std::sqrt(vPi0s[0].E() / 2 * vPi0s[0].E() / 2 - vPi0s[0].M() / 2. * vPi0s[0].M() / 2.);
293 vPi0s[0].SetVectM(vPi0s[0].Vect() * (dNewMomentum / vPi0s[0].P()), vPi0s[0].M() / 2.);
294
295 // create another pi0 from the same vector:
296 vPi0s.push_back(vPi0s[0]);
297 }
298 else
299 {
300 // if it's not any of the special cases above then just collect the PFOs:
301 for (size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++)
302 {
303 vPi0s.push_back(xTau->pi0PFO(iPFO)->p4());
304 }
305 }
306}
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 100 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

101{
102 // return MVA based absolute tau eta
103 return std::abs(xTau.etaFinalCalib());
104}
double etaFinalCalib() const

◆ finalTauEta()

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

return MVA based tau eta

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

94{
95 // return MVA based tau eta
96 return xTau.etaFinalCalib();
97}

◆ finalTauPt()

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

return MVA based tau pt in GeV

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

87{
88 // return MVA based tau pt in GeV
89 return xTau.ptFinalCalib()/GeV;
90}
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 188 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

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

◆ 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 143 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

144{
146
147 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
148 if (xTruthTau!=nullptr && accIsHadronicTau(*xTruthTau))
149 return getTruthDecayMode(*xTruthTau);
150 else
152}
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 155 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

156{
157 static const SG::ConstAccessor<size_t> accNumCharged ("numCharged");
158 if (!(accNumCharged.isAvailable(xTruthTau)))
159 {
160 // passed truth particle is not a truth tau
162 }
163
164 int iCharged = getNTauDecayParticles(xTruthTau,MC::PIPLUS, true) + getNTauDecayParticles(xTruthTau,MC::KPLUS, true);
165 int iNeutral = getNTauDecayParticles(xTruthTau,MC::PI0, true);
166 if (iCharged == 1)
167 {
168 if (iNeutral == 0) return xAOD::TauJetParameters::DecayMode::Mode_1p0n;
169 if (iNeutral == 1) return xAOD::TauJetParameters::DecayMode::Mode_1p1n;
170 if (iNeutral >= 2) return xAOD::TauJetParameters::DecayMode::Mode_1pXn;
171 }
172 else if (iCharged == 3)
173 {
174 if (iNeutral == 0) return xAOD::TauJetParameters::DecayMode::Mode_3p0n;
175 if (iNeutral >= 1) return xAOD::TauJetParameters::DecayMode::Mode_3pXn;
176 }
177
178 if (iCharged == 2 or iCharged == 4 or iCharged == 5)
180 if (iCharged == 0 or iCharged >=6)
182
183 // if you got here, something should have gone wrong
185}
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 459 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

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

◆ getTruthParticleType() [2/2]

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

return TauJet match type

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

426{
428 static const SG::ConstAccessor< Link_t > accTruthParticleLink("truthParticleLink");
429 if (!accTruthParticleLink.isAvailable(xTau))
430 Error("TauAnalysisTools::getTruthParticleType", "No truth match information available. Please run TauTruthMatchingTool first.");
431
432 const xAOD::TruthParticle* xTruthParticle = xAOD::TauHelpers::getTruthParticle(&xTau);
433 if (xTruthParticle)
434 {
435 if (xTruthParticle->isTau())
436 {
437 static const SG::ConstAccessor<char> accIsHadronicTau("IsHadronicTau");
438 if (static_cast<bool>(accIsHadronicTau(*xTruthParticle)))
439 return TruthHadronicTau;
440 else
441 return TruthLeptonicTau;
442 }
443 if (xTruthParticle->isMuon())
444 return TruthMuon;
445 if (xTruthParticle->isElectron())
446 return TruthElectron;
447 }
448
449 // TODO: use const xAOD::Jet* xTruthJet = xAOD::TauHelpers::getLink<xAOD::Jet>(&xTau, "truthJetLink");
450 // currently it is unavailable as templated class is not in icc file
451 static const SG::ConstAccessor< ElementLink< xAOD::JetContainer > > accTruthJetLink("truthJetLink");
452 const ElementLink< xAOD::JetContainer > lTruthParticleLink = accTruthJetLink(xTau);
453 if (lTruthParticleLink.isValid())
454 return TruthJet;
455
456 return Unknown;
457}
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)

◆ split() [1/7]

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

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

24{
25 std::stringstream sSS(sInput);
26 std::string sItem;
27 while (std::getline(sSS, sItem, cDelim))
28 vOut.push_back(sItem);
29}

◆ split() [2/7]

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

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

78{
79 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
80 std::string sItem;
81 while (std::getline(sSS, sItem, cDelim))
82 vOut.push_back(stod(sItem));
83}

◆ split() [3/7]

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

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

69{
70 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
71 std::string sItem;
72 while (std::getline(sSS, sItem, cDelim))
73 vOut.push_back(stof(sItem));
74}

◆ split() [4/7]

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

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

51{
52 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
53 std::string sItem;
54 while (std::getline(sSS, sItem, cDelim))
55 vOut.push_back(stoi(sItem));
56}

◆ split() [5/7]

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

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

42{
43 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
44 std::string sItem;
45 while (std::getline(sSS, sItem, cDelim))
46 vOut.push_back(size_t(stoi(sItem)));
47}

◆ split() [6/7]

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

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

33{
34 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
35 std::string sItem;
36 while (std::getline(sSS, sItem, cDelim))
37 vOut.push_back(sItem);
38}

◆ split() [7/7]

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

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

60{
61 std::stringstream sSS(rEnv.GetValue(sKey.c_str(),""));
62 std::string sItem;
63 while (std::getline(sSS, sItem, cDelim))
64 vOut.push_back(stoi(sItem));
65}

◆ 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 211 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

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

◆ truthDecayMode()

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

return truth decay mode (if hadronic truth tau match)

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

136{
137 // return truth tau decay mode.
138 int iDecayMode = getTruthDecayMode(xTau);
139 return static_cast<double>(iDecayMode);
140}

◆ TruthDeltaR()

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

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

Definition at line 336 of file CommonDiTauEfficiencyTool.cxx.

337{
338 // return truth taus distance delta R
339 static const SG::ConstAccessor< float > acc( "TruthVisDeltaR" );
340 return acc( xDiTau );
341}

◆ TruthLeadPt()

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

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

Definition at line 320 of file CommonDiTauEfficiencyTool.cxx.

321{
322 // return leading truth tau pt in GeV
323 static const SG::ConstAccessor< float > acc( "TruthVisLeadPt" );
324 return acc( xDiTau ) * 0.001;
325}

◆ TruthSubleadPt()

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

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

Definition at line 328 of file CommonDiTauEfficiencyTool.cxx.

329{
330 // return subleading truth tau pt in GeV
331 static const SG::ConstAccessor< float > acc( "TruthVisSubleadPt" );
332 return acc( xDiTau ) * 0.001;
333}

◆ truthTauAbsEta()

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

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

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

122{
123 // return truth tau absolute eta
125
126 // if there is a truth tau return absolute eta, otherwise return -5 (getTruth will print an error)
127 static const SG::ConstAccessor<char> accIsHadronicTau ("IsHadronicTau");
128 if (xTruthTau!=nullptr && accIsHadronicTau (*xTruthTau))
129 return std::abs(xTruthTau->eta());
130 else
131 return -5.;
132}
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 107 of file PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx.

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