00001
00002
00003 #ifndef __ASGELECTRONEFFICIENCYCORRECTIONTOOL__
00004 #define __ASGELECTRONEFFICIENCYCORRECTIONTOOL__
00005
00014
00015 #include <vector>
00016 #include <string>
00017 #include <iterator>
00018 #include <map>
00019
00020 #include "boost/unordered_map.hpp"
00021
00022 #include "PATCore/TResult.h"
00023 #include "AthContainers/AuxElement.h"
00024
00025 #include "AsgTools/AsgTool.h"
00026 #include "AsgTools/AsgMetadataTool.h"
00027
00028 #include "PATInterfaces/ISystematicsTool.h"
00029 #include "PATInterfaces/SystematicRegistry.h"
00030 #include "PATInterfaces/CorrectionCode.h"
00031 #include "ElectronEfficiencyCorrection/TElectronEfficiencyCorrectionTool.h"
00032 #include "ElectronEfficiencyCorrection/IAsgElectronEfficiencyCorrectionTool.h"
00033 #include "xAODEgamma/ElectronFwd.h"
00034
00035 class AsgElectronEfficiencyCorrectionTool
00036 : virtual public IAsgElectronEfficiencyCorrectionTool, public asg::AsgMetadataTool
00037 {
00038 ASG_TOOL_CLASS(AsgElectronEfficiencyCorrectionTool, IAsgElectronEfficiencyCorrectionTool)
00039
00040 public:
00042 AsgElectronEfficiencyCorrectionTool ( const std::string myname );
00043
00045 virtual ~AsgElectronEfficiencyCorrectionTool();
00046
00047
00048 public:
00050 virtual StatusCode initialize();
00051
00053 virtual StatusCode finalize();
00054
00055
00056 virtual StatusCode beginInputFile();
00057 virtual StatusCode beginEvent();
00058 virtual StatusCode endInputFile();
00059
00060
00061 public:
00062
00063 int getNumberOfToys( ){return m_number_of_toys;} ;
00064
00065
00066 CP::CorrectionCode getEfficiencyScaleFactor(const xAOD::Electron& inputObject, double& efficiencyScaleFactor) const;
00067 CP::CorrectionCode applyEfficiencyScaleFactor(const xAOD::Electron& inputObject) const;
00068
00070 void printCorrelationModels() {
00071 ATH_MSG_INFO(" Available Correlation Models for the ElectronEfficiencyCorrectionTool");
00072 ATH_MSG_INFO("FULL");
00073 ATH_MSG_INFO("SIMPLIFIED");
00074 ATH_MSG_INFO("MCTOYS");
00075 ATH_MSG_INFO("SYST");
00076 ATH_MSG_INFO("COMBMCTOYS");
00077 ATH_MSG_INFO("TOTAL");
00078 } ;
00079
00081 virtual bool isAffectedBySystematic( const CP::SystematicVariation& systematic ) const ;
00082
00084 virtual CP::SystematicSet affectingSystematics() const ;
00085
00087 virtual CP::SystematicSet recommendedSystematics() const ;
00088
00090 const CP::SystematicSet& appliedSystematics() const {
00091 return *m_appliedSystematics;
00092 }
00093
00095 virtual CP::SystematicCode applySystematicVariation ( const CP::SystematicSet& systConfig ) ;
00096
00097 CP::SystematicCode registerSystematics();
00098
00099
00100 private:
00101
00102 bool m_metadata_retrieved = false;
00103
00104
00105 StatusCode get_simType_from_metadata(PATCore::ParticleDataType::DataType& result) const;
00106
00107
00109 const Root::TResult& calculate( const xAOD::Electron& egam, const unsigned int runnumber, int ¤tElectronSimplifiedUncorrSystRegion, int& currentElectronUncorrSystRegion ) const ;
00110 CP::SystematicCode InitSystematics();
00111
00112
00113 struct SystConf{
00114 float m_total;
00115 unsigned m_toy_index;
00116 float m_toy_scale;
00117 };
00118
00119
00120 virtual StatusCode getFile(const std::string& recokey, const std::string& idkey, const std::string& isokey, const std::string& trigkey);
00121
00122
00123
00124 std::string convertToOneKey(const std::string& recokey, const std::string& idkey, const std::string& isokey, const std::string& trigkey) const;
00125
00126
00127
00128 std::string getValueByKey(const std::string& mapFile, const std::string& key);
00129
00130
00131
00132 StatusCode read (const std::string& strFile);
00133
00134
00135
00136
00137
00138 std::string getValue(const std::string& strKey, std::string& strValue);
00139
00141 Root::TElectronEfficiencyCorrectionTool* m_rootTool;
00142
00144 Root::TResult m_resultDummy;
00145
00147 boost::unordered_map<CP::SystematicSet, CP::SystematicSet> m_systFilter;
00148
00150 CP::SystematicSet m_affectedSys;
00151
00153 CP::SystematicSet* m_appliedSystematics;
00154
00155
00156 std::string m_correlation_model_name;
00157 int m_correlation_model;
00158
00159
00160 std::map<std::string,std::string> m_map;
00161 std::string m_mapFile;
00162
00163
00164 std::string m_recoKey;
00165 std::string m_idKey;
00166 std::string m_isoKey;
00167 std::string m_trigKey;
00168
00170 std::vector< std::string > m_corrFileNameList;
00171
00173 std::string m_resultPrefix;
00174
00176 std::string m_resultName;
00177
00178
00179 std::string m_sysSubstring;
00180
00182 std::string m_eventInfoCollectionName;
00183
00184
00185 bool m_useRandomRunNumber;
00186 unsigned int m_defaultRandomRunNumber;
00187
00188
00189 PATCore::ParticleDataType::DataType m_dataType;
00190
00192 int m_dataTypeOverwrite;
00193
00194
00195 int m_number_of_toys;
00196
00197
00198 int m_seed_toys;
00199
00200
00201 double m_scale_toys;
00202
00203
00204 int m_nCorrSyst;
00205 int m_nUncorrSyst ;
00206 std::map<float, std::vector<float> > m_pteta_bins;
00207
00208
00209 TH2F * m_UncorrRegions;
00210 int m_nSimpleUncorrSyst;
00211
00212 };
00213
00214
00215
00216 #endif