00001 // Dear emacs, this is -*-c++-*- 00002 00003 #ifndef __ASGPHOTONEFFICIENCYCORRECTIONTOOL__ 00004 #define __ASGPHOTONEFFICIENCYCORRECTIONTOOL__ 00005 00014 // STL includes 00015 #include <vector> 00016 #include <string> 00017 #include <fstream> // std::ifstream 00018 00019 // Utility includes 00020 #include "boost/unordered_map.hpp" 00021 #include "boost/algorithm/string.hpp" // this one to replace std::string names 00022 00023 // Include the return object and the underlying ROOT tool 00024 #include "PATCore/TResult.h" 00025 00026 //xAOD includes 00027 #include "AsgTools/AsgTool.h" 00028 #include "PATInterfaces/ISystematicsTool.h" 00029 #include "PATInterfaces/SystematicRegistry.h" 00030 #include "PATInterfaces/CorrectionCode.h" 00031 #include "PhotonEfficiencyCorrection/TPhotonEfficiencyCorrectionTool.h" 00032 #include "PhotonEfficiencyCorrection/IAsgPhotonEfficiencyCorrectionTool.h" 00033 00034 #include "xAODEgamma/Egamma.h" 00035 00036 00037 00038 00039 class AsgPhotonEfficiencyCorrectionTool 00040 : virtual public IAsgPhotonEfficiencyCorrectionTool, 00041 virtual public CP::ISystematicsTool, 00042 public asg::AsgTool 00043 { 00044 ASG_TOOL_CLASS2(AsgPhotonEfficiencyCorrectionTool, IAsgPhotonEfficiencyCorrectionTool, CP::ISystematicsTool ) 00045 00046 public: 00048 AsgPhotonEfficiencyCorrectionTool ( const std::string myname ); 00049 00051 virtual ~AsgPhotonEfficiencyCorrectionTool(); 00052 00053 00054 public: 00056 virtual StatusCode initialize(); 00057 00059 virtual StatusCode finalize(); 00060 00061 00062 // Main methods from IUserDataCalcTool 00063 public: 00065 const Root::TResult& calculate( const xAOD::IParticle* part ) const; 00066 const Root::TResult& calculate( const xAOD::Egamma* egam ) const; 00067 const Root::TResult& calculate( const xAOD::Egamma& egam ) const{ 00068 return calculate(&egam);} // pass the Egamma obj by reference 00069 00071 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Egamma& inputObject, double& efficiencyScaleFactor) const; 00072 virtual CP::CorrectionCode getEfficiencyScaleFactorError(const xAOD::Egamma& inputObject, double& efficiencyScaleFactorError) const; 00073 virtual CP::CorrectionCode applyEfficiencyScaleFactor(xAOD::Egamma& inputObject) const; 00074 00076 00078 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const; 00079 00081 virtual CP::SystematicSet affectingSystematics() const ; 00082 00084 virtual CP::SystematicSet recommendedSystematics() const ; 00085 00087 const CP::SystematicSet& appliedSystematics() const { 00088 assert (m_appliedSystematics != nullptr); 00089 return *m_appliedSystematics; 00090 } 00091 00093 virtual CP::SystematicCode applySystematicVariation ( const CP::SystematicSet& systConfig ); 00094 00095 CP::SystematicCode registerSystematics(); 00096 00097 // Private member variables 00098 private: 00100 Root::TPhotonEfficiencyCorrectionTool* m_rootTool_unc; 00101 Root::TPhotonEfficiencyCorrectionTool* m_rootTool_con; 00103 Root::TPhotonEfficiencyCorrectionTool* m_rootTool_uncRadZ; 00104 Root::TPhotonEfficiencyCorrectionTool* m_rootTool_conRadZ; 00105 00107 Root::TResult m_resultDummy; 00108 00110 boost::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter; 00111 00113 CP::SystematicSet* m_appliedSystematics = nullptr; 00114 00115 // The prefix for the systematic name 00116 std::string m_sysSubstring; 00117 std::string m_sysSubstringRadZ; 00118 00119 // Get the correction filename from the map 00120 std::string getFileName(std::string isoWP, bool isConv, std::string sufix); 00121 00122 // Properties 00123 00125 std::string m_corrFileNameConv; 00126 std::string m_corrFileNameUnconv; 00127 00129 std::string m_resultPrefix; 00130 00132 std::string m_resultName; 00133 00135 int m_dataTypeOverwrite; 00136 00138 std::string m_isoWP; 00139 00141 std::string m_mapFile; 00142 00144 float m_Threshold_lowPT; 00145 float m_Threshold_highPT; 00146 bool m_UseRadZ_mediumPT; 00147 00148 00149 00150 }; // End: class definition 00151 00152 00153 #endif 00154