00001 #ifndef ISOLATIONCORRECTION_ISOLATIONCORRECTION_H
00002 #define ISOLATIONCORRECTION_ISOLATIONCORRECTION_H
00003
00004 #include "AsgTools/AsgTool.h"
00005 #include "AsgTools/AsgMessaging.h"
00006 #include "TGraph.h"
00007 #include "TObject.h"
00008 #include "TF1.h"
00009
00010 #include "IsolationCorrections/ShowerDepthTool.h"
00011
00012 #include "xAODEventInfo/EventInfo.h"
00013 #include "xAODTracking/TrackParticleFwd.h"
00014 #include "xAODEgamma/EgammaFwd.h"
00015 #include "xAODPrimitives/IsolationType.h"
00016
00017 namespace CP {
00018
00019 class IsolationCorrection : public asg::AsgMessaging{
00020
00021
00022 public:
00023 IsolationCorrection(std::string name);
00024 ~IsolationCorrection();
00025
00026 StatusCode initialize();
00027 StatusCode finalize();
00028
00029 typedef enum { ELECTRON=0, PHOTON=1 } ParticleType;
00030 typedef enum { REL17=1, REL17_2=2, REL20=6, REL20_2=7 } Version;
00031
00032 void SetCorrectionFile( std::string corr_file, std::string corr_ddshift_file, std::string corr_ddsmearing_file,
00033 std::string corr_ddshift_2015_file);
00034 void SetToolVer(CP::IsolationCorrection::Version);
00035
00036 float GetPtCorrectedIsolation(const xAOD::Egamma&, const xAOD::Iso::IsolationType);
00037 float GetPtCorrection(const xAOD::Egamma&, const xAOD::Iso::IsolationType) const;
00038 float GetDDCorrection(const xAOD::Egamma&) const;
00039 float GetDDCorrection_2015(const xAOD::Egamma&, const xAOD::Iso::IsolationType) const;
00040
00041 float GetEtaPointing(const xAOD::Egamma*);
00042
00043 void SetDataMC(bool is_mc);
00044 void SetDataMC(const xAOD::EventInfo*);
00045 void SetAFII(bool AFII_corr);
00046
00047 void SetCorrectEtcone(bool correct_etcone);
00048 void SetTroubleCategories(bool trouble_categories);
00049
00050 private:
00051
00052 CP::IsolationCorrection::Version m_tool_ver;
00053
00054 std::vector<float> m_eta_bins_fine;
00055 std::vector<float> m_eta_bins_coarse;
00056 std::vector<float> m_eta_bins_dd;
00057 std::vector<float> m_eta_bins_dd_2015;
00058 const unsigned int m_nBinsEtaFine;
00059 const unsigned int m_nBinsEtaCoarse;
00060 const unsigned int m_nBinsEtaDD;
00061 const unsigned int m_nBinsEtaDD_2015;
00062 std::string m_corr_file;
00063 std::string m_corr_ddshift_2015_file;
00064 std::string m_corr_ddshift_file;
00065 std::string m_corr_ddsmearing_file;
00066
00067
00068 unsigned int m_nBinsfEtaDD_2015;
00069 std::vector<float> m_feta_bins_dd_2015;
00070
00071 bool m_is_mc;
00072 bool m_AFII_corr;
00073 bool m_set_mc;
00074 bool m_correct_etcone;
00075 bool m_trouble_categories;
00076
00077 CP::ShowerDepthTool* m_shower;
00078
00079
00080 bool m_isv2;
00081 bool m_isv3;
00082
00083 template <class T> void FreeClear( T & cntr );
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 float GetPtCorrectedIsolation(float energy,
00094 float etaS2,
00095 float etaPointing,
00096 float etaCluster,
00097 float radius,
00098 bool is_mc,
00099 float Etcone_value,
00100 bool isConversion = false,
00101 ParticleType parttype = ELECTRON);
00102
00103
00104
00105
00106 float GetPtCorrectedTopoIsolation(float energy,
00107 float etaS2,
00108 float etaPointing,
00109 float etaCluster,
00110 float radius,
00111 bool is_mc,
00112 float Etcone_value,
00113 bool isConversion = false,
00114 ParticleType parttype = ELECTRON,
00115 Version ver = REL17_2);
00116
00117
00118
00119
00120
00121
00122 float GetPtCorrectedIsolationError(float energy,
00123 float etaS2,
00124 float etaPointing,
00125 float etaCluster,
00126 float radius,
00127 bool is_mc,
00128 ParticleType parttype = ELECTRON,
00129 Version ver = REL17_2);
00130
00131 void setEtaBins();
00132 void setIsolCorr();
00133
00134 void set2011Corr();
00135 void set2012Corr();
00136 void set2015Corr();
00137 void setDDCorr();
00138 void setDDCorr_2015();
00139
00140 void load2012Corr();
00141 void load2015Corr();
00142 void loadDDCorr();
00143 void load2015DDCorr();
00144
00145 float getPtAtFirstMeasurement( const xAOD::TrackParticle* tp) const;
00146 int GetConversionType(int conversion_flag, float conv_radius, float conv_ratio) const;
00147
00148
00149
00150
00151
00152
00153 float GetPtCorrection (float energy, float etaS2, float etaPointing, float etaCluster,
00154 float radius, bool is_mc=true,
00155 bool isConversion=false, ParticleType parttype = ELECTRON) const;
00156
00157 float GetPtCorrectionTopo (float energy, float etaS2, float etaPointing, float etaCluster,
00158 float radius, bool is_mc=true,
00159 bool isConversion=false, ParticleType parttype = ELECTRON, Version ver = REL17_2,
00160 int convFlag_int=0, int author=0, float conv_radius=0., float conv_ratio=0.) const;
00161 int GetRadius(float radius) const;
00162 int GetEtaBinFine(float eta) const;
00163 int GetEtaBinCoarse(float eta) const;
00164 int GetEtaBinDD(float eta) const;
00165
00166 float GetPtCorrectionFactor(float eta, std::vector<float> mc_leakage_corrections_ptr =std::vector<float>(),
00167 std::vector<float> data_leakage_corrections_ptr= std::vector<float>()) const;
00168 float GetPtCorrectionValue(float energy, float etaPointing, float etaCluster, float scale_factor) const;
00169 float GetPtCorrection_FromGraph(float energy,float etaS2,float etaPointing,float etaCluster,float radius,bool isConversion,ParticleType parttype) const;
00170 float GetPtCorrection_FromGraph_2015(float energy, float etaS2, float radius, int conversion_flag, int author, float conv_radius, float conv_ratio, ParticleType parttype) const;
00171
00172
00173
00174
00175
00176
00177 std::vector<TGraph*> m_graph_dd_2015_cone40_unconv_photon_shift;
00178 std::vector<TGraph*> m_graph_dd_2015_cone40_conv_photon_shift;
00179 std::vector<TGraph*> m_graph_dd_2015_cone20_unconv_photon_shift;
00180 std::vector<TGraph*> m_graph_dd_2015_cone20_conv_photon_shift;
00181
00182
00183
00184
00185
00186
00187 std::vector<TF1*> m_graph_dd_cone40_photon_shift;
00188 std::vector<TF1*> m_graph_dd_cone40_photon_smearing;
00189
00190
00191
00192
00193
00194
00195 std::vector<TF1*> m_function_2015_cone40_photon_unconverted;
00196 std::vector<TF1*> m_function_2015_cone30_photon_unconverted;
00197 std::vector<TF1*> m_function_2015_cone20_photon_unconverted;
00198
00199 std::vector<TF1*> m_function_2015_cone40_photon_converted_ok;
00200 std::vector<TF1*> m_function_2015_cone30_photon_converted_ok;
00201 std::vector<TF1*> m_function_2015_cone20_photon_converted_ok;
00202
00203 std::vector<TF1*> m_function_2015_cone40_photon_converted_trouble;
00204 std::vector<TF1*> m_function_2015_cone30_photon_converted_trouble;
00205 std::vector<TF1*> m_function_2015_cone20_photon_converted_trouble;
00206
00207 std::vector<TF1*> m_function_2015_cone40_author_1_electron;
00208 std::vector<TF1*> m_function_2015_cone30_author_1_electron;
00209 std::vector<TF1*> m_function_2015_cone20_author_1_electron;
00210
00211 std::vector<TF1*> m_function_2015_cone40_author_16_electron;
00212 std::vector<TF1*> m_function_2015_cone30_author_16_electron;
00213 std::vector<TF1*> m_function_2015_cone20_author_16_electron;
00214
00215
00216 std::vector<TGraph*> m_graph_histoMean_2015_cone40_photon_converted_trouble;
00217 std::vector<TGraph*> m_graph_histoMean_2015_cone30_photon_converted_trouble;
00218 std::vector<TGraph*> m_graph_histoMean_2015_cone20_photon_converted_trouble;
00219
00220 std::vector<TGraph*> m_graph_histoMean_2015_cone40_author_16_electron;
00221 std::vector<TGraph*> m_graph_histoMean_2015_cone30_author_16_electron;
00222 std::vector<TGraph*> m_graph_histoMean_2015_cone20_author_16_electron;
00223
00224
00225
00226
00227
00228
00229
00230 std::vector<TGraph*> m_graph_cone40_photon_unconverted;
00231 std::vector<TGraph*> m_graph_cone30_photon_unconverted;
00232 std::vector<TGraph*> m_graph_cone20_photon_unconverted;
00233
00234 std::vector<TGraph*> m_graph_cone40_photon_converted;
00235 std::vector<TGraph*> m_graph_cone30_photon_converted;
00236 std::vector<TGraph*> m_graph_cone20_photon_converted;
00237
00238 std::vector<TGraph*> m_graph_cone40_electron;
00239 std::vector<TGraph*> m_graph_cone30_electron;
00240 std::vector<TGraph*> m_graph_cone20_electron;
00241
00242
00243
00244
00245
00246
00247 std::vector<float> m_mc_rel17_leakage_correction_slopes_electron_15;
00248 std::vector<float> m_mc_rel17_leakage_correction_slopes_electron_20;
00249 std::vector<float> m_mc_rel17_leakage_correction_slopes_electron_25;
00250 std::vector<float> m_mc_rel17_leakage_correction_slopes_electron_30;
00251 std::vector<float> m_mc_rel17_leakage_correction_slopes_electron_35;
00252 std::vector<float> m_mc_rel17_leakage_correction_slopes_electron_40;
00253
00254 std::vector<float> m_mc_rel17_leakage_correction_offsets_electron_15;
00255 std::vector<float> m_mc_rel17_leakage_correction_offsets_electron_20;
00256 std::vector<float> m_mc_rel17_leakage_correction_offsets_electron_25;
00257 std::vector<float> m_mc_rel17_leakage_correction_offsets_electron_30;
00258 std::vector<float> m_mc_rel17_leakage_correction_offsets_electron_35;
00259 std::vector<float> m_mc_rel17_leakage_correction_offsets_electron_40;
00260
00261
00262 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_converted_15;
00263 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_converted_20;
00264 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_converted_25;
00265 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_converted_30;
00266 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_converted_35;
00267 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_converted_40;
00268
00269 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_converted_15;
00270 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_converted_20;
00271 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_converted_25;
00272 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_converted_30;
00273 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_converted_35;
00274 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_converted_40;
00275
00276 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_unconverted_15;
00277 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_unconverted_20;
00278 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_unconverted_25;
00279 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_unconverted_30;
00280 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_unconverted_35;
00281 std::vector<float> m_mc_rel17_leakage_correction_slopes_photon_unconverted_40;
00282
00283 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_unconverted_15;
00284 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_unconverted_20;
00285 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_unconverted_25;
00286 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_unconverted_30;
00287 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_unconverted_35;
00288 std::vector<float> m_mc_rel17_leakage_correction_offsets_photon_unconverted_40;
00289
00290 };
00291
00292 }
00293
00294 #endif