From ebcfa783c69a94fa181104c76c2ef71529a59dd5 Mon Sep 17 00:00:00 2001
From: juhofer <judith.hoefer@cern.ch>
Date: Mon, 29 Mar 2021 16:40:11 +0200
Subject: [PATCH] Remove old unused track-truth method.

---
 .../JetTagDQA/src/BTaggingValidationPlots.cxx | 68 -------------------
 .../JetTagDQA/src/BTaggingValidationPlots.h   |  2 -
 2 files changed, 70 deletions(-)

diff --git a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx
index 3e2963845719..e221059c3f57 100644
--- a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx
@@ -102,74 +102,6 @@ namespace JetTagDQA{
     return val;
   }
 
-  // util function to check if a truth particle has a B, C or tau somewhere in its upstream
-  bool BTaggingValidationPlots::foundUpstream(const xAOD::TruthParticle& particle, std::string check_for){
-    // check if the check_for is a valid input
-    if(check_for != "B" && check_for != "C" && check_for != "T"){
-      throw std::invalid_argument("particle type " + check_for + " not allowed.");
-    }
-    // get the parent particle
-    const xAOD::TruthParticle* parent = particle.parent();
-    // if there is no parent we haven't found anything, return false
-    if(!parent){
-      return false;
-    } else {
-    // otherwise check if the parent is what we're looking for
-      bool found_it = false;
-      if(check_for == "B") found_it = parent->isBottomHadron();
-      if(check_for == "C") found_it = parent->isCharmHadron();
-      if(check_for == "T") found_it = (parent->absPdgId() == 15);
-      // if yes return true
-      if(found_it) return true;
-      // else go further up
-      else return BTaggingValidationPlots::foundUpstream(*parent, check_for);
-    }
-  }
-
-
-  // util function to get track truth origin
-  std::string BTaggingValidationPlots::getTrackOrigin(const xAOD::TrackParticle& track){
-
-    // get the truth particle from the track (if existent)
-    const xAOD::TruthParticle* truth = NULL;
-    if(track.isAvailable<ElementLink<xAOD::TruthParticleContainer> >("truthParticleLink") ) {
-      ElementLink<xAOD::TruthParticleContainer> link = track.auxdata<ElementLink<xAOD::TruthParticleContainer> >("truthParticleLink");
-      if(link.isValid()){
-        truth = *link;
-      }
-    }
-
-    // tracks having no valid truth link: pileup
-    if(!truth) return "P";
-
-    // get the truth matching probability
-    float truth_prob = -1;
-    try{
-      truth_prob = track.auxdata<float>("truthMatchProbability");
-    } catch (...) { };
-
-    // if we have no sufficient matching probability it's a fake
-    if(truth_prob < m_truthMatchProbabilityCut){
-      return "fake";
-    }
-
-    // all particles with barcode > 200000 are from interaction 
-    if(truth->barcode() > 200000) return "I";
-
-    // if the truth particle is a B hadron or has one upstream it's for sure a B associated track
-    if(truth->isBottomHadron() || foundUpstream(*truth, "B")) return "B";
-
-    // if the truth particle is a C hadron or C decay product and there is no B upstream it's a prompt C
-    // the !foundUpstream(.., "B") chech should never be true here (leave it in for physics)
-    if((truth->isCharmHadron() || foundUpstream(*truth, "C")) && !foundUpstream(*truth, "B")) return "C";
-
-    // check for tau
-    if(truth->absPdgId() == 15 || foundUpstream(*truth, "T")) return "T";
-
-    // the rest then is fragementation 
-    return "F";
-  }
-
   // util function to fill the tagger discriminant related histograms
   void BTaggingValidationPlots::fillDiscriminantHistograms(const std::string& tagger_name, const double& discriminant_value, const std::map<std::string, double>& working_points, const int& truth_label, std::map<std::string, TH1*>::const_iterator hist_iter, std::map<std::string, int>::const_iterator label_iter, const bool& pass_nTracksCut, const double& jet_pT, const double& jet_Lxy, const bool& onZprime){
     // check if the current histogram is to be filled with this tagger discriminant
diff --git a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h
index f63d8ae7edb5..3dae44a66c6d 100644
--- a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h
+++ b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h
@@ -642,8 +642,6 @@ namespace JetTagDQA{
       TH1* bookHistogram(std::string histo_name, std::string var_name, std::string part = "", std::string prefix = "");
       TProfile* bookProfile(std::string histo_name, std::string var_name, std::string part = "", std::string prefix = "");
       int getTrackHits(const xAOD::TrackParticle& part, xAOD::SummaryType info);
-      bool foundUpstream(const xAOD::TruthParticle& particle, std::string check_for);
-      std::string getTrackOrigin(const xAOD::TrackParticle& track);
       void fillDiscriminantHistograms(const std::string& tagger_name, const double& discriminant_value, const std::map<std::string, double>& working_points, const int& truth_label, std::map<std::string, TH1*>::const_iterator hist_iter, std::map<std::string, int>::const_iterator label_iter, const bool& pass_nTracksCut, const double& jet_pT, const double& jet_Lxy, const bool& onZprime);
       void bookDiscriminantVsPTAndLxyHistograms(const std::string& tagger_name, const std::map<std::string, double>& workingPoints, const bool& isOldTagger, std::map<std::string, int>::const_iterator label_iter, const std::string& m_sParticleType);
       template <class T>
-- 
GitLab