00001 #ifndef IsolationSelection_IsolationCloseByCorrectionTool_H 00002 #define IsolationSelection_IsolationCloseByCorrectionTool_H 00003 00004 #include "AsgTools/AsgTool.h" 00005 #include "AsgTools/AnaToolHandle.h" 00006 00007 #include "IsolationSelection/IIsolationCloseByCorrectionTool.h" 00008 #include "IsolationSelection/IIsolationSelectionTool.h" 00009 00010 #include "xAODTracking/VertexContainer.h" 00011 00012 #include "xAODTracking/TrackParticleContainer.h" 00013 #include "xAODTracking/TrackParticle.h" 00014 #include "InDetTrackSelectionTool/InDetTrackSelectionTool.h" 00015 00016 namespace CP { 00017 00018 class IsolationCloseByCorrectionTool : public asg::AsgTool, 00019 public virtual IIsolationCloseByCorrectionTool { 00020 00021 ASG_TOOL_CLASS(IsolationCloseByCorrectionTool, IIsolationCloseByCorrectionTool) 00022 00023 public: 00024 IsolationCloseByCorrectionTool (const std::string& name); 00025 virtual ~IsolationCloseByCorrectionTool(){}; 00026 00027 virtual StatusCode initialize(); 00028 virtual StatusCode finalize(); 00029 00030 virtual const CP::CorrectionCode getCloseByCorrection(std::vector<float>& corrections, const xAOD::IParticle& par, const std::vector<xAOD::Iso::IsolationType>& types, const std::vector<const xAOD::IParticle*>& closePar, int topoetconeModel = -1) const; 00031 00032 virtual const Root::TAccept& acceptCorrected(const xAOD::IParticle& x, const std::vector<const xAOD::IParticle*>& closePar, int topoetconeModel = -1) const; 00033 00034 private: 00035 const xAOD::TrackParticle* getTrackParticle(const xAOD::IParticle& par) const; 00036 const CP::CorrectionCode getCloseByCorrectionTrackIso(float& correction, const xAOD::IParticle& par, xAOD::Iso::IsolationType type, const std::vector<const xAOD::IParticle*>& closePar) const; 00037 const CP::CorrectionCode getCloseByCorrectionTopoetcone(float& correction, const xAOD::IParticle& par, xAOD::Iso::IsolationType type, const std::vector<const xAOD::IParticle*>& closePar, int topoetconeModel = -1) const; 00038 const xAOD::Vertex* retrieveIDBestPrimaryVertex() const; 00039 const CP::CorrectionCode getExtrapEtaPhi(const xAOD::IParticle& par, float& eta, float& phi) const; 00040 xAOD::Iso::IsolationType getIsolationTypeFromString(const TString& isoTypeString, xAOD::Type::ObjectType particleType) const; 00041 00042 static constexpr float m_2PI = 2*M_PI; 00043 inline float phiInRange(float phi) const { 00044 while (phi >= M_PI) phi -= m_2PI; 00045 while (phi < -M_PI) phi += m_2PI; 00046 return phi; 00047 } 00048 00049 inline float getMax(float f1, float f2) const { 00050 if(f1 >= f2) { 00051 return f1; 00052 } else { 00053 return f2; 00054 } 00055 } 00056 00057 inline float getMin(float f1, float f2) const { 00058 if(f1 <= f2) { 00059 return f1; 00060 } else { 00061 return f2; 00062 } 00063 } 00064 00065 ToolHandle<CP::IIsolationSelectionTool> m_selectorTool; 00066 float m_coreCone; 00067 float m_ptvarconeRadius; 00068 mutable Root::TAccept m_accept; 00069 bool m_isInitialised; 00070 bool m_isCoreSubtracted; 00071 std::string m_indetTrackParticleLocation; 00072 std::vector<xAOD::Iso::IsolationType> m_muon_isoTypes; 00073 std::vector<xAOD::Iso::IsolationType> m_electron_isoTypes; 00074 std::vector<xAOD::Iso::IsolationType> m_photon_isoTypes; 00075 00076 asg::AnaToolHandle<InDet::IInDetTrackSelectionTool> m_trkselTool; 00077 00078 }; 00079 } 00080 #endif