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
00077 private:
00078
00080 float getChargeFlipRate( double eta, double pt, TH2D *hrates, double& flipRate) const;
00081
00083 CP::CorrectionCode getEleTruthCharge( const xAOD::Electron& ele, int& truthcharge) const;
00084
00086 CP::CorrectionCode isGoodEle( const xAOD::Electron& ele, bool& goodele) const;
00087
00089 int m_dataTypeOverwrite;
00090
00091
00093 std::string m_eventInfoCollectionName;
00094
00096 std::map<std::string, std::vector<TH2D*> > m_SF_SS;
00097 std::map<std::string, std::vector<TH2D*> > m_SF_OS;
00098
00099
00100 std::vector<unsigned int> m_RunNumbers;
00101 bool m_useRandomRunNumber;
00102 unsigned int m_defaultRandomRunNumber;
00103
00105 std::string m_filename;
00106
00108 std::string m_workingPoint;
00109
00111 double m_eta_lowlimit;
00112
00114 double m_eta_uplimit;
00115
00117 double m_pt_lowlimit;
00118
00120 double m_pt_uplimit;
00121
00123 float m_gevmev;
00124
00125
00127 mutable int m_truthCharge;
00128
00129
00130
00132
00133
00134
00135 std::vector<std::string> m_systematics;
00136
00137 std::map<CP::SystematicSet, CP::SystematicSet> m_filtered_sys_sets;
00138
00139 CP::SystematicSet m_mySysConf;
00140 CP::SystematicSet m_affectingSys;
00141
00143 std::string m_sf_decoration_name;
00144 SG::AuxElement::Decorator< float >* m_sfDec;
00145
00146
00147 };
00148
00149 }
00150
00151 #endif
00152
00154
00155
00157
00158