00001
00002 #ifndef TAUANALYSISTOOLS_TAUTRUTHMATCHINGTOOL_H
00003 #define TAUANALYSISTOOLS_TAUTRUTHMATCHINGTOOL_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "AsgTools/AsgMetadataTool.h"
00017 #include "AsgTools/AnaToolHandle.h"
00018
00019
00020 #include "TruthUtils/PIDHelpers.h"
00021 #include "MCTruthClassifier/IMCTruthClassifier.h"
00022
00023
00024 #include "xAODTau/TauxAODHelpers.h"
00025 #include "xAODJet/JetContainer.h"
00026
00027
00028 #include "TauAnalysisTools/ITauTruthMatchingTool.h"
00029
00030 namespace TauAnalysisTools
00031 {
00032
00033 enum eSampleType
00034 {
00035 OTHER = 0,
00036 PYTHIA = 1,
00037 SHERPA = 2,
00038 };
00039
00040
00041 class TauTruthMatchingTool
00042 : public virtual TauAnalysisTools::ITauTruthMatchingTool
00043 , public asg::AsgMetadataTool
00044 {
00046 ASG_TOOL_CLASS( TauTruthMatchingTool,
00047 TauAnalysisTools::ITauTruthMatchingTool )
00048
00049 public:
00050
00051 TauTruthMatchingTool( const std::string& name );
00052
00053 virtual ~TauTruthMatchingTool();
00054
00055
00056 virtual StatusCode initialize() override final;
00057
00058
00059 virtual xAOD::TruthParticleContainer* getTruthTauContainer() override final;
00060
00061
00062 virtual xAOD::TruthParticleAuxContainer* getTruthTauAuxContainer() override final;
00063
00064
00065 virtual const xAOD::TruthParticle* applyTruthMatch(const xAOD::TauJet& xTau) override final;
00066
00067
00068 virtual std::vector<const xAOD::TruthParticle*> applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus) override final;
00069
00070
00071 virtual StatusCode setTruthParticleContainer(const xAOD::TruthParticleContainer* xTruthParticleContainer) override final __attribute__ ((deprecated("This function is deprecated. Please remove it from your code and use the configurable property \"TruthParticlesContainerName\" instead.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauTruthMatchingTool.rst")));
00072
00073
00074 virtual StatusCode initializeEvent() override final __attribute__ ((deprecated("This function is deprecated. Please remove it from your code.\nFor further information please refer to the README:\nhttps://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/doc/README-TauTruthMatchingTool.rst")));
00075
00076
00077 virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau) override final;
00078
00079 StatusCode buildTruthTausFromTruthParticles() override final;
00080 StatusCode retrieveTruthTaus() override final;
00081
00082
00083 virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) override final;
00084 virtual TLorentzVector getTruthTauP4Vis(const xAOD::TruthParticle& xTruthTau) override final;
00085
00086
00087 virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TauJet& xTau) override final;
00088 virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau) override final;
00089
00090
00091 virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau) override final;
00092 virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau) override final;
00093
00094
00095 virtual TauAnalysisTools::TruthMatchedParticleType getTruthParticleType(const xAOD::TauJet& xTau) override final;
00096
00097
00098 virtual int getNTauDecayParticles(const xAOD::TauJet& xTau, int iPdgId, bool bCompareAbsoluteValues = false) override final;
00099 virtual int getNTauDecayParticles(const xAOD::TruthParticle& xTruthTau, int iPdgId, bool bCompareAbsoluteValues = false) override final;
00100
00101
00102 virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TauJet& xTau) override final;
00103 virtual xAOD::TauJetParameters::DecayMode getDecayMode(const xAOD::TruthParticle& xTruthTau) override final;
00104
00105 private:
00106
00107
00108 virtual StatusCode beginEvent() override final;
00109
00110 int getNumPdgId(const xAOD::TauJet& xTau, std::vector<int> vPdgIdMatch) const;
00111 int getNumPdgId(const xAOD::TruthParticle& xTruthTau, std::vector<int> vPdgIdMatch) const;
00112
00113 StatusCode findTruthTau(const xAOD::TauJet& xTau) const;
00114
00115 StatusCode examineTruthTau(const xAOD::TruthParticle& xTruthParticle);
00116 StatusCode examineTruthTauDecay(const xAOD::TruthParticle& xTruthParticle);
00117 void printDecay(const xAOD::TruthParticle& xTruthParticle, int depth = 0) const;
00118
00119 StatusCode checkTruthMatch (const xAOD::TauJet& xTau, const xAOD::TruthParticleContainer& xTauContainer) const;
00120
00121 private:
00122 bool m_bIsData;
00123 bool m_bIsConfigured;
00124
00125 const xAOD::TruthParticleContainer* m_xTruthParticleContainer;
00126 const xAOD::TruthParticleContainer* m_xTruthTauContainerConst;
00127 const xAOD::TruthParticleContainer* m_xTruthMuonContainerConst;
00128 const xAOD::TruthParticleContainer* m_xTruthElectronContainerConst;
00129 const xAOD::JetContainer* m_xTruthJetContainerConst;
00130 xAOD::TruthParticleContainer* m_xTruthTauContainer;
00131 xAOD::TruthParticleAuxContainer* m_xTruthTauAuxContainer;
00132
00133
00134 double m_dMaxDeltaR;
00135 bool m_bWriteTruthTaus;
00136 std::string m_sNewTruthTauContainerName;
00137 std::string m_sNewTruthTauContainerNameAux;
00138 std::string m_sTruthTauContainerName;
00139 std::string m_sTruthMuonContainerName;
00140 std::string m_sTruthElectronContainerName;
00141 std::string m_sTruthJetContainerName;
00142 std::string m_sTruthParticlesContainerName;
00143
00144 bool m_bTruthTauAvailable;
00145 bool m_bTruthMuonAvailable;
00146 bool m_bTruthElectronAvailable;
00147 bool m_bTruthJetAvailable;
00148
00149 bool m_bWriteInvisibleFourMomentum;
00150 bool m_bWriteVisibleChargedFourMomentum;
00151 bool m_bWriteVisibleNeutralFourMomentum;
00152 bool m_bWriteDecayModeVector;
00153
00154 size_t m_iNChargedPions;
00155 size_t m_iNNeutralPions;
00156 size_t m_iNChargedOthers;
00157 size_t m_iNNeutralOthers;
00158 size_t m_iNChargedDaughters;
00159 std::vector<int> m_vDecayMode;
00160
00161 TLorentzVector m_vTruthVisTLV;
00162 TLorentzVector m_vTruthVisTLVCharged;
00163 TLorentzVector m_vTruthVisTLVNeutral;
00164
00165 bool m_bIsHadronicTau;
00166
00167 private:
00168 mutable bool m_bIsTruthMatchedAvailable;
00169 mutable bool m_bIsTruthMatchedAvailableChecked;
00170 mutable bool m_bNewEvent;
00171
00172 SG::AuxElement::ConstAccessor<double> m_accPtVis;
00173 SG::AuxElement::ConstAccessor<double> m_accEtaVis;
00174 SG::AuxElement::ConstAccessor<double> m_accPhiVis;
00175 SG::AuxElement::ConstAccessor<double> m_accMVis;
00176
00177 asg::AnaToolHandle<IMCTruthClassifier> m_tMCTruthClassifier;
00178
00179 };
00180
00181 }
00182 #endif // TAUANALYSISTOOLS_TAUTRUTHMATCHINGTOOL_H