Int_t VisualizeRegionIntegratedSurface()
{
    std::string fname = GetRootFile();

    TGraph2DErrors* gr = GetGraph(fname);
    gr->SetMarkerColor(kOrange);
    gr->SetLineColor(kOrange+3);

    std::string parfname = GetParamFile();
    std::ifstream pfile(parfname.data(),std::ios::in);
    Parameters params(pfile);
    if (! params.KeysAreSensible()) return -1;
    AngDist W(params);
    W.SetConstrainedRange(false);
    SphCoordsIntegrand Wsph(W);

    std::string regfname = GetRegionFile();
    std::ifstream rfile(regfname.data());
    RegionFileLoader rfl(rfile);
    rfile.close();

    std::vector<Regions> regs = rfl.GetRegions();

    TGraph2DErrors* grint = GenerateRegionIntegratedSurface(gr, Wsph, regs);
    grint->SetMarkerColor(kAzure);
    grint->SetLineColor(kAzure+3);

    TCanvas* c = new TCanvas("c");
    c->Divide(2,1);
    c->cd(1);
    grint->Draw("p0 tri1 err");
    c->cd(2);
    gr->Draw("p0 tri1 err");

    return 0;
}
Example #2
0
void ExpManager::GetExp2DGraph(TString NameTitle, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) {

    TGraph2DErrors *fGraph = new TGraph2DErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez);
    fGraph->SetTitle("Exp Data;Y (mm);X (mm);Magnetic Field (mT)");
    fGraph->SetMarkerSize(1.2);
    fGraph->SetMarkerStyle(20); 
    fGraph->SetMarkerColor(kBlue);
    fGraph->SetLineColor(kBlue);
    fGraph->SetLineWidth(2);
       
    int graph_counter = 0 ; 
   for (unsigned i=0; i< fExpY.size(); i++)   {
        if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) ) {
            fGraph->SetPoint(graph_counter,fExpY.at(i),fExpX.at(i),fExpB.at(i));    
            fGraph->SetPointError(graph_counter,fExpYErr.at(i),fExpXErr.at(i),fExpBErr.at(i)); 
            graph_counter++;
        } 
   }

    fGraph->SetTitle(NameTitle+Form(" Experimental Data : %.2f < X < %.2f mm  __  %.2f < Y < %.2f mm;Y (mm);X (mm);Magnetic Field (mT)",xmin,xmax,ymin,ymax));
    fGraph->SetName(NameTitle+Form("_Exp_X_%.2f_%.2fmm_Y_%.2f_%.2fmm",xmin,xmax,ymin,ymax));
    fGraph->Write();

}
void makeEfficiencyFitsLifetime2D(void) {
  gStyle->SetCanvasBorderMode(0);
  gStyle->SetPadBorderMode(0);
  gStyle->SetDrawBorder(0);
  gStyle->SetOptStat(0);
  gStyle->SetPadColor(0);
  gStyle->SetCanvasColor(0);
  gStyle->SetTitleColor(0);
  gStyle->SetTitleFillColor(0);
  gStyle->SetTitleBorderSize(0);

  const float tracking_systematic = 0.2;
  const float br = 0.01;

  // This section is pasted from the output of parseEfficiencyFilesWinter.pl.
  // Results by lifetime

  const int nhmass = 3;
  const int nxmass[nhmass] = {4, 3, 2};
  const int maxnxmass = 4;
  const int hmass[nhmass] = {1000, 400, 200};
  const int xmass[nhmass][maxnxmass] = {{350, 150, 50, 20},
					{150, 50, 20, -1},
					{50, 20, -1, -1},
  };
  const int nlifetimes = 11;
  float lifetimes[nhmass][maxnxmass][nlifetimes] = {{{1.155, 1.75, 3.5, 11.655, 17.5, 35, 70, 105, 350, 700, 1050}, // 1000/350
						     {0.33, 0.5, 1, 3.33, 5, 10, 20, 30, 100, 200, 300}, // 1000/150
						     {0.132, 0.2, 0.4, 1.332, 2, 4, 8, 12, 40, 80, 120}, // 1000/050
						     {0.0495, 0.075, 0.15, 0.4995, 0.75, 1.5, 3, 4.5, 15, 30, 45}, // 1000/020
    },
						    {{1.32, 2, 4, 13.32, 20, 40, 80, 120, 400, 800, 1200}, // 400/150
						     {0.264, 0.4, 0.8, 2.664, 4, 8, 16, 24, 80, 160, 240}, // 400/050
						     {0.132, 0.2, 0.4, 1.332, 2, 4, 8, 12, 40, 80, 120}, // 400/020
						     {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						    },
						    {{0.66, 1, 2, 6.66, 10, 20, 40, 60, 200, 400, 600}, // 200/050
						     {0.231, 0.35, 0.7, 2.331, 3.5, 7, 14, 21, 70, 140, 210}, // 200/020
						     {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						    },
  };
  float effvals_e1[nhmass][maxnxmass][nlifetimes] = {{{0.3295, 0.3405, 0.3068, 0.1952, 0.1552, 0.0954, 0.0528, 0.0348, 0.0065, 0.0020, 0.0009}, // 1000/350
						      {0.3953, 0.3958, 0.3629, 0.2887, 0.2524, 0.1794, 0.1159, 0.0902, 0.0301, 0.0110, 0.0056}, // 1000/150
						      {0.1739, 0.2159, 0.2683, 0.2807, 0.2604, 0.2015, 0.1315, 0.0935, 0.0204, 0.0064, 0.0031}, // 1000/050
						      {0.1014, 0.1431, 0.1857, 0.1850, 0.1717, 0.1347, 0.0865, 0.0595, 0.0117, 0.0036, 0.0017}, // 1000/020
    },
						     {{0.2073, 0.1890, 0.1597, 0.0950, 0.0738, 0.0450, 0.0259, 0.0175, 0.0035, 0.0011, 0.0005}, // 400/150
						      {0.1814, 0.1793, 0.1613, 0.1283, 0.1148, 0.0856, 0.0555, 0.0395, 0.0084, 0.0026, 0.0013}, // 400/050
						      {0.1697, 0.1568, 0.1362, 0.1160, 0.1068, 0.0813, 0.0492, 0.0324, 0.0057, 0.0017, 0.0008}, // 400/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
						     {{0.0061, 0.0107, 0.0154, 0.0110, 0.0089, 0.0056, 0.0031, 0.0020, 0.0004, 0.0001, 0.0001}, // 200/050
						      {0.0226, 0.0235, 0.0244, 0.0198, 0.0168, 0.0114, 0.0065, 0.0043, 0.0008, 0.0002, 0.0001}, // 200/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
  };
  float efferrs_e1[nhmass][maxnxmass][nlifetimes] = {{{0.0873, 0.0788, 0.0633, 0.0380, 0.0300, 0.0184, 0.0103, 0.0069, 0.0014, 0.0004, 0.0002}, // 1000/350
						      {0.1049, 0.0944, 0.0783, 0.0592, 0.0516, 0.0366, 0.0241, 0.0217, 0.0137, 0.0057, 0.0030}, // 1000/150
						      {0.0502, 0.0539, 0.0595, 0.0594, 0.0549, 0.0424, 0.0278, 0.0201, 0.0048, 0.0016, 0.0008}, // 1000/050
						      {0.0272, 0.0348, 0.0400, 0.0373, 0.0344, 0.0269, 0.0174, 0.0121, 0.0025, 0.0008, 0.0004}, // 1000/020
    },
						     {{0.0705, 0.0513, 0.0344, 0.0181, 0.0139, 0.0084, 0.0050, 0.0035, 0.0008, 0.0003, 0.0001}, // 400/150
						      {0.0582, 0.0482, 0.0357, 0.0255, 0.0226, 0.0168, 0.0110, 0.0081, 0.0019, 0.0006, 0.0003}, // 400/050
						      {0.0658, 0.0480, 0.0323, 0.0242, 0.0221, 0.0167, 0.0102, 0.0068, 0.0012, 0.0004, 0.0002}, // 400/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
						     {{0.0029, 0.0044, 0.0050, 0.0026, 0.0020, 0.0012, 0.0007, 0.0005, 0.0001, 0.0000, 0.0000}, // 200/050
						      {0.0151, 0.0113, 0.0075, 0.0045, 0.0037, 0.0024, 0.0014, 0.0010, 0.0002, 0.0000, 0.0000}, // 200/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
  };
  float effvals_e2[nhmass][maxnxmass][nlifetimes] = {{{0.2877, 0.2970, 0.2825, 0.1960, 0.1565, 0.0953, 0.0552, 0.0405, 0.0107, 0.0036, 0.0018}, // 1000/350
						      {0.3008, 0.3456, 0.3726, 0.3105, 0.2643, 0.1803, 0.1088, 0.0762, 0.0171, 0.0055, 0.0027}, // 1000/150
						      {0.2816, 0.2818, 0.2801, 0.2727, 0.2567, 0.2031, 0.1337, 0.0943, 0.0199, 0.0062, 0.0030}, // 1000/050
						      {0.1633, 0.1883, 0.2186, 0.1990, 0.1798, 0.1376, 0.0895, 0.0624, 0.0126, 0.0039, 0.0018}, // 1000/020
    },
						     {{0.2260, 0.1953, 0.1508, 0.0880, 0.0691, 0.0424, 0.0268, 0.0221, 0.0078, 0.0028, 0.0014}, // 400/150
						      {0.1032, 0.1324, 0.1530, 0.1337, 0.1207, 0.0908, 0.0604, 0.0455, 0.0122, 0.0041, 0.0020}, // 400/050
						      {0.0959, 0.1102, 0.1329, 0.1251, 0.1123, 0.0835, 0.0523, 0.0361, 0.0073, 0.0023, 0.0011}, // 400/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
						     {{0.0130, 0.0146, 0.0169, 0.0136, 0.0109, 0.0066, 0.0033, 0.0020, 0.0003, 0.0001, 0.0000}, // 200/050
						      {0.0780, 0.0579, 0.0330, 0.0187, 0.0161, 0.0116, 0.0079, 0.0065, 0.0023, 0.0008, 0.0004}, // 200/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
  };
  float efferrs_e2[nhmass][maxnxmass][nlifetimes] = {{{0.0776, 0.0708, 0.0593, 0.0387, 0.0308, 0.0187, 0.0111, 0.0089, 0.0032, 0.0011, 0.0006}, // 1000/350
						      {0.0759, 0.0798, 0.0791, 0.0633, 0.0537, 0.0366, 0.0222, 0.0160, 0.0043, 0.0015, 0.0007}, // 1000/150
						      {0.0772, 0.0668, 0.0586, 0.0537, 0.0504, 0.0398, 0.0263, 0.0187, 0.0042, 0.0014, 0.0007}, // 1000/050
						      {0.0589, 0.0499, 0.0474, 0.0402, 0.0362, 0.0276, 0.0180, 0.0127, 0.0027, 0.0009, 0.0004}, // 1000/020
    },
						     {{0.0813, 0.0560, 0.0337, 0.0172, 0.0133, 0.0081, 0.0057, 0.0066, 0.0043, 0.0017, 0.0008}, // 400/150
						      {0.0311, 0.0341, 0.0341, 0.0272, 0.0244, 0.0182, 0.0124, 0.0105, 0.0046, 0.0017, 0.0009}, // 400/050
						      {0.0351, 0.0298, 0.0289, 0.0248, 0.0221, 0.0163, 0.0103, 0.0073, 0.0017, 0.0005, 0.0003}, // 400/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
						     {{0.0104, 0.0088, 0.0057, 0.0031, 0.0024, 0.0014, 0.0007, 0.0004, 0.0001, 0.0000, 0.0000}, // 200/050
						      {0.0458, 0.0301, 0.0131, 0.0048, 0.0040, 0.0028, 0.0021, 0.0023, 0.0014, 0.0005, 0.0003}, // 200/020
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						     },
  };
  float effvals_mu1[nhmass][maxnxmass][nlifetimes] = {{{0.6752, 0.6513, 0.5870, 0.4484, 0.3830, 0.2613, 0.1561, 0.1072, 0.0220, 0.0068, 0.0033}, // 1000/350
						       {0.5417, 0.5528, 0.5437, 0.5073, 0.4695, 0.3616, 0.2353, 0.1686, 0.0386, 0.0124, 0.0060}, // 1000/150
						       {0.2736, 0.3395, 0.3997, 0.3774, 0.3437, 0.2646, 0.1813, 0.1438, 0.0507, 0.0188, 0.0096}, // 1000/050
						       {0.0019, 0.0045, 0.0095, 0.0129, 0.0132, 0.0129, 0.0126, 0.0129, 0.0062, 0.0023, 0.0012}, // 1000/020
    },
						      {{0.3572, 0.3868, 0.4045, 0.3232, 0.2736, 0.1844, 0.1092, 0.0742, 0.0148, 0.0045, 0.0022}, // 400/150
						       {0.4359, 0.4121, 0.3847, 0.3446, 0.3181, 0.2487, 0.1677, 0.1217, 0.0274, 0.0087, 0.0042}, // 400/050
						       {0.2117, 0.1959, 0.1902, 0.1939, 0.1826, 0.1442, 0.0985, 0.0733, 0.0179, 0.0058, 0.0028}, // 400/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
						      {{0.0480, 0.0708, 0.0970, 0.0925, 0.0804, 0.0553, 0.0341, 0.0250, 0.0066, 0.0022, 0.0011}, // 200/050
						       {0.2117, 0.1613, 0.1282, 0.1024, 0.0928, 0.0709, 0.0472, 0.0340, 0.0074, 0.0023, 0.0011}, // 200/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
  };
  float efferrs_mu1[nhmass][maxnxmass][nlifetimes] = {{{0.1776, 0.1576, 0.1323, 0.0983, 0.0838, 0.0571, 0.0342, 0.0237, 0.0052, 0.0016, 0.0008}, // 1000/350
						       {0.1425, 0.1326, 0.1214, 0.1102, 0.1018, 0.0783, 0.0511, 0.0371, 0.0094, 0.0032, 0.0016}, // 1000/150
						       {0.0759, 0.0847, 0.0918, 0.0840, 0.0763, 0.0587, 0.0408, 0.0366, 0.0245, 0.0104, 0.0055}, // 1000/050
						       {0.0010, 0.0020, 0.0035, 0.0032, 0.0031, 0.0029, 0.0036, 0.0058, 0.0046, 0.0019, 0.0009}, // 1000/020
    },
						      {{0.0974, 0.0931, 0.0888, 0.0684, 0.0578, 0.0389, 0.0231, 0.0159, 0.0034, 0.0011, 0.0005}, // 400/150
						       {0.1270, 0.1035, 0.0865, 0.0744, 0.0686, 0.0535, 0.0362, 0.0266, 0.0064, 0.0021, 0.0010}, // 400/050
						       {0.0714, 0.0556, 0.0456, 0.0435, 0.0408, 0.0321, 0.0221, 0.0170, 0.0049, 0.0017, 0.0009}, // 400/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
						      {{0.0192, 0.0218, 0.0238, 0.0205, 0.0177, 0.0121, 0.0077, 0.0067, 0.0031, 0.0012, 0.0006}, // 200/050
						       {0.0933, 0.0560, 0.0327, 0.0231, 0.0207, 0.0158, 0.0106, 0.0078, 0.0019, 0.0006, 0.0003}, // 200/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
  };
  float effvals_mu2[nhmass][maxnxmass][nlifetimes] = {{{0.5623, 0.5733, 0.5950, 0.4811, 0.4102, 0.2782, 0.1646, 0.1120, 0.0227, 0.0071, 0.0034}, // 1000/350
						       {0.5246, 0.5195, 0.5347, 0.5307, 0.4930, 0.3811, 0.2483, 0.1761, 0.0380, 0.0120, 0.0058}, // 1000/150
						       {0.3336, 0.3956, 0.4771, 0.4853, 0.4454, 0.3415, 0.2220, 0.1559, 0.0326, 0.0101, 0.0049}, // 1000/050
						       {0.0133, 0.0187, 0.0256, 0.0257, 0.0244, 0.0221, 0.0182, 0.0144, 0.0036, 0.0012, 0.0006}, // 1000/020
    },
						      {{0.6314, 0.5884, 0.5092, 0.3767, 0.3134, 0.2046, 0.1211, 0.0852, 0.0196, 0.0063, 0.0031}, // 400/150
						       {0.3445, 0.3692, 0.3973, 0.3783, 0.3500, 0.2706, 0.1712, 0.1164, 0.0221, 0.0067, 0.0032}, // 400/050
						       {0.2269, 0.2648, 0.2989, 0.2777, 0.2529, 0.1948, 0.1285, 0.0919, 0.0203, 0.0064, 0.0031}, // 400/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
						      {{0.1448, 0.1351, 0.1277, 0.1098, 0.0962, 0.0678, 0.0399, 0.0262, 0.0046, 0.0014, 0.0006}, // 200/050
						       {0.2110, 0.1809, 0.1496, 0.1237, 0.1130, 0.0859, 0.0558, 0.0396, 0.0085, 0.0027, 0.0013}, // 200/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
  };
  float efferrs_mu2[nhmass][maxnxmass][nlifetimes] = {{{0.1547, 0.1383, 0.1333, 0.1055, 0.0898, 0.0608, 0.0361, 0.0248, 0.0055, 0.0017, 0.0008}, // 1000/350
						       {0.1477, 0.1283, 0.1195, 0.1151, 0.1068, 0.0825, 0.0539, 0.0385, 0.0087, 0.0028, 0.0014}, // 1000/150
						       {0.0923, 0.0987, 0.1107, 0.1098, 0.1006, 0.0771, 0.0502, 0.0354, 0.0076, 0.0024, 0.0012}, // 1000/050
						       {0.0080, 0.0086, 0.0080, 0.0060, 0.0056, 0.0049, 0.0042, 0.0036, 0.0011, 0.0004, 0.0002}, // 1000/020
    },
						      {{0.1634, 0.1413, 0.1130, 0.0807, 0.0670, 0.0437, 0.0260, 0.0187, 0.0050, 0.0017, 0.0008}, // 400/150
						       {0.0893, 0.0865, 0.0855, 0.0787, 0.0727, 0.0561, 0.0356, 0.0243, 0.0047, 0.0014, 0.0007}, // 400/050
						       {0.0657, 0.0686, 0.0709, 0.0635, 0.0576, 0.0443, 0.0293, 0.0212, 0.0050, 0.0016, 0.0008}, // 400/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
						      {{0.0538, 0.0403, 0.0301, 0.0232, 0.0202, 0.0141, 0.0084, 0.0056, 0.0010, 0.0003, 0.0002}, // 200/050
						       {0.0733, 0.0532, 0.0372, 0.0281, 0.0255, 0.0193, 0.0127, 0.0092, 0.0022, 0.0007, 0.0004}, // 200/020
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						       {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
						      },
  };



  char shortbuf[32], longbuf[512];

  for (int i=0; i<nhmass && i<1; i++) {
    sprintf(shortbuf, "c%de", i);
    sprintf(longbuf, "Efficiency, dielectron channel, m_{H} = %d, BR = %.2f", hmass[i], br);
    
    TCanvas *c = new TCanvas(shortbuf, longbuf, 800, 800);

    TGraph2DErrors *effe;
    float minlife = 9999;
    float maxlife = -1;
    float mineff = 9999;
    float maxeff = -1;

    TH1F *fr;

    double xval[maxnxmass*nlifetimes];
    double xerr[maxnxmass*nlifetimes];
    double yval[maxnxmass*nlifetimes];
    double yerr[maxnxmass*nlifetimes];
    double effval[maxnxmass*nlifetimes];
    double efferr[maxnxmass*nlifetimes];
    int curpoint = 0;

    for (int j=0; j<nxmass[i]; j++) {
      // Build the new array of efficiencies from the input.

      for (int k=0; k<nlifetimes; k++) {
	float eff1 = effvals_e1[i][j][k];
	float eff2 = effvals_e2[i][j][k];
	float efferr1 = efferrs_e1[i][j][k];
	float efferr2 = efferrs_e2[i][j][k];
	
	float efffactor = 2*eff1*br*(1-br) + 2*eff2*br*br;
	float effterm1 = 2*efferr1*br*(1-br);
	float effterm2 = 2*efferr2*br*br;
	float staterr = sqrt(effterm1*effterm1 + effterm2*effterm2);
	
	float trackerr = tracking_systematic*efffactor;
	
	float toterr = sqrt(staterr*staterr + trackerr*trackerr);

	xval[curpoint] = xmass[i][j];
	xerr[curpoint] = 0;
	yval[curpoint] = lifetimes[i][j][k];
	yerr[curpoint] = 0;
	effval[curpoint] = efffactor;
	efferr[curpoint] = toterr;
	curpoint++;
	// printf("mh %d mx %d lifetime %.2f eff = %.4f +/- %.4f\n", hmass[i], xmass[i][j], lifetimes[i][j][k], efffactor, toterr);
	if (lifetimes[i][j][k] < minlife) minlife = lifetimes[i][j][k];
	if (lifetimes[i][j][k] > maxlife) maxlife = lifetimes[i][j][k];
	if (efffactor < mineff) mineff = efffactor;
	if (efffactor > maxeff) maxeff = efffactor;
      }
    } // first x mass loop -- everything is calculated, now to draw it

    std::cout << "Total of " << curpoint << " points" << std::endl;
    effe = new TGraph2DErrors(curpoint, xval, yval, effval, xerr, yerr, efferr);
    effe->SetLineColor(kBlue);
    effe->SetFillColor(0);
    effe->SetMarkerColor(kBlue);
    effe->SetMarkerStyle(kFullSquare);
    effe->SetMarkerSize(1);
    effe->SetLineWidth(2);
    
    effe->Draw("P ERR");
    effe->SetTitle(longbuf);
    effe->GetXaxis()->SetTitle("m_{X} (GeV)");
    effe->GetXaxis()->SetTitleColor(kBlack);
    effe->GetYaxis()->SetTitle("c#tau (cm)");
    effe->GetYaxis()->SetTitleOffset(2.0);
    effe->GetZaxis()->SetTitle("Efficiency");
    effe->GetZaxis()->SetTitleOffset(2.0);
    
    gPad->SetLogx();
    gPad->SetLogy();
    gPad->SetLogz();
    
    TF2 *f2 = new TF2("f2", "([0]+[1]*x+[2]*x*x)*([3]+[4]*y+[5]*y*y)", 20, 350, minlife, maxlife);
    f2->SetParameters(2.0, -0.018, 3e-5, 2e-4, -1e-6, 4e-8);
    effe->Fit(f2);
    f2->Draw("surf same");

    //if (i==0)
    // c->Print("ElectronEfficiencyV2.ps(");
    //else if (i<nhmass-1)
    //  c->Print("ElectronEfficiencyV2.ps");
    //else
    //  c->Print("ElectronEfficiencyV2.ps)");
    
  } // h mass loop
  
  //gSystem->Exec("ps2pdf ElectronEfficiencyV2.ps");

}