00001 #ifndef FudgeMCTool_h
00002 #define FudgeMCTool_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <iostream>
00016 #include <stdio.h>
00017 #include <cmath>
00018
00019 #include "PtEtaCollection.h"
00020
00021 #include "TGraphErrors.h"
00022 #include "TH2D.h"
00023
00024
00025 namespace IDVAR
00026 {
00027 const int RHAD1 = 0;
00028 const int RHAD = 1;
00029 const int E277 = 2;
00030 const int RETA = 3;
00031 const int RPHI = 4;
00032 const int WETA2 = 5;
00033 const int F1 = 6;
00034 const int FSIDE = 7;
00035 const int WTOT = 8;
00036 const int W1 = 9;
00037 const int DE = 10;
00038 const int ERATIO = 11;
00039 }
00040
00041 class FudgeMCTool
00042 {
00043
00044 public:
00045
00046
00047 FudgeMCTool( double pt = -999.,
00048 double eta2 = -999.,
00049 int isConv = -1 ,
00050 int preselection = -1 );
00051
00052 ~FudgeMCTool();
00053
00054
00055 void FudgeShowers( double pt ,
00056 double eta2 ,
00057 double& rhad1 ,
00058 double& rhad ,
00059 double& e277 ,
00060 double& reta ,
00061 double& rphi ,
00062 double& weta2 ,
00063 double& f1 ,
00064 double& fside ,
00065 double& wtot ,
00066 double& w1 ,
00067 double& deltae ,
00068 double& eratio ,
00069 int isConv ,
00070 int preselection=-999);
00071
00072
00073 void FudgeShowers( float pt ,
00074 float eta2 ,
00075 float& rhad1 ,
00076 float& rhad ,
00077 float& e277 ,
00078 float& reta ,
00079 float& rphi ,
00080 float& weta2 ,
00081 float& f1 ,
00082 float& fside ,
00083 float& wtot ,
00084 float& w1 ,
00085 float& deltae ,
00086 float& eratio ,
00087 int isConv ,
00088 int preselection=-999);
00089
00090
00091 void FudgeShowers( std::vector<float> clE,
00092 std::vector<float> eta2 ,
00093 std::vector<float>& rhad1 ,
00094 std::vector<float>& rhad ,
00095 std::vector<float>& e277 ,
00096 std::vector<float>& reta ,
00097 std::vector<float>& rphi ,
00098 std::vector<float>& weta2 ,
00099 std::vector<float>& f1 ,
00100 std::vector<float>& fside ,
00101 std::vector<float>& wtot ,
00102 std::vector<float>& w1 ,
00103 std::vector<float>& deltae ,
00104 std::vector<float>& eratio ,
00105 std::vector<int> isConv ,
00106 int preselection=-999);
00107
00111 static std::vector<float>* getEratio(std::vector<float> emaxs1, std::vector<float> Emax2)
00112 {
00113 std::vector<float> *eratio = new std::vector<float>();
00114 for (unsigned int i = 0; i < emaxs1.size(); ++i)
00115 eratio->push_back(emaxs1[i] + Emax2[i] == 0 ? 0 :
00116 (emaxs1[i] - Emax2[i])/(emaxs1[i] + Emax2[i]));
00117 return eratio;
00118 }
00119
00120
00121 double GetFF_Rhad1 ( double pt, double eta2 ){ return m_rhad1_ff.Get(pt, fabs(eta2)); };
00122 double GetFF_Rhad ( double pt, double eta2 ){ return m_rhad_ff.Get(pt, fabs(eta2)); };
00123 double GetFF_E277 ( double pt, double eta2 ){ return m_e277_ff.Get(pt, fabs(eta2)); };
00124 double GetFF_Reta ( double pt, double eta2 ){ return m_reta_ff.Get(pt, fabs(eta2)); };
00125 double GetFF_Rphi ( double pt, double eta2 ){ return m_rphi_ff.Get(pt, fabs(eta2)); };
00126 double GetFF_Weta2 ( double pt, double eta2 ){ return m_weta2_ff.Get(pt, fabs(eta2)); };
00127 double GetFF_F1 ( double pt, double eta2 ){ return m_f1_ff.Get(pt, fabs(eta2)); };
00128 double GetFF_DE ( double pt, double eta2 ){ return m_deltae_ff.Get(pt, fabs(eta2)); };
00129 double GetFF_Eratio( double pt, double eta2 ){ return m_eratio_ff.Get(pt, fabs(eta2)); };
00130 double GetFF_Fside ( double pt, double eta2 ){ return m_fside_ff.Get(pt, fabs(eta2)); };
00131 double GetFF_Wtot ( double pt, double eta2 ){ return m_wtot_ff.Get(pt, fabs(eta2)); };
00132 double GetFF_W1 ( double pt, double eta2 ){ return m_w1_ff.Get(pt, fabs(eta2)); };
00133
00134 double GetFF_Rhad1 ( double pt, double eta2, int conv, int preselection );
00135 double GetFF_Rhad ( double pt, double eta2, int conv, int preselection );
00136 double GetFF_E277 ( double pt, double eta2, int conv, int preselection );
00137 double GetFF_Reta ( double pt, double eta2, int conv, int preselection );
00138 double GetFF_Rphi ( double pt, double eta2, int conv, int preselection );
00139 double GetFF_Weta2 ( double pt, double eta2, int conv, int preselection );
00140 double GetFF_F1 ( double pt, double eta2, int conv, int preselection );
00141 double GetFF_DE ( double pt, double eta2, int conv, int preselection );
00142 double GetFF_Eratio( double pt, double eta2, int conv, int preselection );
00143 double GetFF_Fside ( double pt, double eta2, int conv, int preselection );
00144 double GetFF_Wtot ( double pt, double eta2, int conv, int preselection );
00145 double GetFF_W1 ( double pt, double eta2, int conv, int preselection );
00146
00147 double GetFF_Rhad1 ();
00148 double GetFF_Rhad ();
00149 double GetFF_E277 ();
00150 double GetFF_Reta ();
00151 double GetFF_Rphi ();
00152 double GetFF_Weta2 ();
00153 double GetFF_F1 ();
00154 double GetFF_DE ();
00155 double GetFF_Eratio();
00156 double GetFF_Fside ();
00157 double GetFF_Wtot ();
00158 double GetFF_W1 ();
00159
00160 double GetFFerr_Rhad1 ( double pt, double eta2 ){ return m_rhad1_fferr.Get(pt, fabs(eta2)); };
00161 double GetFFerr_Rhad ( double pt, double eta2 ){ return m_rhad_fferr.Get(pt, fabs(eta2)); };
00162 double GetFFerr_E277 ( double pt, double eta2 ){ return m_e277_fferr.Get(pt, fabs(eta2)); };
00163 double GetFFerr_Reta ( double pt, double eta2 ){ return m_reta_fferr.Get(pt, fabs(eta2)); };
00164 double GetFFerr_Rphi ( double pt, double eta2 ){ return m_rphi_fferr.Get(pt, fabs(eta2)); };
00165 double GetFFerr_Weta2 ( double pt, double eta2 ){ return m_weta2_fferr.Get(pt, fabs(eta2)); };
00166 double GetFFerr_F1 ( double pt, double eta2 ){ return m_f1_fferr.Get(pt, fabs(eta2)); };
00167 double GetFFerr_DE ( double pt, double eta2 ){ return m_deltae_fferr.Get(pt, fabs(eta2)); };
00168 double GetFFerr_Eratio( double pt, double eta2 ){ return m_eratio_fferr.Get(pt, fabs(eta2)); };
00169 double GetFFerr_Fside ( double pt, double eta2 ){ return m_fside_fferr.Get(pt, fabs(eta2)); };
00170 double GetFFerr_Wtot ( double pt, double eta2 ){ return m_wtot_fferr.Get(pt, fabs(eta2)); };
00171 double GetFFerr_W1 ( double pt, double eta2 ){ return m_w1_fferr.Get(pt, fabs(eta2)); };
00172
00173 double GetFFerr_Rhad1 ( double pt, double eta2, int conv, int preselection );
00174 double GetFFerr_Rhad ( double pt, double eta2, int conv, int preselection );
00175 double GetFFerr_E277 ( double pt, double eta2, int conv, int preselection );
00176 double GetFFerr_Reta ( double pt, double eta2, int conv, int preselection );
00177 double GetFFerr_Rphi ( double pt, double eta2, int conv, int preselection );
00178 double GetFFerr_Weta2 ( double pt, double eta2, int conv, int preselection );
00179 double GetFFerr_F1 ( double pt, double eta2, int conv, int preselection );
00180 double GetFFerr_DE ( double pt, double eta2, int conv, int preselection );
00181 double GetFFerr_Eratio( double pt, double eta2, int conv, int preselection );
00182 double GetFFerr_Fside ( double pt, double eta2, int conv, int preselection );
00183 double GetFFerr_Wtot ( double pt, double eta2, int conv, int preselection );
00184 double GetFFerr_W1 ( double pt, double eta2, int conv, int preselection );
00185
00186 double GetFFerr_Rhad1 ();
00187 double GetFFerr_Rhad ();
00188 double GetFFerr_E277 ();
00189 double GetFFerr_Reta ();
00190 double GetFFerr_Rphi ();
00191 double GetFFerr_Weta2 ();
00192 double GetFFerr_F1 ();
00193 double GetFFerr_DE ();
00194 double GetFFerr_Eratio();
00195 double GetFFerr_Fside ();
00196 double GetFFerr_Wtot ();
00197 double GetFFerr_W1 ();
00198
00199 double GetFF (int var, double pt, double eta2, int conv, int preselection){
00200 switch (var) {
00201 case IDVAR::RHAD1: return GetFF_Rhad1( pt, eta2, conv, preselection );
00202 case IDVAR::RHAD: return GetFF_Rhad( pt, eta2, conv, preselection );
00203 case IDVAR::E277: return GetFF_E277( pt, eta2, conv, preselection );
00204 case IDVAR::RETA: return GetFF_Reta( pt, eta2, conv, preselection );
00205 case IDVAR::RPHI: return GetFF_Rphi( pt, eta2, conv, preselection );
00206 case IDVAR::WETA2: return GetFF_Weta2( pt, eta2, conv, preselection );
00207 case IDVAR::F1: return GetFF_F1( pt, eta2, conv, preselection );
00208 case IDVAR::FSIDE: return GetFF_Fside( pt, eta2, conv, preselection );
00209 case IDVAR::WTOT: return GetFF_Wtot( pt, eta2, conv, preselection );
00210 case IDVAR::W1: return GetFF_W1( pt, eta2, conv, preselection );
00211 case IDVAR::DE: return GetFF_DE( pt, eta2, conv, preselection );
00212 case IDVAR::ERATIO: return GetFF_Eratio( pt, eta2, conv, preselection );
00213 default: return 0.0;
00214 }
00215 }
00216
00217
00218 double Fudge_Rhad1 ( double rhad1, double pt, double eta2){ return ( rhad1 + m_rhad1_ff.Get(pt, fabs(eta2)) );};
00219 double Fudge_Rhad ( double rhad, double pt, double eta2){ return ( rhad + m_rhad_ff.Get(pt, fabs(eta2)) );};
00220 double Fudge_E277 ( double e277, double pt, double eta2){ return ( e277 + m_e277_ff.Get(pt, fabs(eta2)) );};
00221 double Fudge_Reta ( double reta, double pt, double eta2){ return ( reta + m_reta_ff.Get(pt, fabs(eta2)) );};
00222 double Fudge_Rphi ( double rphi, double pt, double eta2){ return ( rphi + m_rphi_ff.Get(pt, fabs(eta2)) );};
00223 double Fudge_Weta2 ( double weta2, double pt, double eta2){ return ( weta2 + m_weta2_ff.Get(pt, fabs(eta2)) );};
00224 double Fudge_F1 ( double f1, double pt, double eta2){ return ( f1 + m_f1_ff.Get(pt, fabs(eta2)) );};
00225 double Fudge_DE ( double deltae, double pt, double eta2){ return ( deltae + m_deltae_ff.Get(pt, fabs(eta2)) );};
00226 double Fudge_Eratio( double eratio, double pt, double eta2){ return ( eratio + m_eratio_ff.Get(pt, fabs(eta2)) );};
00227 double Fudge_Fside ( double fside, double pt, double eta2){ return ( fside + m_fside_ff.Get(pt, fabs(eta2)) );};
00228 double Fudge_Wtot ( double wtot, double pt, double eta2){ return ( wtot + m_wtot_ff.Get(pt, fabs(eta2)) );};
00229 double Fudge_W1 ( double w1, double pt, double eta2){ return ( w1 + m_w1_ff.Get(pt, fabs(eta2)) );};
00230
00231 double Fudge_Rhad1 ( double rhad1, double pt, double eta2, int conv, int preselection );
00232 double Fudge_Rhad ( double rhad, double pt, double eta2, int conv, int preselection );
00233 double Fudge_E277 ( double e277, double pt, double eta2, int conv, int preselection );
00234 double Fudge_Reta ( double reta, double pt, double eta2, int conv, int preselection );
00235 double Fudge_Rphi ( double rphi, double pt, double eta2, int conv, int preselection );
00236 double Fudge_Weta2 ( double weta2, double pt, double eta2, int conv, int preselection );
00237 double Fudge_F1 ( double f1, double pt, double eta2, int conv, int preselection );
00238 double Fudge_DE ( double deltae, double pt, double eta2, int conv, int preselection );
00239 double Fudge_Eratio( double eratio, double pt, double eta2, int conv, int preselection );
00240 double Fudge_Fside ( double fside, double pt, double eta2, int conv, int preselection );
00241 double Fudge_Wtot ( double wtot, double pt, double eta2, int conv, int preselection );
00242 double Fudge_W1 ( double w1, double pt, double eta2, int conv, int preselection );
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 void SetPreselection ( int preselection = -1 ){ m_preselection = preselection; LoadFFs(m_conv);};
00257
00258 void SetIsConverted ( int isConv = 0 ){ m_conv = isConv;};
00259
00260 void SetPt ( double pt ){ m_pt = pt; };
00261 void SetEta ( double eta ){ m_eta2 = eta;};
00262
00263 void SetVerbose( bool verbose=true ){ m_verbose=verbose; }
00264
00265 int GetPreselection(){ return m_preselection; };
00266
00267
00268 TGraphErrors* GetFFmap (int var, double eta, int isConv, int preselection=-1);
00269
00270 TGraphErrors* GetFFmap_Rhad1 (double eta, int isConv, int preselection=-1);
00271 TGraphErrors* GetFFmap_Rhad (double eta, int isConv, int preselection=-1);
00272 TGraphErrors* GetFFmap_E277 (double eta, int isConv, int preselection=-1);
00273 TGraphErrors* GetFFmap_Reta (double eta, int isConv, int preselection=-1);
00274 TGraphErrors* GetFFmap_Rphi (double eta, int isConv, int preselection=-1);
00275 TGraphErrors* GetFFmap_Weta2 (double eta, int isConv, int preselection=-1);
00276 TGraphErrors* GetFFmap_F1 (double eta, int isConv, int preselection=-1);
00277 TGraphErrors* GetFFmap_Fside (double eta, int isConv, int preselection=-1);
00278 TGraphErrors* GetFFmap_Wtot (double eta, int isConv, int preselection=-1);
00279 TGraphErrors* GetFFmap_W1 (double eta, int isConv, int preselection=-1);
00280 TGraphErrors* GetFFmap_DE (double eta, int isConv, int preselection=-1);
00281 TGraphErrors* GetFFmap_Eratio(double eta, int isConv, int preselection=-1);
00282
00283 TGraphErrors* GetFFmap_Rhad1 ();
00284 TGraphErrors* GetFFmap_Rhad ();
00285 TGraphErrors* GetFFmap_E277 ();
00286 TGraphErrors* GetFFmap_Reta ();
00287 TGraphErrors* GetFFmap_Rphi ();
00288 TGraphErrors* GetFFmap_Weta2 ();
00289 TGraphErrors* GetFFmap_F1 ();
00290 TGraphErrors* GetFFmap_Fside ();
00291 TGraphErrors* GetFFmap_Wtot ();
00292 TGraphErrors* GetFFmap_W1 ();
00293 TGraphErrors* GetFFmap_DE ();
00294 TGraphErrors* GetFFmap_Eratio();
00295
00296 TH2D* GetFFTH2D(int var, int isConv, int preselection);
00297
00298 void LoadFFs(int isConv, int preselection=-1);
00299
00300 private:
00301 void LoadFFsDefault();
00302 void LoadFFsDummy();
00303
00304 bool useRhad1(double eta2){ return (fabs(eta2)<0.8 || fabs(eta2)>=1.37);};
00305 bool useRhad (double eta2){ return !useRhad1(eta2);};
00306
00307 bool m_verbose;
00308
00309
00310 double m_pt;
00311 double m_eta2;
00312 int m_conv;
00313
00314
00315 int m_preselection;
00316
00317
00318 PtEtaCollection<double> m_rhad1_ff;
00319 PtEtaCollection<double> m_rhad_ff;
00320 PtEtaCollection<double> m_e277_ff;
00321 PtEtaCollection<double> m_reta_ff;
00322 PtEtaCollection<double> m_rphi_ff;
00323 PtEtaCollection<double> m_weta2_ff;
00324 PtEtaCollection<double> m_f1_ff;
00325 PtEtaCollection<double> m_deltae_ff;
00326 PtEtaCollection<double> m_wtot_ff;
00327 PtEtaCollection<double> m_fside_ff;
00328 PtEtaCollection<double> m_w1_ff;
00329 PtEtaCollection<double> m_eratio_ff;
00330
00331
00332 PtEtaCollection<double> m_rhad1_fferr;
00333 PtEtaCollection<double> m_rhad_fferr;
00334 PtEtaCollection<double> m_e277_fferr;
00335 PtEtaCollection<double> m_reta_fferr;
00336 PtEtaCollection<double> m_rphi_fferr;
00337 PtEtaCollection<double> m_weta2_fferr;
00338 PtEtaCollection<double> m_f1_fferr;
00339 PtEtaCollection<double> m_deltae_fferr;
00340 PtEtaCollection<double> m_wtot_fferr;
00341 PtEtaCollection<double> m_fside_fferr;
00342 PtEtaCollection<double> m_w1_fferr;
00343 PtEtaCollection<double> m_eratio_fferr;
00344
00345 };
00346
00347 #endif // #ifdef FudgeMCTool_h
00348
00349 #ifdef FudgeMCTool_cxx
00350
00351 FudgeMCTool::FudgeMCTool(double pt,
00352 double eta2,
00353 int isConv,
00354 int preselection)
00355 :
00356 m_pt(pt),
00357 m_eta2(fabs(eta2)),
00358 m_conv(isConv),
00359 m_preselection(preselection)
00360 {
00361 this->LoadFFsDefault();
00362 m_verbose = false;
00363
00364
00365 }
00366
00367 FudgeMCTool::~FudgeMCTool()
00368 {}
00369
00370 #endif// #ifdef FudgeMCTool_cxx
00371