00001 #ifndef ELECTRONCHARGECORRECTION__ELECTRONCHARGECORRECTIONTOOL__H
00002 #define ELECTRONCHARGECORRECTION__ELECTRONCHARGECORRECTIONTOOL__H
00003
00004 #include "AsgTools/AsgTool.h"
00005
00006 #include "AsgAnalysisInterfaces/IEfficiencyScaleFactorTool.h"
00007 #include "PATInterfaces/ISystematicsTool.h"
00008 #include "TH2.h"
00009
00010 #include "AthContainers/AuxElement.h"
00011 #include "xAODEgamma/ElectronFwd.h"
00012
00013 #include <string>
00014 #include <vector>
00015 #include <map>
00016
00017
00018 namespace xAOD {
00019 class IParticle;
00020 }
00021
00022
00023
00024 namespace CP {
00025
00026 class ElectronChargeEfficiencyCorrectionTool
00027 : virtual public CP::IEfficiencyScaleFactorTool,
00028 public asg::AsgTool
00029 {
00030 ASG_TOOL_CLASS2(ElectronChargeEfficiencyCorrectionTool, CP::IEfficiencyScaleFactorTool, CP:: ISystematicsTool)
00031
00032 public:
00033
00035 ElectronChargeEfficiencyCorrectionTool(const std::string name);
00036
00037
00039 virtual ~ElectronChargeEfficiencyCorrectionTool();
00040
00041
00042
00043
00044
00045
00046
00047
00048 public:
00050 virtual StatusCode initialize();
00051
00053 virtual StatusCode finalize();
00054
00056 virtual CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::IParticle& part, double& sf) const;
00057
00059 virtual CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::IParticle& part) const;
00060
00062
00063
00065 virtual bool isAffectedBySystematic( const SystematicVariation& systematic ) const;
00066
00068 virtual SystematicSet affectingSystematics() const;
00069
00071 virtual CP::SystematicSet recommendedSystematics() const;
00072
00073 virtual CP::SystematicCode applySystematicVariation( const SystematicSet& systConfig );
00074
00075 CP::SystematicCode registerSystematics();
00076
00078 const CP::SystematicSet& appliedSystematics() const {
00079 return *m_appliedSystematics;
00080 }
00081
00082
00083
00084
00085
00086 private:
00087
00089 float getChargeFlipRate( double eta, double pt, TH2D *hrates, double& flipRate) const;
00090
00092 CP::CorrectionCode getEleTruthCharge( const xAOD::Electron& ele, int& truthcharge) const;
00093
00095 CP::CorrectionCode isGoodEle( const xAOD::Electron& ele, bool& goodele) const;
00096
00098 int m_dataTypeOverwrite;
00099
00100
00102 std::string m_eventInfoCollectionName;
00103
00105 std::map<std::string, std::vector<TH2D*> > m_SF_SS;
00106 std::map<std::string, std::vector<TH2D*> > m_SF_OS;
00107
00108
00109 std::vector<unsigned int> m_RunNumbers;
00110 bool m_useRandomRunNumber;
00111 unsigned int m_defaultRandomRunNumber;
00112
00114 std::string m_filename;
00115
00117 std::string m_workingPoint;
00118
00120 double m_eta_lowlimit;
00121
00123 double m_eta_uplimit;
00124
00126 double m_pt_lowlimit;
00127
00129 double m_pt_uplimit;
00130
00132 float m_gevmev;
00133
00134
00136 mutable int m_truthCharge;
00137
00138
00139
00141
00142
00143
00144 std::vector<std::string> m_systematics;
00145
00146 std::map<CP::SystematicSet, CP::SystematicSet> m_filtered_sys_sets;
00147
00148 CP::SystematicSet m_mySysConf;
00149 CP::SystematicSet m_affectingSys;
00150
00152 CP::SystematicSet* m_appliedSystematics;
00153
00155 std::string m_sf_decoration_name;
00156 SG::AuxElement::Decorator< float >* m_sfDec;
00157
00158
00159 };
00160
00161 }
00162
00163 #endif
00164
00166
00167
00169
00170