diff --git a/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt b/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt index eed18a229f127c0de66144e824c73c5babbc4535..46cf6b861ee317679e1ca4bfcbecdf98696e5d36 100644 --- a/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt +++ b/PhysicsAnalysis/TauID/TauDQA/CMakeLists.txt @@ -29,5 +29,5 @@ atlas_add_component( TauDQA src/*.cxx src/components/*.cxx INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps AthenaMonitoringLib xAODEgamma xAODJet xAODTau xAODTruth TauHistUtils McParticleEvent TrkValHistUtils ) + LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps AthenaMonitoringLib xAODEgamma xAODJet xAODTau xAODTruth TauHistUtils McParticleEvent TrkValHistUtils TauAnalysisToolsLib ) diff --git a/PhysicsAnalysis/TauID/TauDQA/share/PhysValTau.h b/PhysicsAnalysis/TauID/TauDQA/share/PhysValTau.h index c2cf573d5d3652f791230d18080250e8ae46be47..a54e7a905bc469e1d9589a0e387a3f519bd8ac99 100644 --- a/PhysicsAnalysis/TauID/TauDQA/share/PhysValTau.h +++ b/PhysicsAnalysis/TauID/TauDQA/share/PhysValTau.h @@ -12,19 +12,17 @@ // FrameWork includes #include "GaudiKernel/ServiceHandle.h" +#include "AsgTools/ToolHandle.h" // Local includes #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "TauValidationPlots.h" -//#include "TauTools/TruthHandler.h" -//#include "TauTools/MatchingTools_depreciated.h" +#include "TauAnalysisTools/TauTruthMatchingTool.h" +#include "TauAnalysisTools/TauSelectionTool.h" #include <TLorentzVector.h> -//Additional includes -#include "TruthHandler.h" +//Additional includes #include "RecoTypes.h" -//#include "TauTools/MatchingTools.h" - // Forward declaration @@ -78,44 +76,18 @@ class PhysValTau std::string m_TauDetailsContainerName; std::string m_TruthParticleContainerName; - bool m_isMC; //!< Are we running over MC data? - - //Variable Definitiona - /** provides tools to match tau candidates to truth taus (from TauTools). */ - // MatchingTools matchtool; - /** is a cut applied to the Delta R variable. */ - float m_DeltaRMatchCut; - - /** is a threshold (cut) applied the pT of the leading charged pion. */ - float m_LeadingChPiPt_Threshold; - /** cuts used for truth matching to had taus*/ - float m_visETcut; - float m_visEtacut; - + bool m_isMC; //!< Are we running over MC data? - /** counts the number of truth taus. */ - int m_truth_all; + //Variable Definitions - /** counts the number of truth taus geometrically matched. */ - int m_truth_all_matched; - - /** counts the number of truth 1p taus. */ - int m_truth_1p; - - /** counts the number of truth taus geometrically matched and 1 track. */ - int m_truth_1p_matched; - - /** counts the number of truth 3p taus. */ - int m_truth_3p; - - /** counts the number of truth taus geometrically matched and 3 track. */ - int m_truth_3p_matched; - /*keeps track of matched tau jets*/ std::vector<size_t> m_matched_itr; - /** Object to define Truth Handler Tool*/ - TruthHandler m_truthHandler; + // Tool used for truth-matching + TauAnalysisTools::TauTruthMatchingTool m_truthTool; + // Tool used to select "primitive" and "nominal" taus + TauAnalysisTools::TauSelectionTool m_primTauSel; + TauAnalysisTools::TauSelectionTool m_nomiTauSel; //Histograms // general tau all prongs plots diff --git a/PhysicsAnalysis/TauID/TauDQA/share/TauValidationPlots.h b/PhysicsAnalysis/TauID/TauDQA/share/TauValidationPlots.h index e0fb155c62042279a89a38ff8de188c6cf6a193e..126cd4f772eb336d1f855119950356f19f5dfe1f 100644 --- a/PhysicsAnalysis/TauID/TauDQA/share/TauValidationPlots.h +++ b/PhysicsAnalysis/TauID/TauDQA/share/TauValidationPlots.h @@ -91,6 +91,35 @@ class TauValidationPlots:public PlotBase { //Migration Matrix plots Tau::Migration m_oMigrationPlots; + // Plots with the "nominal" tau selection + Tau::GeneralTauPlots m_oFakeGeneralNom; + Tau::Had1ProngPlots m_oFakeHad1ProngNom; + Tau::Had3ProngPlots m_oFakeHad3ProngNom; + Tau::EfficiencyPtPlots m_oFakeTauEffPlotsNom; + Tau::EfficiencyPtPlots m_oFakeTauEff1PPlotsNom; + Tau::EfficiencyPtPlots m_oFakeTauEff3PPlotsNom; + Tau::RecoTauPlots m_oFakeTauRecoTauPlotsNom; + Tau::NewCorePlots m_oNewCoreFakePlotsNom; + + Tau::GeneralTauPlots m_oRecoGeneralNom; + Tau::Had1ProngPlots m_oRecoHad1ProngNom; + Tau::Had3ProngPlots m_oRecoHad3ProngNom; + Tau::EfficiencyPtPlots m_oRecTauEffPlotsNom; + Tau::EfficiencyPtPlots m_oRecTauEff1PPlotsNom; + Tau::EfficiencyPtPlots m_oRecTauEff3PPlotsNom; + Tau::RecoTauPlots m_oRecTauRecoTauPlotsNom; + Tau::NewCorePlots m_oNewCoreRecTauPlotsNom; + + Tau::GeneralTauPlots m_oMatchedGeneralNom; + Tau::Had1ProngPlots m_oMatchedHad1ProngNom; + Tau::Had3ProngPlots m_oMatchedHad3ProngNom; + Tau::EfficiencyPtPlots m_oMatchedTauEffPlotsNom; + Tau::EfficiencyPtPlots m_oMatchedTauEff1PPlotsNom; + Tau::EfficiencyPtPlots m_oMatchedTauEff3PPlotsNom; + Tau::RecoTauPlots m_oMatchedTauRecoTauPlotsNom; + Tau::Migration m_oMigrationPlotsNom; + Tau::NewCorePlots m_oNewCoreMatchedPlotsNom; + }; diff --git a/PhysicsAnalysis/TauID/TauDQA/share/TruthHandler.h b/PhysicsAnalysis/TauID/TauDQA/share/TruthHandler.h deleted file mode 100644 index d6164617c2765a05122a03c5a2d5fc2e663f9dca..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TauID/TauDQA/share/TruthHandler.h +++ /dev/null @@ -1,179 +0,0 @@ -#ifndef TAUTRUTH_H -#define TAUTRUTH_H - -////////////////////////////////////////////////////////////////////////////////////// -/// Name : TruthHandler.h -/// Package : offline/PhysicsAnalysis/TauID/TauTools -/// Author : Jyothsna Komaragiri, Dugan O'Neil, Aldo Saavedra -/// Created : April 2008 -/// Modified: Feb 2009 by Aldo Saavedra, Added Atautau and SingleTau filters -/// -/// modified: Jennifer Godfrey -/// -/// modified by: Felix Friedrich, 2014 -/// -/// modified by: Guillermo Hamity, 2014 -/// -/// DESCRIPTION: -/// -/// This class contains methods to access truth tau information. It has methods to find the MC -/// truth tau, determine if it is hadronic, match to reco candidates, etc. -/// -////////////////////////////////////////////////////////////////////////////////////// -#include "McParticleEvent/TruthParticleContainer.h" -#include "xAODTruth/TruthParticleContainer.h" -#include "xAODTruth/TruthVertex.h" - -#include "HepPDT/ParticleData.hh" -#include "HepMC/GenEvent.h" -#include "HepMC/GenParticle.h" -#include "HepMC/GenVertex.h" -#include <vector> -#include "TLorentzVector.h" -#include <functional> -#include <algorithm> -#include <math.h> -#include "Gtypes.h" - -// FF,2014: -// this class is just a collection of free functions. Having them collected into a class is for backwards compatibility. -// in principle all of the methods can be moved to a namespace - -class TruthHandler { -public: - // let the compiler auto generate the constructor and destructor - //TruthHandler(); - //~TruthHandler(); - - /** determines if a particle is only a G4 particle */ - bool isGenerator(int barcode, int status); - bool isGenerator( const TruthParticle* part ) { return isGenerator(part->barcode(), part->status()); } - bool isGenerator( const HepMC::GenParticle* part ) { return isGenerator(part->barcode(), part->status()); } - bool isGenerator( const xAOD::TruthParticle* part) { return isGenerator(part->barcode(), part->status()); } - - /** determine if a particle is a final state stable particle */ - bool isGenStable( const HepMC::GenParticle* part ); - bool isGenStable( const xAOD::TruthParticle* part ); - - /** returns false if particle is only a reference particle in the generator. Also checks whether particle is intermediate (Status==2) or final state and stable (Status==1)*/ - bool isGoodStatus(int Status); - bool isGoodStatus(const HepMC::GenParticle* part, int StatusToCheck); - bool isGoodStatus(const xAOD::TruthParticle* part, int StatusToCheck); - - /** return true if xAODTruth particle as a child with pdgID==pdgIDtoCheck. Only direct children are checked. No iteration on children-of-children. */ - bool hasChild(const xAOD::TruthParticle* part, int pdgIDtoCheck); - - /** determines if a particle is Tau or not */ - bool isTauTruth( const TruthParticle* part ); - bool isTauTruth( const xAOD::TruthParticle* part ); - - /** determines if a particle is a true hadronic tau*/ - bool isHadTau(const HepMC::GenParticle* part, int Mother = -1 ); - bool isHadTau(const xAOD::TruthParticle* part, int Mother = -1 ); - bool isHadTau(const TruthParticle* part, int Mother = -1 ) { return isHadTau( (const HepMC::GenParticle*) part->genParticle(), Mother); } - - /** determine if a particle is charged pion, exclude those which come from kaon decays. */ - bool isGoodChrgPiDaughter(const HepMC::GenParticle* hadTau); - bool isGoodChrgPiDaughter(const xAOD::TruthParticle* hadTau); - - /** determine whether tau decay includes given pdg_ID particle as an intermediate (Status==2) or final state (Status==1) daughter*/ - bool isTauTypeDecay(const HepMC::GenParticle* part, int PDGID, int Status ); - bool isTauTypeDecay(const TruthParticle* part, int PDGID, int Status ) { return isTauTypeDecay( (const HepMC::GenParticle*) part->genParticle(), PDGID, Status); } - - /** determine whether tau decay is an electron decay*/ - bool isTauElecDecay(const HepMC::GenParticle* part ) { return isTauTypeDecay(part, 11, 1); } - bool isTauElecDecay(const TruthParticle* part ) { return isTauTypeDecay(part, 11, 1); } - - /** determine whether tau decay is a muon decay*/ - bool isTauMuonDecay(const HepMC::GenParticle* part ) { return isTauTypeDecay(part, 13, 1); } - bool isTauMuonDecay(const TruthParticle* part ) { return isTauTypeDecay(part, 13, 1); } - - /** determine whether tau decays directly to a rho (does not include a1->rho)*/ - bool isTauRhoDecay(const HepMC::GenParticle* part ) { return isTauTypeDecay(part, PDG::rho_plus, 2); } - bool isTauRhoDecay(const TruthParticle* part ) { return isTauTypeDecay(part, PDG::rho_plus, 2); } - - /** determine whether tau decays directly to an a1 particle */ - bool isTauA1Decay(const HepMC::GenParticle* part ) { return isTauTypeDecay(part, PDG::a_1_plus,2); } - bool isTauA1Decay(const TruthParticle* part ) { return isTauTypeDecay(part, PDG::a_1_plus,2); } - - /** determine if a particle is charged pion. */ - bool isPiChTruth( const TruthParticle* part ) { return ( abs((int)part->pdgId()) == PDG::pi_plus); } - - /** Loops through the truth taus in the event to determine if they are hadronic decays or not. - It returns a container of hadronic taus. Option to enforce the pdgID of the parent particle to be of type Mother. */ - TruthParticleContainer* getHadronicTruth(const TruthParticleContainer *mcpartTES, int Mother = -1 ); - xAOD::TruthParticleContainer* getHadronicTruth(const xAOD::TruthParticleContainer *mcpartTES, int Mother = -1 ); - - /**Handle tau truth information. Return a container of all truth taus - Option to enforce the pdgID of the parent particle to be of type Mother.**/ - TruthParticleContainer* getAllFinalTaus(const TruthParticleContainer *mcpartTES, int Mother=-1); - - /** provides the number of charged daughters (pions) in tau decays, does not include pions that come from kaons. - Will include charged kaons if UseKaon=true*/ - int nProngTruth(const HepMC::GenParticle* hadTau, bool UseKaon=true ); - int nProngTruth(const xAOD::TruthParticle* hadTau, bool UseKaon=true ); - int nProngTruthTau(const xAOD::TruthParticle* hadTau, bool UseKaon=true ); - int nProngTruth(const TruthParticle* hadTau, bool UseKaon=true ) { return nProngTruth( (const HepMC::GenParticle*)hadTau->genParticle(), UseKaon); } - - /** method to count no. of neutral pions */ - int numNeutPion(const HepMC::GenParticle* hadTau ); - int numNeutPion(const xAOD::TruthParticle* hadTau); - int numNeutPion( const TruthParticle* hadTau) { return numNeutPion( (const HepMC::GenParticle*)hadTau->genParticle() ); } - - /** method to count no. of neutral pions and get the pointer to pi+, rho+, a1+ */ - const TruthParticle* nPi0Truth( const TruthParticle* hadTau, int &nPi0 ); - - /** method to get a pointer to the intermediate daughter (either the pion, rho, or a1) */ - const TruthParticle* GetIntermDaughter(const TruthParticle* hadTau ); - - /** determines whether ``Daughter'' is a hadronic daughter of the decay of the ``TrueTau'', - (where status specifies intermediate daughter (Status==2) or final state daughter (Status==1))*/ - bool isHadTauDaughter(const HepMC::GenParticle* TruthTau,const HepMC::GenParticle* Daughter, int Status); - bool isHadTauDaughter(const TruthParticle* TruthTau,const TruthParticle* TruthDaughter, int Status) { return isHadTauDaughter( (const HepMC::GenParticle*) TruthTau->genParticle(), (const HepMC::GenParticle*) TruthDaughter->genParticle(), Status); } - bool isHadTauDaughter(const HepMC::GenEvent* TrueTauCollection, const HepMC::GenParticle* Daughter, int Status); - bool isHadTauDaughter(const TruthParticleContainer *TrueTauCollection,const TruthParticle* TruthDaughter, int Status); - - /** determines whether ``Daughter'' is a final stable daughter of the decay of the ``TrueTau'' */ - bool isHadTauFinalDaughter(const HepMC::GenParticle* TruthTau,const HepMC::GenParticle* Daughter) { return isHadTauDaughter(TruthTau,Daughter,1); } - bool isHadTauFinalDaughter(const TruthParticle* TruthTau,const TruthParticle* Daughter) { return isHadTauDaughter(TruthTau,Daughter,1); } - bool isHadTauFinalDaughter(const HepMC::GenEvent* TrueTauCollection, const HepMC::GenParticle* Daughter) { return isHadTauDaughter(TrueTauCollection, Daughter, 1); } - bool isHadTauFinalDaughter(const TruthParticleContainer *TrueTauCollection,const TruthParticle* Daughter) { return isHadTauDaughter(TrueTauCollection, Daughter, 1); } - - /** determines whether ``Daughter'' is an intermediate daughter of the decay of the ``TrueTau'' */ - bool isHadTauIntermDaughter(const HepMC::GenParticle* TruthTau,const HepMC::GenParticle* Daughter) { return isHadTauDaughter(TruthTau,Daughter,2); } - bool isHadTauIntermDaughter(const TruthParticle* TruthTau,const TruthParticle* Daughter) { return isHadTauDaughter(TruthTau,Daughter,2); } - bool isHadTauIntermDaughter(const HepMC::GenEvent* TrueTauCollection,const HepMC::GenParticle* Daughter) { return isHadTauDaughter(TrueTauCollection, Daughter, 2); } - bool isHadTauIntermDaughter(const TruthParticleContainer *TrueTauCollection, const TruthParticle* Daughter) { return isHadTauDaughter(TrueTauCollection, Daughter, 2); } - - /** returns a collection of the true intermediate daughters (Status==2) or final daughters (Status==2) - of the true hadronic tau*/ - TruthParticleContainer* getTrueHadDaughters(const TruthParticle *TrueTau, const TruthParticleContainer *mcpartTES, int Status); - - /** returns a collection of the true final daughters of the true hadronic tau*/ - TruthParticleContainer* getFinalTrueHadDaughters(const TruthParticle *TrueTau, const TruthParticleContainer *mcpartTES) { return getTrueHadDaughters(TrueTau, mcpartTES, 1); } - - /** returns a collection of the true intermediate daughters of the true hadronic tau*/ - TruthParticleContainer* getIntermTrueHadDaughters(const TruthParticle *TrueTau, const TruthParticleContainer *mcpartTES) { return getTrueHadDaughters(TrueTau, mcpartTES, 2); } - - /** returns a collection of the true hadronics taus which decay to nProngs */ - TruthParticleContainer* getHadronicnProngTruth(const TruthParticleContainer *mcpartTES, int nProngs); - - /** returns a collection of the true hadronics taus which decay to 1 Prong */ - TruthParticleContainer* getHadronic1ProngTruth(const TruthParticleContainer *mcpartTES) { return getHadronicnProngTruth(mcpartTES, 1); } - - /** returns a collection of the true hadronics taus which decay to 3 Prongs */ - TruthParticleContainer* getHadronic3ProngTruth(const TruthParticleContainer *mcpartTES) { return getHadronicnProngTruth(mcpartTES, 3); } - - /** This method adds the momentum of the daughter neutrinos of the tau, it is called recursively */ - CLHEP::HepLorentzVector sumDaughterNeutrinos( const TruthParticle *part ); - - /** Given a hadronic truth tau, calculate the visible Sum */ - CLHEP::HepLorentzVector getTauVisibleSumTruth( const TruthParticle* hadTau ); - TLorentzVector getTauVisibleSumTruth( const xAOD::TruthParticle* hadTau ); - - /** This method returns the HepLorentzVector of leading charged pion */ - CLHEP::HepLorentzVector getPiChTruth( const TruthParticle* hadTau ); - //CLHEP::HepLorentzVector getPiChTruth( const xAOD::TruthParticle* hadTau ); -}; - -#endif diff --git a/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx b/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx index f19b9314751079b768531a130e6f6b2545d5ea75..8188c5f3d9d9149949a27e136244425919499c11 100644 --- a/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx +++ b/PhysicsAnalysis/TauID/TauDQA/src/PhysValTau.cxx @@ -24,8 +24,7 @@ #include "xAODTruth/TruthParticleContainer.h" #include "xAODTruth/TruthParticle.h" #include "AthenaBaseComps/AthCheckMacros.h" -using CLHEP::GeV; -//namespace PhysVal { +#include "xAODRootAccess/TEvent.h" /////////////////////////////////////////////////////////////////// // Public methods: @@ -37,12 +36,15 @@ using CLHEP::GeV; PhysValTau::PhysValTau(const std::string& type, const std::string& name, const IInterface* parent) : - ManagedMonitorToolBase(type, name, parent) + ManagedMonitorToolBase(type, name, parent), + m_truthTool("TauTruthMatchingTool"), + m_primTauSel("PrimitiveTauSelectionTool"), + m_nomiTauSel("NominalTauSelectionTool") { declareProperty("TauContainerName", m_TauJetContainerName = "TauRecContainer"); declareProperty("TruthParticleContainerName", m_TruthParticleContainerName = "TruthParticle"); declareProperty("TauDetailsContainerName", m_TauDetailsContainerName = "TauRecDetailsContainer"); - declareProperty("isMC", m_isMC= false); + declareProperty("isMC", m_isMC = false); } // Destructor @@ -56,23 +58,32 @@ StatusCode PhysValTau::initialize() { ATH_MSG_INFO ("Initializing " << name() << "..."); ATH_CHECK(ManagedMonitorToolBase::initialize()); - - // geometrical matching between Reco Tau and MC tau - m_DeltaRMatchCut = 0.2; - m_LeadingChPiPt_Threshold = 0.0; - - //Truth Matching Cuts - m_visETcut = 10.; - m_visEtacut = 2.5; - - //Initialize Counters - m_truth_all = 0; - m_truth_1p = 0; - m_truth_3p = 0; - - m_truth_all_matched = 0; - m_truth_1p_matched = 0; - m_truth_3p_matched = 0; + + if ( m_isMC ) { + CHECK(m_truthTool.setProperty("TruthElectronContainerName", + "TruthElectrons")); + CHECK(m_truthTool.setProperty("TruthMuonContainerName", + "MuonTruthParticles")); + CHECK(m_truthTool.setProperty("WriteTruthTaus", true)); + CHECK(m_truthTool.sysInitialize()); + } + // setup a "primitive" tau selection tool with basically no cuts + CHECK(m_primTauSel.setProperty("PtMin",0.0)); + CHECK(m_primTauSel.setProperty("JetIDWP",int(TauAnalysisTools::JETIDNONE))); + CHECK(m_primTauSel.setProperty("EleOLR",false)); + CHECK(m_primTauSel.setProperty("NTracks",std::vector<int>{0,1,2,3,4,5})); + CHECK(m_primTauSel.setProperty("AbsCharges",std::vector<int>{0,1,2,3})); + CHECK(m_primTauSel.setProperty("AbsEtaRegion",std::vector<double>{0.0,10.0})); + m_primTauSel.msg().setLevel(MSG::DEBUG); + CHECK(m_primTauSel.initialize()); + // setup a "nominal" tau selection tool (just eta and pt cuts) + CHECK(m_nomiTauSel.setProperty("PtMin",20.0)); + CHECK(m_nomiTauSel.setProperty("JetIDWP",int(TauAnalysisTools::JETIDNONE))); + CHECK(m_nomiTauSel.setProperty("EleOLR",false)); + CHECK(m_nomiTauSel.setProperty("NTracks",std::vector<int>{0,1,2,3,4,5})); + CHECK(m_nomiTauSel.setProperty("AbsCharges",std::vector<int>{0,1,2,3})); + m_nomiTauSel.msg().setLevel(MSG::DEBUG); + CHECK(m_nomiTauSel.initialize()); return StatusCode::SUCCESS; } @@ -97,190 +108,164 @@ StatusCode PhysValTau::bookHistograms() StatusCode PhysValTau::fillHistograms() { - ATH_MSG_INFO ("Filling hists " << name() << "..."); - //////////////////////////////////////////////////////////////////////////////////////////////// - // Retrieve tau container: - const xAOD::TauJetContainer* taus = evtStore()->retrieve< const xAOD::TauJetContainer >( m_TauJetContainerName ); - if (!taus) { - ATH_MSG_ERROR ("Couldn't retrieve tau container with key: " << m_TauJetContainerName); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG( "Number of taus: " << taus->size() ); - - //////////////////////////////////////////////////////////////////////////////////////////////// - // Retrieve truth container: - const xAOD::TruthParticleContainer* truth = 0; - if (m_isMC){ - truth = evtStore()->retrieve< const xAOD::TruthParticleContainer >( m_TruthParticleContainerName ); - if (!truth) { - ATH_MSG_ERROR ("Couldn't retrieve tau container with key: " << m_TruthParticleContainerName); - return StatusCode::FAILURE; - } - // ATH_MSG_DEBUG( "Number of truth: " << truth->size() ); - } - ////////////////////////////////////////////////////////////////////////////////////////////////// - // Retrieve true hadronic tau container from truth container - // getHaderonicTruth finds true taus (ID == 15) with correct status and no leptonic decay. - const xAOD::TruthParticleContainer* trueTauContainer = 0; - if (m_isMC){ - trueTauContainer = m_truthHandler.getHadronicTruth(truth); - ATH_MSG_DEBUG( "Number of true had taus: " << trueTauContainer->size() ); - } - - - ////////////////////////////////////////// - // Plotting TauRec Variables - - // Loop through reco tau jet container - for (auto tau : *taus) { - if (m_detailLevel < 10) continue; - if (tau->pt()/GeV < 20) continue; - m_oTauValidationPlots->m_oRecoTauAllProngsPlots.fill(*tau); // Substructure/PFO histograms filled - m_oTauValidationPlots->m_oNewCorePlots.fill(*tau); // NewCore histograms filled - m_oTauValidationPlots->m_oRecTauEffPlots.fill(*tau); //Eff Reco Tau plots - m_oTauValidationPlots->m_oRecoGeneralTauAllProngsPlots.fill(*tau); //Reco Tau General Plots - if(tau->nTracks()==1){ - m_oTauValidationPlots->m_oRecoHad1ProngPlots.fill(*tau); //Reco Tau 1P plots - m_oTauValidationPlots->m_oRecTauEff1PPlots.fill(*tau); //Eff Reco Tau 1P plots - - } - if(tau->nTracks()==3){ - m_oTauValidationPlots->m_oRecoHad3ProngPlots.fill(*tau); //Reco Tau 3P plots - m_oTauValidationPlots->m_oRecTauEff3PPlots.fill(*tau); //Eff Reco Tau 3P plots - } - } - m_matched_itr.clear(); - ////////////////////////////////////////// - // Plotting TruthMatched Variables - // Loop through reco tau jet container - - // m_isMC=False; - - if(trueTauContainer != 0 && m_isMC==true){ - xAOD::TruthParticleContainer::const_iterator truth_itr = trueTauContainer->begin(); - xAOD::TruthParticleContainer::const_iterator truth_end = trueTauContainer->end(); - // std::cout<<"new true tau container"<<std::endl; - - for (; truth_itr != truth_end; truth_itr++) { - - ATH_MSG_DEBUG( "Trying to match tau :"); - xAOD::TruthParticle* trueTau = const_cast<xAOD::TruthParticle*>(*truth_itr); - const xAOD::TauJet *matchedRecTau = 0; - ATH_MSG_DEBUG("Matching Tau"); - bool matched = matchTrueAndRecoTau(taus,trueTau,matchedRecTau); - - if(matched) { - m_oTauValidationPlots->m_oGeneralTauAllProngsPlots.fill(*matchedRecTau); - m_oTauValidationPlots->m_oNewCoreMatchedPlots.fill(*matchedRecTau); // NewCore histograms filled - m_oTauValidationPlots->m_oMatchedTauAllProngsPlots.fill(*matchedRecTau); // Substructure/PFO histograms filled - m_oTauValidationPlots->m_oMatchedTauEffPlots.fill(*matchedRecTau); - - if(matchedRecTau->nTracks() == 1){ - m_oTauValidationPlots->m_oHad1ProngPlots.fill(*matchedRecTau); - m_oTauValidationPlots->m_oMatchedTauEff1PPlots.fill(*matchedRecTau); - - - } - if(matchedRecTau->nTracks() == 3){ - m_oTauValidationPlots->m_oHad3ProngPlots.fill(*matchedRecTau); - m_oTauValidationPlots->m_oMatchedTauEff3PPlots.fill(*matchedRecTau); - } - } - } - - // std::cout<<"Number of matched: "<<m_matched_itr.size()<<std::endl; - if(taus != 0){ - for (size_t iRecTau = 0 ; iRecTau < taus->size(); iRecTau++) { - bool alreadymatched = false; - if(m_matched_itr.size()>0) - for (size_t i = 0; i<m_matched_itr.size(); i++) - if(m_matched_itr.at(i) == iRecTau) alreadymatched = true; - if(alreadymatched)continue; - const xAOD::TauJet *recTau = taus->at(iRecTau); - if (m_detailLevel < 10) continue; - if (recTau->pt()/GeV < 20) continue; - bool eleMatch = false; - // Matching to electrons (Improvements needed) - for (auto mc_candidate : *truth) { - - if(abs(mc_candidate->pdgId())==11 && mc_candidate->pt()>10000.) - { - float dr = sqrt( (mc_candidate->eta()-recTau->eta())*(mc_candidate->eta()-recTau->eta()) + (mc_candidate->phi()-recTau->phi())*(mc_candidate->phi()-recTau->phi())); - if( dr < 0.2 ) { - eleMatch = true; - continue; - } - } - } - if(eleMatch){ - m_oTauValidationPlots->m_oElMatchedParamPlots.fill(*recTau); - - }else{ - m_oTauValidationPlots->m_oFakeGeneralTauAllProngsPlots.fill(*recTau); - m_oTauValidationPlots->m_oFakeTauAllProngsPlots.fill(*recTau); // Substructure/PFO histograms filled - m_oTauValidationPlots->m_oNewCoreFakePlots.fill(*recTau); // NewCore histograms filled - m_oTauValidationPlots->m_oFakeTauEffPlots.fill(*recTau); - if(recTau->nTracks()==1) - { - m_oTauValidationPlots->m_oFakeHad1ProngPlots.fill(*recTau); - m_oTauValidationPlots->m_oFakeTauEff1PPlots.fill(*recTau); - } - if(recTau->nTracks()==3) - { - m_oTauValidationPlots->m_oFakeTauEff3PPlots.fill(*recTau); - m_oTauValidationPlots->m_oFakeHad3ProngPlots.fill(*recTau); - } - - } - } + ATH_MSG_INFO ("Filling hists " << name() << "..."); + + // Retrieve tau container: + const xAOD::TauJetContainer* taus = evtStore() + ->retrieve<const xAOD::TauJetContainer>(m_TauJetContainerName); + if ( !taus ) { + ATH_MSG_ERROR("Couldn't retrieve tau container with key: " + << m_TauJetContainerName); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Number of taus: " << taus->size()); + + // Retrieve truth container: + const xAOD::TruthParticleContainer* truthParticles = 0; + if ( m_isMC ) { + truthParticles = evtStore()->retrieve<const xAOD::TruthParticleContainer>(m_TruthParticleContainerName); + if ( !truthParticles ) { + ATH_MSG_ERROR ("Couldn't retrieve tau container with key: " + << m_TruthParticleContainerName); + return StatusCode::FAILURE; + } + // ATH_MSG_DEBUG( "Number of truth: " << truth->size() ); + } + + // Loop through reco tau jet container + for (auto tau : *taus) { + if ( m_detailLevel < 10 ) continue; + if ( m_primTauSel.accept(*tau) ) continue; + asg::AcceptData nominal = m_nomiTauSel.accept(*tau); + + // fill histograms for reconstructed taus + m_oTauValidationPlots->m_oRecoTauAllProngsPlots.fill(*tau); + m_oTauValidationPlots->m_oNewCorePlots.fill(*tau); + m_oTauValidationPlots->m_oRecTauEffPlots.fill(*tau); + m_oTauValidationPlots->m_oRecoGeneralTauAllProngsPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oRecoGeneralNom.fill(*tau); + m_oTauValidationPlots->m_oRecTauEffPlotsNom.fill(*tau); + m_oTauValidationPlots->m_oRecTauRecoTauPlotsNom.fill(*tau); + m_oTauValidationPlots->m_oNewCoreRecTauPlotsNom.fill(*tau); + } + int recProng = tau->nTracks(); + if ( recProng == 1 ) { + m_oTauValidationPlots->m_oRecoHad1ProngPlots.fill(*tau); + m_oTauValidationPlots->m_oRecTauEff1PPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oRecoHad1ProngNom.fill(*tau); + m_oTauValidationPlots->m_oRecTauEff1PPlotsNom.fill(*tau); } } - if ( taus != 0 ) { - for ( size_t iRecTau = 0 ; iRecTau < taus->size(); iRecTau++ ) { - bool alreadymatched = false; - if ( m_matched_itr.size() > 0 ) { - for ( size_t i = 0; i < m_matched_itr.size(); i++ ) { - if(m_matched_itr.at(i) == iRecTau) alreadymatched = true; + else if ( recProng == 3 ) { + m_oTauValidationPlots->m_oRecoHad3ProngPlots.fill(*tau); + m_oTauValidationPlots->m_oRecTauEff3PPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oRecoHad3ProngNom.fill(*tau); + m_oTauValidationPlots->m_oRecTauEff3PPlotsNom.fill(*tau); + } + } + + // Don't fill truth and fake histograms if we are running on data. + if ( !m_isMC ) continue; + + ATH_MSG_DEBUG("Trying to truth-match tau"); + auto trueTau = m_truthTool.getTruth(*tau); + + // Fill truth and fake histograms + if ( (bool)tau->auxdata<char>("IsTruthMatched") ) { + ATH_MSG_DEBUG("Tau is truth-matched"); + // std::cout << "Truth pdgId = " << trueTau->pdgId() << std::endl; + if ( trueTau->isTau() ) { + if ( (bool)trueTau->auxdata<char>("IsHadronicTau") ) { + ATH_MSG_DEBUG("Tau is hadronic tau"); + m_oTauValidationPlots->m_oGeneralTauAllProngsPlots.fill(*tau); + m_oTauValidationPlots->m_oNewCoreMatchedPlots.fill(*tau); + // Substructure/PFO histograms + m_oTauValidationPlots->m_oMatchedTauAllProngsPlots.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauEffPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oMatchedGeneralNom.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauEffPlotsNom.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauRecoTauPlotsNom.fill(*tau); + m_oTauValidationPlots->m_oNewCoreMatchedPlotsNom.fill(*tau); } - } - if ( alreadymatched ) continue; - const xAOD::TauJet *recTau = taus->at(iRecTau); - if ( m_detailLevel < 10 ) continue; - if ( recTau->pt()/GeV < 20 ) continue; - bool eleMatch = false; - // Matching to electrons (Improvements needed) - for ( auto mc_candidate : *truth ) { - if ( abs(mc_candidate->pdgId())==11 && mc_candidate->pt()>10000. ) { - float dr = sqrt( (mc_candidate->eta()-recTau->eta())*(mc_candidate->eta()-recTau->eta()) - + (mc_candidate->phi()-recTau->phi())*(mc_candidate->phi()-recTau->phi())); - if( dr < 0.2 ) { - eleMatch = true; - continue; + if ( recProng == 1 ) { + m_oTauValidationPlots->m_oHad1ProngPlots.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauEff1PPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oMatchedHad1ProngNom.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauEff1PPlotsNom.fill(*tau); + } + } + else if ( recProng == 3 ) { + m_oTauValidationPlots->m_oHad3ProngPlots.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauEff3PPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oMatchedHad3ProngNom.fill(*tau); + m_oTauValidationPlots->m_oMatchedTauEff3PPlotsNom.fill(*tau); } } + + xAOD::TauJetParameters::DecayMode trueMode + = m_truthTool.getDecayMode(*trueTau); + m_oTauValidationPlots->m_oMigrationPlots.fill(*tau, trueMode); + if ( nominal ) { + m_oTauValidationPlots->m_oMigrationPlotsNom.fill(*tau, trueMode); + } } - // electron matched taus - if ( eleMatch ) { - m_oTauValidationPlots->m_oElMatchedParamPlots.fill(*recTau); - m_oTauValidationPlots->m_oElMatchedEVetoPlots.fill(*recTau); + } + } + else { + ATH_MSG_DEBUG("Tau is fake"); + // try to match to truth electrons + bool isElectron = false; + for ( auto truth : *truthParticles ) { + if ( abs(truth->pdgId()) != 11 ) continue; + if ( truth->status() != 1 ) continue; + if ( truth->pt() < 10000.0 ) continue; + if ( tau->p4().DeltaR(truth->p4()) > 0.2 ) continue; + std::cout << "Found electron!" << std::endl; + // OK, now it probably is an electron + isElectron = true; + break; + } + if ( isElectron ) { + m_oTauValidationPlots->m_oElMatchedParamPlots.fill(*tau); + m_oTauValidationPlots->m_oElMatchedEVetoPlots.fill(*tau); + } + else { // other fakes + m_oTauValidationPlots->m_oFakeGeneralTauAllProngsPlots.fill(*tau); + // Substructure/PFO histograms + m_oTauValidationPlots->m_oFakeTauAllProngsPlots.fill(*tau); + m_oTauValidationPlots->m_oNewCoreFakePlots.fill(*tau); + m_oTauValidationPlots->m_oFakeTauEffPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oFakeGeneralNom.fill(*tau); + m_oTauValidationPlots->m_oFakeTauEffPlotsNom.fill(*tau); + m_oTauValidationPlots->m_oFakeTauRecoTauPlotsNom.fill(*tau); + m_oTauValidationPlots->m_oNewCoreFakePlotsNom.fill(*tau); } - else { - m_oTauValidationPlots->m_oFakeGeneralTauAllProngsPlots.fill(*recTau); - // Substructure/PFO histograms - m_oTauValidationPlots->m_oFakeTauAllProngsPlots.fill(*recTau); - m_oTauValidationPlots->m_oNewCoreFakePlots.fill(*recTau); - m_oTauValidationPlots->m_oFakeTauEffPlots.fill(*recTau); - if ( recTau->nTracks()==1 ) { - m_oTauValidationPlots->m_oFakeHad1ProngPlots.fill(*recTau); - m_oTauValidationPlots->m_oFakeTauEff1PPlots.fill(*recTau); + if ( recProng == 1 ) { + m_oTauValidationPlots->m_oFakeHad1ProngPlots.fill(*tau); + m_oTauValidationPlots->m_oFakeTauEff1PPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oFakeHad1ProngNom.fill(*tau); + m_oTauValidationPlots->m_oFakeTauEff1PPlotsNom.fill(*tau); } - if ( recTau->nTracks()==3 ) { - m_oTauValidationPlots->m_oFakeTauEff3PPlots.fill(*recTau); - m_oTauValidationPlots->m_oFakeHad3ProngPlots.fill(*recTau); + } + if ( recProng == 3 ) { + m_oTauValidationPlots->m_oFakeTauEff3PPlots.fill(*tau); + m_oTauValidationPlots->m_oFakeHad3ProngPlots.fill(*tau); + if ( nominal ) { + m_oTauValidationPlots->m_oFakeHad3ProngNom.fill(*tau); + m_oTauValidationPlots->m_oFakeTauEff3PPlotsNom.fill(*tau); } } } } + } return StatusCode::SUCCESS; } @@ -291,60 +276,6 @@ StatusCode PhysValTau::procHistograms() return StatusCode::SUCCESS; } -bool PhysValTau::matchTrueAndRecoTau(const xAOD::TauJetContainer *&taus, const xAOD::TruthParticle *trueTau, const xAOD::TauJet *&matchedRecTau) -{ - std::vector< const xAOD::TruthParticle * > decayParticles; - int nCharged = 0; - int nNeutral = 0; - // RecoTypes::DecayMode trueDecayMode = getDecayMode(trueTau, decayParticles, nCharged, nNeutral); - - nCharged = m_truthHandler.nProngTruthTau(trueTau,false); - nNeutral = m_truthHandler.numNeutPion(trueTau); - RecoTypes::DecayMode trueDecayMode = RecoTypes::GetDecayMode(nCharged, nNeutral); - ATH_MSG_DEBUG( "True decay mode is " << nCharged << "p" << nNeutral << "n" ); - - if (!RecoTypes::IsValidMode(trueDecayMode)) { - ATH_MSG_DEBUG(" Decay mode is not valid, skipping..." ); - return false; - } - - TLorentzVector visSum = m_truthHandler.getTauVisibleSumTruth(trueTau); // Get visible TLV for true had tau - if ((visSum.Et()/GeV < m_visETcut) || (fabs(visSum.Eta()) > m_visEtacut)) return false; // Detector limitations - - double minDeltaR = m_DeltaRMatchCut; - bool matched = false; - size_t iMatchedRecTau = 0; - TLorentzVector hlv_matchedRecTau; - - for (size_t iRecTau = 0 ; iRecTau < taus->size(); iRecTau++) { - const xAOD::TauJet *recTau = taus->at(iRecTau); - double recPt = recTau->ptIntermediateAxis(); - double recEta = recTau->etaIntermediateAxis(); - double recPhi = recTau->phiIntermediateAxis(); - double recM = recTau->mIntermediateAxis(); - TLorentzVector hlv_recTau; - hlv_recTau.SetPtEtaPhiM(recPt, recEta, recPhi, recM); - - double curDeltaR = visSum.DeltaR(hlv_recTau); - if (curDeltaR < minDeltaR) { - minDeltaR = curDeltaR; - matchedRecTau = recTau; - hlv_matchedRecTau = hlv_recTau; - matched = true; - iMatchedRecTau = iRecTau; - } - } - - if(matched){ - const xAOD::TauJet *recTau = taus->at(iMatchedRecTau); - m_oTauValidationPlots->m_oMigrationPlots.fill(*recTau,nCharged,nNeutral); //Migration - m_matched_itr.push_back(iMatchedRecTau); - // std::cout<<"Number of matched between: "<<m_matched_itr.size()<<std::endl; - } - - return matched; -} - /////////////////////////////////////////////////////////////////// // Const methods: diff --git a/PhysicsAnalysis/TauID/TauDQA/src/TauValidationPlots.cxx b/PhysicsAnalysis/TauID/TauDQA/src/TauValidationPlots.cxx index 6e1e023c81219a9022434cdd3f2890ac478f019d..8b80c4553c905493a9603d9a681c1f6a5fb34ee0 100644 --- a/PhysicsAnalysis/TauID/TauDQA/src/TauValidationPlots.cxx +++ b/PhysicsAnalysis/TauID/TauDQA/src/TauValidationPlots.cxx @@ -6,33 +6,63 @@ TauValidationPlots::TauValidationPlots(PlotBase* pParent, std::string sDir, std::string sTauJetContainerName): PlotBase(pParent, sDir), - m_oGeneralTauAllProngsPlots(this, "Matched/", sTauJetContainerName), - m_oHad1ProngPlots(this, "Matched/Tau1P/", sTauJetContainerName), // tau1P plots : variables for tau ID - m_oHad3ProngPlots(this, "Matched/Tau3P/", sTauJetContainerName), // tau3P plots : variables for tau ID + // Plots with the "primitive" tau selection + m_oGeneralTauAllProngsPlots(this, "NoCuts/Matched/", sTauJetContainerName), + m_oHad1ProngPlots(this, "NoCuts/Matched/Tau1P/", sTauJetContainerName), // tau1P plots : variables for tau ID + m_oHad3ProngPlots(this, "NoCuts/Matched/Tau3P/", sTauJetContainerName), // tau3P plots : variables for tau ID m_oElMatchedParamPlots(this, "Electron/", sTauJetContainerName), // electron veto variables for electrons matching tau candidates m_oElMatchedEVetoPlots(this, "Electron/", sTauJetContainerName), // electron veto variables for electrons matching tau candidates - m_oFakeGeneralTauAllProngsPlots(this,"Fake/", sTauJetContainerName), // general tau all fake prongs plots - m_oFakeHad1ProngPlots(this,"Fake/Jet1P/", sTauJetContainerName), // tau1P fake plots : variables for tau ID - m_oFakeHad3ProngPlots(this,"Fake/Jet3P/", sTauJetContainerName), // tau3P fake plots : variables for tau ID - m_oRecoGeneralTauAllProngsPlots(this,"RecTau/All/",sTauJetContainerName),// "recTau_General"), // general tau all fake prongs plots - m_oRecoHad1ProngPlots(this,"RecTau/1P/", sTauJetContainerName),//"recTau_1P"), // tau1P fake plots : variables for tau ID - m_oRecoHad3ProngPlots(this,"RecTau/3P/", sTauJetContainerName),// "recTau_3P"), // tau3P fake plots : variables for tau ID - m_oRecoTauAllProngsPlots(this,"RecTau/PFOs/", sTauJetContainerName), // all tau reco, no match to truth - m_oMatchedTauAllProngsPlots(this,"Matched/PFOs/", sTauJetContainerName), - m_oFakeTauAllProngsPlots(this,"Fake/PFOs/", sTauJetContainerName), // all tau reco, no match to truth - m_oMatchedTauEffPlots (this,"Matched/Eff/All/", sTauJetContainerName), - m_oMatchedTauEff1PPlots(this,"Matched/Eff/Tau1P/", sTauJetContainerName), - m_oMatchedTauEff3PPlots(this,"Matched/Eff/Tau3P/", sTauJetContainerName), - m_oRecTauEffPlots (this,"RecTau/Eff/All/", sTauJetContainerName), - m_oRecTauEff1PPlots(this,"RecTau/Eff/Tau1P/", sTauJetContainerName), - m_oRecTauEff3PPlots(this,"RecTau/Eff/Tau3P/", sTauJetContainerName), - m_oFakeTauEffPlots (this,"Fake/Eff/All/", sTauJetContainerName), - m_oFakeTauEff1PPlots(this,"Fake/Eff/Tau1P/", sTauJetContainerName), - m_oFakeTauEff3PPlots(this,"Fake/Eff/Tau3P/", sTauJetContainerName), - m_oNewCorePlots(this,"RecTau/All/", sTauJetContainerName), // all tau reco, newCore variables - m_oNewCoreMatchedPlots(this,"Matched/All/", sTauJetContainerName), // all tau reco, newCore variables - m_oNewCoreFakePlots(this,"Fake/All/", sTauJetContainerName), // all tau reco, newCore variables - m_oMigrationPlots(this,"Matched/Migration/", sTauJetContainerName) // Migration Matrix + m_oFakeGeneralTauAllProngsPlots(this,"NoCuts/Fake/", sTauJetContainerName), // general tau all fake prongs plots + m_oFakeHad1ProngPlots(this,"NoCuts/Fake/Jet1P/", sTauJetContainerName), // tau1P fake plots : variables for tau ID + m_oFakeHad3ProngPlots(this,"NoCuts/Fake/Jet3P/", sTauJetContainerName), // tau3P fake plots : variables for tau ID + m_oRecoGeneralTauAllProngsPlots(this,"NoCuts/RecTau/",sTauJetContainerName),// "recTau_General"), // general tau all fake prongs plots + m_oRecoHad1ProngPlots(this,"NoCuts/RecTau/1P/", sTauJetContainerName),//"recTau_1P"), // tau1P fake plots : variables for tau ID + m_oRecoHad3ProngPlots(this,"NoCuts/RecTau/3P/", sTauJetContainerName),// "recTau_3P"), // tau3P fake plots : variables for tau ID + m_oRecoTauAllProngsPlots(this,"NoCuts/RecTau/PFOs/", sTauJetContainerName), // all tau reco, no match to truth + m_oMatchedTauAllProngsPlots(this,"NoCuts/Matched/PFOs/", sTauJetContainerName), + m_oFakeTauAllProngsPlots(this,"NoCuts/Fake/PFOs/", sTauJetContainerName), // all tau reco, no match to truth + m_oMatchedTauEffPlots (this,"NoCuts/Matched/Eff/All/", sTauJetContainerName), + m_oMatchedTauEff1PPlots(this,"NoCuts/Matched/Eff/Tau1P/", sTauJetContainerName), + m_oMatchedTauEff3PPlots(this,"NoCuts/Matched/Eff/Tau3P/", sTauJetContainerName), + m_oRecTauEffPlots (this,"NoCuts/RecTau/Eff/All/", sTauJetContainerName), + m_oRecTauEff1PPlots(this,"NoCuts/RecTau/Eff/Tau1P/", sTauJetContainerName), + m_oRecTauEff3PPlots(this,"NoCuts/RecTau/Eff/Tau3P/", sTauJetContainerName), + m_oFakeTauEffPlots (this,"NoCuts/Fake/Eff/All/", sTauJetContainerName), + m_oFakeTauEff1PPlots(this,"NoCuts/Fake/Eff/Tau1P/", sTauJetContainerName), + m_oFakeTauEff3PPlots(this,"NoCuts/Fake/Eff/Tau3P/", sTauJetContainerName), + m_oNewCorePlots(this,"NoCuts/RecTau/All/", sTauJetContainerName), // all tau reco, newCore variables + m_oNewCoreMatchedPlots(this,"NoCuts/Matched/All/", sTauJetContainerName), // all tau reco, newCore variables + m_oNewCoreFakePlots(this,"NoCuts/Fake/All/", sTauJetContainerName), // all tau reco, newCore variables + m_oMigrationPlots(this,"NoCuts/Matched/Migration/", sTauJetContainerName), // Migration Matrix + + // Plots with the "nominal" tau selection + m_oFakeGeneralNom(this,"Nominal/Fake/", sTauJetContainerName), + m_oFakeHad1ProngNom(this,"Nominal/Fake/Jet1P/", sTauJetContainerName), + m_oFakeHad3ProngNom(this,"Nominal/Fake/Jet3P/", sTauJetContainerName), + m_oFakeTauEffPlotsNom(this, "Nominal/Fake/Eff/All/", sTauJetContainerName), + m_oFakeTauEff1PPlotsNom(this, "Nominal/Fake/Eff/Jet1P/", sTauJetContainerName), + m_oFakeTauEff3PPlotsNom(this, "Nominal/Fake/Eff/Jet3P/", sTauJetContainerName), + m_oFakeTauRecoTauPlotsNom(this, "Nominal/Fake/PFOs/", sTauJetContainerName), + m_oNewCoreFakePlotsNom(this, "Nominal/Fake/All/", sTauJetContainerName), + + m_oRecoGeneralNom(this,"Nominal/RecTau/", sTauJetContainerName), + m_oRecoHad1ProngNom(this,"Nominal/RecTau/1P/", sTauJetContainerName), + m_oRecoHad3ProngNom(this,"Nominal/RecTau/3P/", sTauJetContainerName), + m_oRecTauEffPlotsNom(this, "Nominal/RecTau/Eff/All/", sTauJetContainerName), + m_oRecTauEff1PPlotsNom(this, "Nominal/RecTau/Eff/1P/", sTauJetContainerName), + m_oRecTauEff3PPlotsNom(this, "Nominal/RecTau/Eff/3P/", sTauJetContainerName), + m_oRecTauRecoTauPlotsNom(this, "Nominal/RecTau/PFOs/", sTauJetContainerName), + m_oNewCoreRecTauPlotsNom(this, "Nominal/RecTau/All/", sTauJetContainerName), + + m_oMatchedGeneralNom(this,"Nominal/Matched/", sTauJetContainerName), + m_oMatchedHad1ProngNom(this,"Nominal/Matched/Tau1P/", sTauJetContainerName), + m_oMatchedHad3ProngNom(this,"Nominal/Matched/Tau3P/", sTauJetContainerName), + m_oMatchedTauEffPlotsNom(this, "Nominal/Matched/Eff/All/", sTauJetContainerName), + m_oMatchedTauEff1PPlotsNom(this, "Nominal/Matched/Eff/1P/", sTauJetContainerName), + m_oMatchedTauEff3PPlotsNom(this, "Nominal/Matched/Eff/3P/", sTauJetContainerName), + m_oMatchedTauRecoTauPlotsNom(this, "Nominal/Matched/PFOs/", sTauJetContainerName), + m_oMigrationPlotsNom(this, "Nominal/Matched/Migration/", sTauJetContainerName), + m_oNewCoreMatchedPlotsNom(this, "Nominal/Matched/All/", sTauJetContainerName) {} // no fill method implement in order to let filling logic stay in the ManagedMonitoringTool diff --git a/PhysicsAnalysis/TauID/TauDQA/src/TruthHandler.cxx b/PhysicsAnalysis/TauID/TauDQA/src/TruthHandler.cxx deleted file mode 100644 index 0fdd8952bc2071a96a2f250b44eab91e71cc9c4f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TauID/TauDQA/src/TruthHandler.cxx +++ /dev/null @@ -1,588 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "../share/TruthHandler.h" -//#include "EventKernel/PdtPdg.h" - -///////////////////////// -/** method to determine if a particle is only a G4 particle */ -bool TruthHandler::isGenerator(int barcode, int status) { - //FF, 25.04.2013: this method is old copy of - // http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Generators/GenAnalysisTools/TruthHelper/src/IsGenerator.cxx - // but needs to be updated - // ToDo: either update or better, replace this method by call of TruthHelper::IsGenerator - return ( barcode < 100000 && ( status<200 || status%1000 == 1 || status%1000 == 2 ) ); -} - -/////////////////////////////// -/** determine if a particle is a final state stable particle */ -bool TruthHandler::isGenStable( const HepMC::GenParticle* p ) { - //FF, 25.04.2013: this method is a copy of - // http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Generators/GenAnalysisTools/TruthHelper/src/IsGenStable.cxx - // 1 line is missing - // --> ToDo: replace this method by TruthHelper call - - // get generator id - const HepMC::GenEvent* evt = p->parent_event(); - int g_id = evt->signal_process_id(); - int p_id = p->pdg_id(); - int HIJING = 50000000; - - HepMC::GenVertex* vertex = p->end_vertex(); - // we want to keep primary particle with status==2 but without vertex in HepMC - int vertex_barcode=-999999; - if (vertex) vertex_barcode=vertex->barcode(); - if ((g_id - HIJING)>=0 && (g_id - HIJING)<1000) { - // case of Hjing - return ( - // pi0 and sigma0 not decayed but unstable - ( (p->status()%1000 == 1) && abs(p_id) !=111 && abs(p_id) !=3212 ) - && (p->barcode()<200000) - ) ? true:false; - } else { - // other generators - return ( - ( ( p->status()%1000 == 1) || - (p->status()==2 && vertex_barcode<-200000) || - (p->status()%1000 == 2 && p->status() > 1000) - ) && (p->barcode()<200000) - ) ? true:false; - } -} - -bool TruthHandler::isGenStable( const xAOD::TruthParticle* part ) { - //FF, 25.04.2013: this method is a copy of - // http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Generators/GenAnalysisTools/TruthHelper/src/IsGenStable.cxx - // 1 line is missing - // --> ToDo: replace this method by TruthHelper call - - // get generator id - //remove special HIJING treatment for xAOD - // TODO: but back later if really needed - - const xAOD::TruthVertex* vertex = part->decayVtx(); // was end_vertex() - - // we want to keep primary particle with status==2 but without vertex in HepMC - int vertex_barcode=-999999; - if (vertex) vertex_barcode=vertex->barcode(); - return ( - ( ( part->status()%1000 == 1) || - (part->status()==2 && vertex_barcode<-200000) || - (part->status()%1000 == 2 && part->status() > 1000) - ) && (part->barcode()<200000) - ) ? true:false; -} - -//////////////////////// -/** returns false if particle is only a reference particle in the generator. Also checks whether particle - is intermediate (Status==2) or final state and stable (Status==1)*/ -bool TruthHandler::isGoodStatus(int Status){ - // status 10902 should be considered as status 2 - // see discussion here https://savannah.cern.ch/bugs/?59047 and linked hypernews threads, - // e.g. https://groups.cern.ch/group/hn-atlas-Generators/Lists/Archive/Flat.aspx?RootFolder=%2Fgroup%2Fhn-atlas-Generators%2FLists%2FArchive%2FStatus%20Code%2010902%20with%20Pythia&FolderCTID=0x012002006E9F14B8795719469C62A1525BB20B42 - if((Status==2)||(Status==10902)) return true; - else { - if( ( Status != 1 ) && ( Status != 3 ) && ( Status < 200 ) && ( Status > 190 )) - return true; - } - return false; -} - -bool TruthHandler::isGoodStatus(const HepMC::GenParticle* part, int StatusToCheck) { - if(StatusToCheck==1) return isGenStable(part); - if(StatusToCheck==2) return isGoodStatus(part->status()); - return false; -} - -bool TruthHandler::isGoodStatus(const xAOD::TruthParticle* part, int StatusToCheck) { - if(StatusToCheck==1) return isGenStable(part); - if(StatusToCheck==2) return isGoodStatus(part->status()); - return false; -} - -///////////////////////// -/** return true if xAODTruth particle as a child with pdgID==pdgIDtoCheck. Only direct children are checked. No iteration on children-of-children. */ -bool TruthHandler::hasChild(const xAOD::TruthParticle* part, int pdgIDtoCheck) { - // get decay vertex - const xAOD::TruthVertex* vertex = part->decayVtx(); - // loop over all outgoing particles of decay vertx - const std::size_t nChildren = vertex->nOutgoingParticles(); - for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const xAOD::TruthParticle * child = vertex->outgoingParticle(iChild); - if ( child && ( pdgIDtoCheck == child->pdgId() ) ) { - return true; - } - } - return false; -} - -///////////////////////// -/** method to determine if a particle is Tau or not */ -bool TruthHandler::isTauTruth( const TruthParticle * part ){ - PDG::pidType id = part->pdgId(); - int ida = abs( (int) id ); - return ( ida == PDG::tau_minus && part->status() != 3 && !part->hasChild(id) ); -} - -///////////////////////// -/** method to determine if a particle is Tau or not */ -bool TruthHandler::isTauTruth( const xAOD::TruthParticle* part ){ - int id = part->pdgId(); - return ( abs(id) == PDG::tau_minus && part->status() != 3 && !hasChild(part,id) ); -} - -////////////////////// -/** determines if a particle is a true hadronic tau. Option to enforce the pdgID of the parent particle to be of type Mother.*/ -bool TruthHandler::isHadTau(const HepMC::GenParticle* part, int Mother ){ - - if(abs(part->pdg_id()) != 15 || !isGoodStatus(part,2)) return false; - - HepMC::GenVertex *vtx = part->end_vertex(); - - if(!vtx) return false; - for ( HepMC::GenVertex::particle_iterator desc = (vtx)->particles_begin(HepMC::children); desc != (vtx)->particles_end(HepMC::children); ++desc) { - if((abs((*desc)->pdg_id())== 11) || (abs((*desc)->pdg_id())== 13) || (abs((*desc)->pdg_id())== 15) ) return false;//has lpton as child - } - - if(Mother < 0) return true; - - bool HasMother=false; - if(!part->production_vertex()) return false; - for ( HepMC::GenVertex::particle_iterator mother = part->production_vertex()->particles_begin(HepMC::ancestors); - mother != part->production_vertex()->particles_end(HepMC::ancestors); ++mother ) { - if(fabs((*mother)->pdg_id())==Mother) HasMother=true; - } - - return HasMother; -} - -////////////////////// -/** determines if a particle is a true hadronic tau for xAOD case. Option to enforce the pdgID of the parent particle to be of type Mother.*/ -bool TruthHandler::isHadTau(const xAOD::TruthParticle* part, int Mother ){ - - if(abs(part->pdgId()) != 15 || !isGoodStatus(part,2)) return false; - - const xAOD::TruthVertex* decayvtx = part->decayVtx(); - - if(!decayvtx) return false; - const std::size_t nChildren = decayvtx->nOutgoingParticles(); - for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const xAOD::TruthParticle * child = decayvtx->outgoingParticle(iChild); - if ((abs(child->pdgId())== 11) || (abs(child->pdgId())== 13) || (abs(child->pdgId())== 15) ) return false; - } - - if(Mother < 0) return true; - - bool HasMother=false; - const xAOD::TruthVertex* prodvtx = part->prodVtx(); - if(!prodvtx) return false; - const std::size_t nProd = prodvtx->nIncomingParticles(); - for ( std::size_t iMom = 0; iMom != nProd; ++iMom ) { - const xAOD::TruthParticle * mom = prodvtx->incomingParticle(iMom); - if(fabs(mom->pdgId())==Mother) HasMother=true; - } - - return HasMother; -} - -////////////////////// -/** determine if a particle is charged pion, exclude those which come from kaon decays. */ -bool TruthHandler::isGoodChrgPiDaughter(const xAOD::TruthParticle* Pion){ - if(!isGoodStatus(Pion,1)) return false; - - if( (abs(Pion->pdgId())!= 211) || !isGenStable( Pion) ) return false; - /* const xAOD::TruthVertex* prodvtx = Pion->prodVtx(); - if(!prodvtx) return false; - const std::size_t nProd = prodvtx->nIncomingParticles(); - for ( std::size_t iMom = 0; iMom != nProd; ++iMom ) { - const xAOD::TruthParticle * mom = prodvtx->incomingParticle(iMom); - if(fabs(mom->pdgId())==PDG::K_S0) return false; - }*/ - return true; -} -////////////////////////////////////////////////////// -bool TruthHandler::isGoodChrgPiDaughter(const HepMC::GenParticle* Pion){ - if(!isGoodStatus(Pion,1)) return false; - - if( (abs(Pion->pdg_id())!= 211) || !isGenStable( Pion) ) return false; - if ( !Pion->production_vertex() ) return false; - for ( HepMC::GenVertex::particle_iterator mother = Pion->production_vertex()->particles_begin(HepMC::parents); - mother != Pion->production_vertex()->particles_end(HepMC::parents); ++mother ) { - if(abs((*mother)->pdg_id())==PDG::K_S0) return false; - } - return true; -} - -////////////////////// -/** determine whether tau decay includes given pdg_ID particle as an intermediate (Status==2) or - final state (Status==1) daughter*/ -bool TruthHandler::isTauTypeDecay(const HepMC::GenParticle* part, int PDGID, int Status ){ - if(abs(part->pdg_id()) != 15 || !isGoodStatus(part,2)) return false; - HepMC::GenVertex *vtx = part->end_vertex(); - for ( HepMC::GenVertex::particle_iterator desc = (vtx)->particles_begin(HepMC::children); - desc != (vtx)->particles_end(HepMC::children); ++desc) { - if((abs((*desc)->pdg_id())== PDGID)&& isGoodStatus((*desc), Status)) return true; - } - return false; -} - -//////////////////////////////////// -/// Handle tau truth information. Return a container of all truth taus -//Option to enforce the pdgID of the parent particle to be of type Mother. -TruthParticleContainer* TruthHandler::getHadronicTruth(const TruthParticleContainer *mcpartTES, int Mother) { - - // create an AOD container to return hadronic truth taus - TruthParticleContainer* hadTauTES = new TruthParticleContainer(SG::VIEW_ELEMENTS); - - /** Iterate over list of MC particles looking for hadronic taus */ - TruthParticleContainer::const_iterator mcpartItr = mcpartTES->begin(); - TruthParticleContainer::const_iterator mcpartItrE = mcpartTES->end(); - - for (; mcpartItr != mcpartItrE; ++mcpartItr) {//loop over MC particles - - const HepMC::GenParticle* Gen_particle =(*mcpartItr)->genParticle(); - if(isHadTau(Gen_particle, Mother)) { - hadTauTES->push_back(const_cast<TruthParticle*> (*mcpartItr)); - } - } - return hadTauTES; -} - - -//////////////////////////////////// -/// Handle tau truth information. Return a container of all hadronic truth taus -//Option to enforce the pdgID of the parent particle to be of type Mother. -xAOD::TruthParticleContainer* TruthHandler::getHadronicTruth(const xAOD::TruthParticleContainer *mcpartTES, int Mother) { - - // create an xAOD container to return hadronic truth taus - xAOD::TruthParticleContainer* hadTauTES = new xAOD::TruthParticleContainer(SG::VIEW_ELEMENTS); - - /** Iterate over list of MC particles looking for hadronic taus */ - xAOD::TruthParticleContainer::const_iterator mcpartItr = mcpartTES->begin(); - xAOD::TruthParticleContainer::const_iterator mcpartItrE = mcpartTES->end(); - for (; mcpartItr != mcpartItrE; ++mcpartItr) {//loop over MC particles - xAOD::TruthParticle* hadtau = const_cast<xAOD::TruthParticle*>(*mcpartItr); - if(isHadTau(hadtau, Mother)) { - hadTauTES->push_back(hadtau); - } - } - return hadTauTES; -} - - -TruthParticleContainer* TruthHandler::getAllFinalTaus(const TruthParticleContainer *mcpartTES, int Mother) { - // create an AOD container to return hadronic truth taus - TruthParticleContainer* hadTauTES = new TruthParticleContainer(SG::VIEW_ELEMENTS); - /** Iterate over list of MC particles looking for hadronic taus */ - TruthParticleContainer::const_iterator mcpartItr = mcpartTES->begin(); - TruthParticleContainer::const_iterator mcpartItrE = mcpartTES->end(); - for (; mcpartItr != mcpartItrE; ++mcpartItr) {//loop over MC particles - const HepMC::GenParticle* Gen_particle =(*mcpartItr)->genParticle(); - if(fabs((Gen_particle)->pdg_id()!= 15) || !isGoodStatus(Gen_particle,2)) continue; - bool HasMother = false; - if(Mother < 0) HasMother=true; - else if(Mother > 0){ - if(!Gen_particle->production_vertex()) HasMother= false; - for ( HepMC::GenVertex::particle_iterator mother =Gen_particle->production_vertex()->particles_begin(HepMC::ancestors); - mother != Gen_particle->production_vertex()->particles_end(HepMC::ancestors); ++mother ) { - if(fabs((*mother)->pdg_id())==Mother) HasMother=true; - } - } - if(!HasMother) continue; - - if(isHadTau(Gen_particle, Mother) || isTauTypeDecay(Gen_particle,11, 1) || isTauTypeDecay(Gen_particle,13, 1)) - { - // FIXME: cast needed for copying between containers - hadTauTES->push_back(const_cast<TruthParticle*> (*mcpartItr)); - } - } - return hadTauTES; -} - -///////////////////////// -int TruthHandler::nProngTruth(const HepMC::GenParticle* hadTau, bool UseKaon ){ - if(!isHadTau(hadTau)) return 0; - int nProng=0; - HepMC::GenVertex *vtx = hadTau->end_vertex(); - - for ( HepMC::GenVertex::particle_iterator desc = (vtx)->particles_begin(HepMC::descendants); - desc != (vtx)->particles_end(HepMC::descendants); ++desc) { - if(isGoodChrgPiDaughter(*desc)) nProng++; - else if( (abs((*desc)->pdg_id())== PDG::K_plus) && isGenStable((*desc)) && UseKaon) nProng++; - } - return nProng; -} -////////////////////// -int TruthHandler::nProngTruth(const xAOD::TruthParticle* hadTau, bool UseKaon ){ - - int nProng=0; - - const xAOD::TruthVertex* vertex = hadTau->decayVtx(); - if (vertex == 0) return nProng; - // loop over all outgoing particles of decay vertx - const std::size_t nChildren = vertex->nOutgoingParticles(); - for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const xAOD::TruthParticle * child = vertex->outgoingParticle(iChild); - if(isGoodChrgPiDaughter(child)){ nProng++; - }else if( (abs(child->pdgId())== PDG::K_plus) && isGenStable((child)) && UseKaon){ nProng++; - }else{nProng += nProngTruth(child, UseKaon );} //recursive - } - return nProng; -} - -int TruthHandler::nProngTruthTau(const xAOD::TruthParticle* hadTau, bool UseKaon ){ - if(abs(hadTau->pdgId()) != 15) return 0; - return nProngTruth(hadTau,UseKaon); -} -///////////////////////// -/** method to count no. of neutral pions*/ -int TruthHandler::numNeutPion(const xAOD::TruthParticle* hadTau){ - // if(!isGoodStatus(hadTau,2)) return 0; - - int nNeu=0; - - const xAOD::TruthVertex* vertex = hadTau->decayVtx(); - if (vertex == 0) return nNeu; - // loop over all outgoing particles of decay vertx - const std::size_t nChildren = vertex->nOutgoingParticles(); - for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const xAOD::TruthParticle * child = vertex->outgoingParticle(iChild); - if((abs((child)->pdgId())== 111) /*&& ( ((child)->status()==2) || ((child)->status()==10902) ) */){ nNeu++; - } else{ nNeu += numNeutPion(child);} - } - return nNeu; - } - -/** method to count no. of neutral pions*/ -int TruthHandler::numNeutPion(const HepMC::GenParticle* hadTau ){ - if(!isGoodStatus(hadTau,2)) return 0; - - int nNeu=0; - HepMC::GenVertex *vtx = hadTau->end_vertex(); - - for ( HepMC::GenVertex::particle_iterator desc = (vtx)->particles_begin(HepMC::descendants); - desc != (vtx)->particles_end(HepMC::descendants); ++desc) { - // status 10902 should be considered as status 2 - // see discussion here https://savannah.cern.ch/bugs/?59047 and linked hypernews threads, - // e.g. https://groups.cern.ch/group/hn-atlas-Generators/Lists/Archive/Flat.aspx?RootFolder=%2Fgroup%2Fhn-atlas-Generators%2FLists%2FArchive%2FStatus%20Code%2010902%20with%20Pythia&FolderCTID=0x012002006E9F14B8795719469C62A1525BB20B42 - if((abs((*desc)->pdg_id())== 111) && ( ((*desc)->status()==2) || ((*desc)->status()==10902) ) ) nNeu++; - } - return nNeu; -} - -///////////////////////// -/** method to count no. of neutral pions and get the pointer to pi+, rho+, a1+ */ -const TruthParticle* TruthHandler::nPi0Truth( const TruthParticle* hadTau, int &nPi0 ) { - nPi0 = numNeutPion(hadTau); - return GetIntermDaughter(hadTau); -} - -///////////////////////// -/** method to get a pointer to the intermediate daughter (either the pion, rho, or a1) */ -const TruthParticle* TruthHandler::GetIntermDaughter(const TruthParticle* hadTau ){ - const TruthParticle* Daughter1 = NULL; - - for (unsigned int i1 = 0; i1 < hadTau->nDecay(); i1++) {// i1 loop over particles - - // decay to Pi+(211) or rho(213) or a1(20213) - if ( ( abs((int) hadTau->pdgDecay(i1)) == PDG::pi_plus ) || - ( abs((int) hadTau->pdgDecay(i1)) == PDG::rho_plus ) || - ( abs((int) hadTau->pdgDecay(i1)) == PDG::a_1_plus ) ) - Daughter1 = hadTau->child(i1); - } - return Daughter1; -} - -///////////////////////// -/** determines whether ``Daughter'' is a hadronic daughter of the decay of the ``TrueTau'', - (where status specifies intermediate daughter (Status==2) or final state daughter (Status==1))*/ -bool TruthHandler::isHadTauDaughter(const HepMC::GenParticle* TrueTau,const HepMC::GenParticle* Daughter, int Status){ - if(!isGoodStatus(Daughter, Status) ) return false; - if ( !TrueTau->end_vertex() ) return false; - if(!isHadTau(TrueTau)) return false; - - HepMC::GenVertex *vtx = TrueTau->end_vertex(); - - for ( HepMC::GenVertex::particle_iterator desc = (vtx)->particles_begin(HepMC::descendants); - desc != (vtx)->particles_end(HepMC::descendants); ++desc) { - if( isGoodStatus((*desc),Status) && ((*desc)==Daughter) && ( ((*desc)->barcode()) == (Daughter->barcode()) )) return true; - } - return false; - -} - -///////////////////////// -/** determines whether ``Daughter'' is a hadronic daughter of the decay of a tau in the ``TrueTauCollection'', - (where status specifies intermediate daughter (Status==2) or final state daughter (Status==1))*/ -bool TruthHandler::isHadTauDaughter(const HepMC::GenEvent* TrueTauCollection,const HepMC::GenParticle* Daughter, int Status){ - for(HepMC::GenEvent::particle_const_iterator MCitr=TrueTauCollection->particles_begin(); MCitr!=TrueTauCollection->particles_end(); ++MCitr ){ - if (TruthHandler::isHadTauDaughter(*MCitr, Daughter, Status)) return true; - } - return false; -} -bool TruthHandler::isHadTauDaughter(const TruthParticleContainer *TrueTauCollection, const TruthParticle* TruthDaughter, int Status){ - const HepMC::GenParticle* Daughter = TruthDaughter->genParticle(); - for (TruthParticleContainer::const_iterator MCitr = TrueTauCollection->begin(); MCitr!=TrueTauCollection->end(); ++MCitr) { - const HepMC::GenParticle* Gen_particle =(*MCitr)->genParticle(); - if(isHadTauDaughter(Gen_particle, Daughter, Status)) return true; - } - return false; -} - - -///////////////////////// -/** returns a collection of the true intermediate daughters (Status==2) or final daughters (Status==2) - of the true hadronic tau*/ -TruthParticleContainer* TruthHandler::getTrueHadDaughters(const TruthParticle *TrueTau, const TruthParticleContainer *mcpartTES, int Status) { - TruthParticleContainer* hadDaughters = new TruthParticleContainer(SG::VIEW_ELEMENTS); - - /** Iterate over list of MC particles looking for hadronic taus */ - TruthParticleContainer::const_iterator mcpartItr = mcpartTES->begin(); - TruthParticleContainer::const_iterator mcpartItrE = mcpartTES->end(); - - for (; mcpartItr != mcpartItrE; ++mcpartItr) {//loop over MC particles - if(isHadTauDaughter(TrueTau, *mcpartItr, Status)) { - // cast needed for copying between containers. - hadDaughters->push_back(const_cast<TruthParticle*> (*mcpartItr)); - } - } - return hadDaughters; -} - - -///////////////////////// -/** returns a collection of the true hadronics taus which decay to nProngs */ -TruthParticleContainer* TruthHandler::getHadronicnProngTruth(const TruthParticleContainer *mcpartTES, int nProngs) { - // create an AOD container to return hadronic truth taus - TruthParticleContainer* hadTaunProngTES = new TruthParticleContainer(SG::VIEW_ELEMENTS); - - TruthParticleContainer* hadTauTES = getHadronicTruth(mcpartTES); - /** Iterate over list of MC particles looking for hadronic taus */ - TruthParticleContainer::const_iterator mcpartItr = hadTauTES->begin(); - TruthParticleContainer::const_iterator mcpartItrE = hadTauTES->end(); - - for (; mcpartItr != mcpartItrE; ++mcpartItr) {//loop over MC particles - - const HepMC::GenParticle* Gen_particle =(*mcpartItr)->genParticle(); - if(nProngTruth(Gen_particle)==nProngs) { - // cast needed for copying between containers - hadTaunProngTES->push_back(const_cast<TruthParticle*> (*mcpartItr)); - } - } - return hadTaunProngTES; -} - - -///////////////////////// -/** method to determine the visible et of hadronic truth taus */ -CLHEP::HepLorentzVector TruthHandler::getTauVisibleSumTruth( const TruthParticle* hadTau ) { - - CLHEP::HepLorentzVector visibleSum(0.,0.,0.,0.); - - for( unsigned int ii=0; ii < hadTau->nDecay(); ++ii) { - const HepMC::GenParticle* Gen_child = hadTau->genChild(ii); - if (! isGoodStatus(Gen_child, 1) && ! isGoodStatus(Gen_child, 2) ) continue; - if( abs((int) hadTau->pdgDecay(ii)) != PDG::nu_e && - abs((int) hadTau->pdgDecay(ii)) != PDG::nu_mu && - abs((int) hadTau->pdgDecay(ii)) != PDG::nu_tau ) { - visibleSum += hadTau->pDecay(ii); - } - } - - return visibleSum; -} - -///////////////////////// -/** method to determine the visible et of hadronic truth taus */ -TLorentzVector TruthHandler::getTauVisibleSumTruth( const xAOD::TruthParticle* hadTau ) { - - TLorentzVector visibleSum(0.,0.,0.,0.); - - const xAOD::TruthVertex* decayvtx = hadTau->decayVtx(); - - if(!decayvtx) return visibleSum; - const std::size_t nChildren = decayvtx->nOutgoingParticles(); - for ( std::size_t iChild = 0; iChild != nChildren; ++iChild ) { - const xAOD::TruthParticle * child = decayvtx->outgoingParticle(iChild); - if (! isGoodStatus(child, 1) && ! isGoodStatus(child, 2) ) continue; - if( abs((int) child->pdgId()) != PDG::nu_e && - abs((int) child->pdgId()) != PDG::nu_mu && - abs((int) child->pdgId()) != PDG::nu_tau ) { - visibleSum += child->p4(); - } - } - - return visibleSum; -} - - -///////////////////////// -/** This method adds the momentum of the daughter neutrinos of the tau, it is called recursively */ -CLHEP::HepLorentzVector TruthHandler::sumDaughterNeutrinos( const TruthParticle *part ) { - - CLHEP::HepLorentzVector nu( 0, 0, 0, 0); - - if ((abs((int)part->pdgId()) == PDG::nu_e) || (abs((int)part->pdgId()) == PDG::nu_mu) || (abs((int)part->pdgId()) == PDG::nu_tau)) { - nu.setPx(part->px()); - nu.setPy(part->py()); - nu.setPz(part->pz()); - nu.setE(part->e()); - return nu; - } - - for (unsigned int j=0; j<part->nDecay(); j++) { - nu += sumDaughterNeutrinos((TruthParticle*)part->child(j)); - } - - return nu; -} - -///////////////////////// -/** This method returns the HepLorentzVector of leading charged pion */ -CLHEP::HepLorentzVector TruthHandler::getPiChTruth( const TruthParticle* hadTau ) { - - std::vector<CLHEP::HepLorentzVector> PiCh; - CLHEP::HepLorentzVector temp; - - for (unsigned int i1 = 0; i1 < hadTau->nDecay(); i1++) {// i1 loop over particles - if (( abs((int) hadTau->pdgDecay(i1)) == PDG::pi_plus ) && (isGenerator(hadTau->child(i1)))){ - temp = hadTau->pDecay(i1); - PiCh.push_back(temp); - } - else { - for (unsigned int i2 = 0; i2 < hadTau->child(i1)->nDecay(); i2++) {//i2 - if (( abs((int)hadTau->child(i1)->pdgDecay(i2)) == PDG::pi_plus ) && (isGenerator(hadTau->child(i1)->child(i2)))) { - temp = hadTau->child(i1)->pDecay(i2) ; - PiCh.push_back(temp); - } - else { - for (unsigned int i3 = 0; i3 < hadTau->child(i1)->child(i2)->nDecay(); i3++) {//i3 - if (( abs((int) hadTau->child(i1)->child(i2)->pdgDecay(i3)) == PDG::pi_plus) && (isGenerator(hadTau->child(i1)->child(i2)->child(i3)))) { - temp = hadTau->child(i1)->child(i2)->pDecay(i3); - PiCh.push_back(temp); - } - else { - for (unsigned int i4 = 0; i4 < hadTau->child(i1)->child(i2)->child(i3)->nDecay(); i4++) {//i4 - if (( abs((int) hadTau->child(i1)->child(i2)->child(i3)->pdgDecay(i4)) == PDG::pi_plus) && (isGenerator(hadTau->child(i1)->child(i2)->child(i3)->child(i4)))) { - temp = hadTau->child(i1)->child(i2)->child(i3)->pDecay(i4); - PiCh.push_back(temp); - } - }//i4 - } - }//i3 - } - }//i2 - } - }//end i1 loop over particles - - CLHEP::HepLorentzVector leadPiCh(0); - if(PiCh.size() > 0) { - std::sort(PiCh.begin(), PiCh.end(), std::greater<CLHEP::HepLorentzVector>()); - leadPiCh = PiCh[0]; - } - - return leadPiCh; -} - -///////////////////////// diff --git a/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/Migration.h b/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/Migration.h index ed51f467c757556acf2f37d2b078ee08a3a09f8a..0344ab925382d2db1fc996b34e02cf5ada4fa0ae 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/Migration.h +++ b/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/Migration.h @@ -36,9 +36,10 @@ namespace Tau{ Migration(PlotBase *pParent, std::string sDir, std::string sTauJetContainerName); virtual ~Migration(); - void fill(const xAOD::TauJet& tau,int nProng, int nNeu); - - //Tau::ParamPlots m_oParamPlots; + /* void fill(const xAOD::TauJet& tau,int nProng, int nNeu); */ + void fill( + const xAOD::TauJet& tau, + xAOD::TauJetParameters::DecayMode trueMode); const char *m_lable[DECAYSIZE] = { "t10r10", @@ -64,8 +65,8 @@ namespace Tau{ private: void initializePlots(); std::string m_sTauJetContainerName; - void decayModeFill(int trueMode, int recP, int recN,TH1 *histo); - void decayModeFill(int trueP,int trueN,int recP, int recN,TH1 *histo); + void decayModeFill(int trueMode, int recMode, TH1 *histo); + void decayModeFill(int trueMode, int recP, int recN, TH1 *histo); }; } diff --git a/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/RecoTauPlots.h b/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/RecoTauPlots.h index cc053e394770730cf193deb48dda6d262ff927c4..514df2351995c110928547dea7e7df3d06f23571 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/RecoTauPlots.h +++ b/PhysicsAnalysis/TauID/TauHistUtils/TauHistUtils/RecoTauPlots.h @@ -43,6 +43,7 @@ class RecoTauPlots: public PlotBase { TH1* m_pantau_CellBasedInput_BDTVar_Basic_NNeutralConsts; TH1* m_pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt; TH1* m_pantau_CellBasedInput_BDTVar_Charged_StdDev_Et_WrtEtAllConsts; + TH1* m_pantau_CellBasedInput_BDTVar_Charged_HLV_SumM; TH1* m_pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM; TH1* m_pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_1; TH1* m_pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_2; diff --git a/PhysicsAnalysis/TauID/TauHistUtils/src/EVetoPlots.cxx b/PhysicsAnalysis/TauID/TauHistUtils/src/EVetoPlots.cxx index deb71166dae027c0c835786b2a8d685c50f2e611..c3be60b1db1b7e3391ee064fba2ec11aabb2d457 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/src/EVetoPlots.cxx +++ b/PhysicsAnalysis/TauID/TauHistUtils/src/EVetoPlots.cxx @@ -50,9 +50,7 @@ void EVetoPlots::fill(const xAOD::TauJet& tau) { float avariable=0; - bool test = false; - - test=tau.detail(xAOD::TauJetParameters::hadRadius, avariable); + bool test=tau.detail(xAOD::TauJetParameters::hadRadius, avariable); if(test) m_HadRadius->Fill(avariable,1.); test=tau.detail(xAOD::TauJetParameters::EMRadius, avariable); diff --git a/PhysicsAnalysis/TauID/TauHistUtils/src/Had1ProngPlots.cxx b/PhysicsAnalysis/TauID/TauHistUtils/src/Had1ProngPlots.cxx index 09d2198cf1df95c46b217f7c0ad4db93e9c482c1..a99d8ea456bf8672b4dea462c090dacd23a3c27a 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/src/Had1ProngPlots.cxx +++ b/PhysicsAnalysis/TauID/TauHistUtils/src/Had1ProngPlots.cxx @@ -66,9 +66,7 @@ void Had1ProngPlots::fill(const xAOD::TauJet& tau) { float avariable=0; - bool test = false; - - test=tau.detail(xAOD::TauJetParameters::centFrac, avariable); + bool test=tau.detail(xAOD::TauJetParameters::centFrac, avariable); if(test) m_tauCoreFrac->Fill(avariable,1.); test=tau.detail(xAOD::TauJetParameters::etOverPtLeadTrk, avariable); diff --git a/PhysicsAnalysis/TauID/TauHistUtils/src/Had3ProngPlots.cxx b/PhysicsAnalysis/TauID/TauHistUtils/src/Had3ProngPlots.cxx index f1f7e0d7985c7b479ee2f5f4f4459717338543dc..cb0f384d358fa469330262d3590fde031c52839c 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/src/Had3ProngPlots.cxx +++ b/PhysicsAnalysis/TauID/TauHistUtils/src/Had3ProngPlots.cxx @@ -53,9 +53,7 @@ void Had3ProngPlots::fill(const xAOD::TauJet& tau) { float avariable=0; - bool test = false; - - test=tau.detail(xAOD::TauJetParameters::centFrac, avariable); + bool test=tau.detail(xAOD::TauJetParameters::centFrac, avariable); if(test) m_tauCoreFrac->Fill(avariable,1.); test=tau.detail(xAOD::TauJetParameters::etOverPtLeadTrk, avariable); diff --git a/PhysicsAnalysis/TauID/TauHistUtils/src/Migration.cxx b/PhysicsAnalysis/TauID/TauHistUtils/src/Migration.cxx index 514b7dc840908509730dd49362622a1ca73affd7..8aff22a1adf797dfd1b71af1c111653708de03d0 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/src/Migration.cxx +++ b/PhysicsAnalysis/TauID/TauHistUtils/src/Migration.cxx @@ -14,7 +14,7 @@ Migration::Migration(PlotBase* pParent, std::string sDir, std::string sTauJetCon m_sTauJetContainerName(sTauJetContainerName) { } - + Migration::~Migration() { } @@ -33,123 +33,164 @@ void Migration::initializePlots() m_migration_cellBased->GetXaxis()->SetBinLabel(i,m_lable[i-1]); } } - -void Migration::fill(const xAOD::TauJet& thisTau,int nProng, int nNeu) { - // panTau + +void Migration::fill( + const xAOD::TauJet& thisTau, + xAOD::TauJetParameters::DecayMode trueMode) +{ + int isPanTauCandidate = 0; - bool foundDetail = thisTau.panTauDetail(xAOD::TauJetParameters::PanTauDetails::PanTau_isPanTauCandidate, isPanTauCandidate); + bool foundDetail = thisTau.panTauDetail( + xAOD::TauJetParameters::PanTauDetails::PanTau_isPanTauCandidate, + isPanTauCandidate); if ( !foundDetail || !isPanTauCandidate ) return; - - int decayMode = xAOD::TauJetParameters::DecayMode::Mode_Error; - foundDetail = thisTau.panTauDetail(xAOD::TauJetParameters::PanTauDetails::PanTau_DecayMode, decayMode); - if ( foundDetail ) decayModeFill(decayMode, nProng, nNeu, m_migration_panTau); - - decayMode = xAOD::TauJetParameters::DecayMode::Mode_Error; - foundDetail = thisTau.panTauDetail(xAOD::TauJetParameters::PanTauDetails::PanTau_DecayModeProto, decayMode); - if ( foundDetail ) decayModeFill(decayMode, nProng, nNeu, m_migration_panTauProto); + // panTau + int recMode = xAOD::TauJetParameters::DecayMode::Mode_Error; + foundDetail = thisTau.panTauDetail( + xAOD::TauJetParameters::PanTauDetails::PanTau_DecayMode, + recMode); + if ( foundDetail ) decayModeFill(trueMode, recMode, m_migration_panTau); -//RecTau - - - /*+++++++++++++++++++++++++++++++++++++++++++++++++ - +++++++++++++++++++CellBased+++++++++++++++++++++ - +++++++++++++++++++++++++++++++++++++++++++++++++*/ + // panTauProto + recMode = xAOD::TauJetParameters::DecayMode::Mode_Error; + foundDetail = thisTau.panTauDetail( + xAOD::TauJetParameters::PanTauDetails::PanTau_DecayModeProto, + recMode); + if ( foundDetail ) { + decayModeFill(trueMode, recMode, m_migration_panTauProto); + } - //Charged Pions - std::vector< ElementLink< xAOD::PFOContainer > > cellBased_chargedPFO = thisTau.protoChargedPFOLinks(); + // Cellbased + // Get number of charged pions + std::vector<ElementLink<xAOD::PFOContainer>> cellBased_chargedPFO + = thisTau.protoChargedPFOLinks(); int cellP = cellBased_chargedPFO.size(); - - //Neutral Pions + // Get number of neutral pions int nPi0_tau = 0; - std::vector< ElementLink< xAOD::PFOContainer > > cellBased_neutralPFO = thisTau.protoNeutralPFOLinks(); - std::vector< ElementLink< xAOD::PFOContainer > >::iterator first_cellBased_neutralPFO = cellBased_neutralPFO.begin(); - std::vector< ElementLink< xAOD::PFOContainer > >::iterator last_cellBased_neutralPFO = cellBased_neutralPFO.end(); - for (; first_cellBased_neutralPFO != last_cellBased_neutralPFO; ++first_cellBased_neutralPFO){ + std::vector<ElementLink<xAOD::PFOContainer>> cellBased_neutralPFO + = thisTau.protoNeutralPFOLinks(); + std::vector<ElementLink<xAOD::PFOContainer>>::iterator + first_cellBased_neutralPFO = cellBased_neutralPFO.begin(); + std::vector<ElementLink<xAOD::PFOContainer>>::iterator + last_cellBased_neutralPFO = cellBased_neutralPFO.end(); + for ( ; first_cellBased_neutralPFO != last_cellBased_neutralPFO; + ++first_cellBased_neutralPFO ) { ElementLink<xAOD::PFOContainer> thisLink = *first_cellBased_neutralPFO; const xAOD::PFO* thisPFO = *thisLink; int myNPi0Proto = 0; - if(thisPFO->attribute(xAOD::PFODetails::nPi0Proto, myNPi0Proto)) nPi0_tau+=myNPi0Proto; - - } - decayModeFill(nProng,nNeu,cellP,nPi0_tau,m_migration_cellBased); - - - - /*+++++++++++++++++++++++++++++++++++++++++++++++++ - +++++++++++++++++++Pantau+++++++++++++++++++++ - +++++++++++++++++++++++++++++++++++++++++++++++++*/ - + if ( thisPFO->attribute(xAOD::PFODetails::nPi0Proto, myNPi0Proto) ) { + nPi0_tau+=myNPi0Proto; + } + } + decayModeFill(trueMode, cellP, nPi0_tau, m_migration_cellBased); } - -void Migration::decayModeFill(int trueMode, int recP, int recN,TH1 *histo) +void Migration::decayModeFill(int trueMode, int recMode, TH1 *histo) { - switch (trueMode) { + if ( recMode >= xAOD::TauJetParameters::DecayMode::Mode_Other + || trueMode >= xAOD::TauJetParameters::DecayMode::Mode_Other ) return; + + switch ( trueMode ) { case xAOD::TauJetParameters::DecayMode::Mode_1p0n: - if ( recP == 1 && recN == 0 ) histo->Fill(t10r10 + 0.5); - else if ( recP == 1 && recN == 1 ) histo->Fill(t10r11 + 0.5); - else if ( recP == 1 && recN > 1 ) histo->Fill(t10r1x + 0.5); - else if ( recP == 3 ) histo->Fill(t1r3 + 0.5); + switch ( recMode ) { + case xAOD::TauJetParameters::DecayMode::Mode_1p0n: + histo->Fill(t10r10 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_1p1n: + histo->Fill(t10r11 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_1pXn: + histo->Fill(t10r1x + 0.5); + break; + default: + histo->Fill(t1r3 + 0.5); + break; + } break; case xAOD::TauJetParameters::DecayMode::Mode_1p1n: - if ( recP == 1 && recN == 0 ) histo->Fill(t11r10 + 0.5); - else if ( recP == 1 && recN == 1 ) histo->Fill(t11r11 + 0.5); - else if ( recP == 1 && recN > 1 ) histo->Fill(t11r1x + 0.5); - else if ( recP == 3 ) histo->Fill(t1r3 + 0.5); + switch ( recMode ) { + case xAOD::TauJetParameters::DecayMode::Mode_1p0n: + histo->Fill(t11r10 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_1p1n: + histo->Fill(t11r11 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_1pXn: + histo->Fill(t11r1x + 0.5); + break; + default: + histo->Fill(t1r3 + 0.5); + break; + } break; case xAOD::TauJetParameters::DecayMode::Mode_1pXn: - if ( recP == 1 && recN == 0 ) histo->Fill(t1xr10 + 0.5); - else if ( recP == 1 && recN == 1 ) histo->Fill(t1xr11 + 0.5); - else if ( recP == 1 && recN > 1 ) histo->Fill(t1xr1x + 0.5); - else if ( recP == 3 ) histo->Fill(t1r3 + 0.5); + switch ( recMode ) { + case xAOD::TauJetParameters::DecayMode::Mode_1p0n: + histo->Fill(t1xr10 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_1p1n: + histo->Fill(t1xr11 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_1pXn: + histo->Fill(t1xr1x + 0.5); + break; + default: + histo->Fill(t1r3 + 0.5); + break; + } break; case xAOD::TauJetParameters::DecayMode::Mode_3p0n: - if ( recP == 3 && recN == 0 ) histo->Fill(t30r30 + 0.5); - else if ( recP == 3 && recN >= 1 ) histo->Fill(t30r3x + 0.5); - else if ( recP == 1 ) histo->Fill(t3r1 + 0.5); + switch ( recMode ) { + case xAOD::TauJetParameters::DecayMode::Mode_3p0n: + histo->Fill(t30r30 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_3pXn: + histo->Fill(t30r3x + 0.5); + break; + default: + histo->Fill(t3r1 + 0.5); + break; + } break; case xAOD::TauJetParameters::DecayMode::Mode_3pXn: - if ( recP == 3 && recN == 0 ) histo->Fill(t3xr30 + 0.5); - else if ( recP == 3 && recN >= 1 ) histo->Fill(t3xr3x + 0.5); - else if ( recP == 1 ) histo->Fill(t3r1 + 0.5); + switch ( recMode ) { + case xAOD::TauJetParameters::DecayMode::Mode_3p0n: + histo->Fill(t3xr30 + 0.5); + break; + case xAOD::TauJetParameters::DecayMode::Mode_3pXn: + histo->Fill(t3xr3x + 0.5); + break; + default: + histo->Fill(t3r1 + 0.5); + break; + } break; } return; } - -void Migration::decayModeFill(int trueP,int trueN,int recP, int recN,TH1 *histo){ - if(recP == 1 && recN== 0){ - if(trueP == 1 && trueN== 0) histo->Fill(t10r10 + 0.5); - if(trueP == 1 && trueN== 1) histo->Fill(t11r10 + 0.5); - if(trueP == 1 && trueN > 1) histo->Fill(t1xr10 + 0.5); - if(trueP == 3) histo->Fill(t3r1 + 0.5); +void Migration::decayModeFill(int trueMode, int recP, int recN, TH1 *histo) +{ + xAOD::TauJetParameters::DecayMode recMode + = xAOD::TauJetParameters::DecayMode::Mode_Error; + if ( recP == 1 && recN == 0 ) { + recMode = xAOD::TauJetParameters::DecayMode::Mode_1p0n; } - if(recP == 1 && recN== 1){ - if(trueP == 1 && trueN== 0) histo->Fill(t10r11 + 0.5); - if(trueP == 1 && trueN== 1) histo->Fill(t11r11 + 0.5); - if(trueP == 1 && trueN > 1) histo->Fill(t1xr11 + 0.5); - if(trueP == 3 ) histo->Fill(t3r1 + 0.5); + if ( recP == 1 && recN == 1 ) { + recMode = xAOD::TauJetParameters::DecayMode::Mode_1p1n; } - if(recP == 1 && recN > 1){ - if(trueP == 1 && trueN== 0) histo->Fill(t10r1x + 0.5); - if(trueP == 1 && trueN== 1) histo->Fill(t11r1x + 0.5); - if(trueP == 1 && trueN > 1) histo->Fill(t1xr1x + 0.5); - if(trueP == 3 ) histo->Fill(t3r1 + 0.5); + if ( recP == 1 && recN > 1 ) { + recMode = xAOD::TauJetParameters::DecayMode::Mode_1pXn; } - if(recP == 3 && recN== 0){ - if(trueP == 1 ) histo->Fill(t1r3 + 0.5); - if(trueP == 3 && trueN== 0) histo->Fill(t30r30 + 0.5); - if(trueP == 3 && trueN>= 1) histo->Fill(t3xr30 + 0.5); + if ( recP == 3 && recN == 0 ) { + recMode = xAOD::TauJetParameters::DecayMode::Mode_3p0n; } - if(recP == 3 && recN>= 1){ - if(trueP == 1 ) histo->Fill(t1r3 + 0.5); - if(trueP == 3 && trueN== 0) histo->Fill(t30r3x + 0.5); - if(trueP == 3 && trueN>= 1) histo->Fill(t3xr3x + 0.5); + if ( recP == 3 && recN >= 1 ){ + recMode = xAOD::TauJetParameters::DecayMode::Mode_3pXn; } - return; + this->decayModeFill(trueMode, recMode, histo); } - + } diff --git a/PhysicsAnalysis/TauID/TauHistUtils/src/NewCorePlots.cxx b/PhysicsAnalysis/TauID/TauHistUtils/src/NewCorePlots.cxx index d93ae2fd9898f38c56fcb5c4fab57674121f09bd..141597a7653c99d8b522f639ba42f65c55edc5d2 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/src/NewCorePlots.cxx +++ b/PhysicsAnalysis/TauID/TauHistUtils/src/NewCorePlots.cxx @@ -88,9 +88,8 @@ void NewCorePlots::fill(const xAOD::TauJet& tau) { // m_tauNWideTracks->Fill(tau.nWideTracks(), 1.); float avariable=0; int bvariable=0; - bool test = false; - - test=tau.detail(xAOD::TauJetParameters::ipZ0SinThetaSigLeadTrk, avariable); + + bool test=tau.detail(xAOD::TauJetParameters::ipZ0SinThetaSigLeadTrk, avariable); if(test) m_ipZ0SinThetaSigLeadTrk->Fill(avariable,1.); test=tau.detail(xAOD::TauJetParameters::etOverPtLeadTrk, avariable); diff --git a/PhysicsAnalysis/TauID/TauHistUtils/src/RecoTauPlots.cxx b/PhysicsAnalysis/TauID/TauHistUtils/src/RecoTauPlots.cxx index 3c52bba569b197f1367a23471f9cd92cf40c49f6..59e1469235a7bd07599ff5040e71b23b2a6d318c 100644 --- a/PhysicsAnalysis/TauID/TauHistUtils/src/RecoTauPlots.cxx +++ b/PhysicsAnalysis/TauID/TauHistUtils/src/RecoTauPlots.cxx @@ -26,6 +26,7 @@ RecoTauPlots::RecoTauPlots(PlotBase* pParent, std::string sDir, std::string sTau m_pantau_CellBasedInput_BDTVar_Basic_NNeutralConsts(nullptr), m_pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt(nullptr), m_pantau_CellBasedInput_BDTVar_Charged_StdDev_Et_WrtEtAllConsts(nullptr), + m_pantau_CellBasedInput_BDTVar_Charged_HLV_SumM(nullptr), m_pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM(nullptr), m_pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_1(nullptr), m_pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_2(nullptr), @@ -72,9 +73,10 @@ void RecoTauPlots::initializePlots(){ m_pantau_CellBasedInput_BDTValue_1p1n_vs_1pXn = Book1D("pantau_CellBasedInput_BDTValue_1p1n_vs_1pXn",m_sTauJetContainerName + "pantau_CellBasedInput_BDTValue_1p1n_vs_1pXn",30,-1.,1.); m_pantau_CellBasedInput_BDTValue_3p0n_vs_3pXn = Book1D("pantau_CellBasedInput_BDTValue_3p0n_vs_3pXn",m_sTauJetContainerName + "pantau_CellBasedInput_BDTValue_3p0n_vs_3pXn",30,-1.,1.); m_pantau_CellBasedInput_BDTVar_Basic_NNeutralConsts = Book1D("pantau_CellBasedInput_BDTVar_Basic_NNeutralConsts",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Basic_NNeutralConsts",10.,-0.5,9.5); - m_pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt = Book1D("pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt",30,0.,6.); + m_pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt = Book1D("pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt", 30, 0.0, 4000.0); m_pantau_CellBasedInput_BDTVar_Charged_StdDev_Et_WrtEtAllConsts = Book1D("pantau_CellBasedInput_BDTVar_Charged_StdDev_Et_WrtEtAllConsts",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Charged_StdDev_Et_WrtEtAllConsts",30,0.,0.6); - m_pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM = Book1D("pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM",30,0.,6.); + m_pantau_CellBasedInput_BDTVar_Charged_HLV_SumM = Book1D("pantau_CellBasedInput_BDTVar_Charged_HLV_SumM",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Charged_HLV_SumM", 30, 0.0, 4000.0); + m_pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM = Book1D("pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM", 30, 0.0, 4000.0); m_pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_1 = Book1D("pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_1",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_1",30,-1.5,1.5); m_pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_2 = Book1D("pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_2",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Neutral_PID_BDTValues_BDTSort_2",30,-1.5,1.5); m_pantau_CellBasedInput_BDTVar_Neutral_Ratio_1stBDTEtOverEtAllConsts = Book1D("pantau_CellBasedInput_BDTVar_Neutral_Ratio_1stBDTEtOverEtAllConsts",m_sTauJetContainerName + "pantau_CellBasedInput_BDTVar_Neutral_Ratio_1stBDTEtOverEtAllConsts",30,0.,1.); @@ -147,6 +149,8 @@ void RecoTauPlots::initializePlots(){ m_pantau_CellBasedInput_BDTVar_Charged_JetMoment_EtDRxTotalEt->Fill(panTauFloat); thisTau.panTauDetail( xAOD::TauJetParameters::PanTauDetails::PanTau_BDTVar_Charged_StdDev_Et_WrtEtAllConsts,panTauFloat); m_pantau_CellBasedInput_BDTVar_Charged_StdDev_Et_WrtEtAllConsts->Fill(panTauFloat); + thisTau.panTauDetail( xAOD::TauJetParameters::PanTauDetails::PanTau_BDTVar_Charged_HLV_SumM,panTauFloat); + m_pantau_CellBasedInput_BDTVar_Charged_HLV_SumM->Fill(panTauFloat); thisTau.panTauDetail( xAOD::TauJetParameters::PanTauDetails::PanTau_BDTVar_Neutral_HLV_SumM,panTauFloat); m_pantau_CellBasedInput_BDTVar_Neutral_HLV_SumM->Fill(panTauFloat); thisTau.panTauDetail( xAOD::TauJetParameters::PanTauDetails::PanTau_BDTVar_Neutral_PID_BDTValues_BDTSort_1,panTauFloat);