double FindConstant::execute()
{
  std::vector<double> chi2, checkedBetaValues;
  for (double eRes = 1.0; eRes < 2.0; eRes += 0.05) {
    fillEXPHisto(); 	//fills the histogram without prescaling
    produceSIMEvents( SIMEvents, eRes );
    fillSIMHisto();

    aproximateParameters();
    fillSIMHisto(normalisation, alpha);


    performFit();
    fillSIMHisto(normalisation, alpha);

    checkedBetaValues.push_back(eRes);

    numberOfBins = -1.0 * (double(SIMHisto->GetXaxis()->FindBin(lowerCut / alpha)) - double(SIMHisto->GetXaxis()->FindBin(upperCut / alpha)) );
    chi2.push_back(compareHistogramsByChi2(normalisation, alpha) );

    if ( compareHistogramsByChi2(normalisation, alpha)  < bestChi2 ) {
      bestChi2 = compareHistogramsByChi2(normalisation, alpha) ;
      bestNorm = normalisation;
      bestAlpha = alpha;
      bestNumberOfBins = numberOfBins;
    }

    INFO( Form("Beta equal to %f was fitted with chi2: %f for number of bins: %d", eRes, compareHistogramsByChi2(normalisation, alpha)  , numberOfBins) );

    fillEXPHisto(1.0 / normalisation, 1.0 / alpha);
    fillSIMHisto();

    energyResolution = eRes;

    saveFittedHisto();
    SIMEvents.clear();

  }

  drawChi2AndFitPol2(checkedBetaValues, chi2);

  produceSIMEvents(SIMEvents, energyResolution);
  fillSIMHisto();
  fillEXPHisto(1.0 / bestNorm, 1.0 / bestAlpha);

  saveFitResultToTxt("fitResults.txt");

  saveFittedHisto();

  EXPHisto->Reset();
  SIMHisto->Reset();
  delete EXPHisto;
  delete SIMHisto;
  return bestAlpha;
}
Beispiel #2
0
int main(int argc, char **argv) {



    printf("\n======= GCOR v1.1 - Automatic Gain Correction =======\n\tR. Lica, IFIN-HH, Dec2013 \n\n");



    int chNum, detNum, runstart, runstop, irun, idet;
    int minWIDTH, maxWIDTH, SHIFT, SWEEP, degree;
    int low, high;
    char name[20];

    FILE *settings, *fi, *fo;
    initialize(settings, &chNum, &detNum, name, &runstart, &runstop, &minWIDTH, &maxWIDTH, &SHIFT, &SWEEP, &degree, &low, &high);

    degree++; // in the program degree represents the number of coefficients of the polynomial and NOT the degree of the polynomial. i know...
    int regions=(high-low)/SHIFT;
    struct Data2Fit shData[regions];
    int i, j, k, nData=0;
    double refSpec[chNum], Spec[chNum];
    double coeff[degree], chisq, norm;
    FILE * gnuplotPipe = popen ("gnuplot", "w");
    char outfile[20], infile[20], answer;
    sprintf(outfile, "gcor.cal");
    fo=fopen(outfile, "wt");




    for(idet=0; idet<detNum; idet++)
    {

        fprintf(fo, "%5d%5d%5d%9.3f%10.6f\n", runstart, idet, 2, 0.0, 1.0); //each detector from the first run is set as reference

        for(irun=runstart+1; irun<=runstop; irun++)
        {

            for (i=0; i<regions; i++)
            {
                shData[i].ch=0;
                shData[i].chShift=0;
                shData[i].err=0;
            }

            sprintf(infile, "%2s.%04d", name, runstart);
            if(fopen(infile, "rb")) fi=fopen(infile, "rb");
            else {
                printf("Cannot open %2s.%04d\n", name, runstart);
                exit(0);
            }
            readBin(fi, refSpec, idet, chNum, low, high);

            sprintf(infile, "%2s.%04d", name, irun);
            if(fopen(infile, "rb")) fi=fopen(infile, "rb");
            else continue;
            readBin(fi, Spec, idet, chNum, low, high);


            normalize(refSpec, Spec, chNum, &norm);
            smooth(refSpec, Spec, minWIDTH/5, maxWIDTH/2, low, high);
            deriv(refSpec, Spec, low, high, 5);


            autoshift(refSpec, Spec, shData, low, high, minWIDTH, maxWIDTH, SHIFT, SWEEP, regions);


            nData = performFit(shData, degree, &chisq, coeff, regions);
            if (nData == 0) {
                printf("Warning! %2s#%02d.%04d: Could not extract data suitable for fit. Change settings!\n", name, idet, irun);
                goto skip;
            }
            gnuplot(gnuplotPipe, irun, idet, shData, nData, degree, chisq, coeff, regions, norm);
            writeCal(fo, degree, coeff, irun, idet);

            if (answer=='a') goto skip;
            printf("Going to %2s#%02d.%04d ([y]/n)? (Type 'a' for automatic fit)", name, idet, irun+1);
            answer = getchar();
skip:
            if (answer=='n') exit(0);


        }

        printf("---------------------\nGoing to Detector #%02d\n---------------------\n", idet+1);




    }

    exit(0);


}
void ElectronTagAndProbeFitter(){




// //////////////////////////////////////////////////////////
  effTextFile.width(40);
  effTextFile << left << "Type";
  effTextFile.width(20);
  effTextFile  << left << "Efficiency" ;
  effTextFile.width(20);
  effTextFile  << left << " Uncertainty(+) ";
  effTextFile.width(20);
  effTextFile  << left << " Uncertainty(-) ";
  effTextFile.width(14);
  effTextFile  << left << "NPass" ;
  effTextFile.width(14);
  effTextFile << left << "NFail" << endl;

// //////////////////////////////////////////////////////////



// //////////////////////////////////////////////////////////
//   //  Super cluster --> gsfElectron efficiency
// //////////////////////////////////////////////////////////

//**************
//User Pass Template For Fail Sample - TPTree
//**************
//       performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco", "Mass_TagPlusSCPassReco_Data_36", "Mass_TagPlusSCFailReco_Data_36", "Mass_TagPlusSCPassReco", "Mass_TagPlusSCPassReco" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCPassReco_EB_Pt20ToInf" );
//       performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCPassReco_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB_Minus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCPassReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE_Minus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCPassReco_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB_Plus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCPassReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE_Plus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCPassReco_EE_Pt20ToInf" ); 


//**************
//User Fail Template For Fail Sample - TPTree
//**************
//      performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco", "Mass_TagPlusSCPassReco_Data_36", "Mass_TagPlusSCFailReco_Data_36", "Mass_TagPlusSCPassReco", "Mass_TagPlusSCFailReco" );
//      performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//      performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB_Minus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE_Minus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB_Plus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE_Plus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );

//**************
//Impose WP95 Iso Cut on Photon probes - TPTree  SYstematics
//**************
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80_WithPhotonIsoCut/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco", "Mass_TagPlusSCPassReco_Data_36", "Mass_TagPlusSCFailReco_Data_36", "Mass_TagPlusSCPassReco", "Mass_TagPlusSCFailReco" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80_WithPhotonIsoCut/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80_WithPhotonIsoCut/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );





//**************
//Impose WP95 Iso Cut on Photon probes - BAMBU
//**************
//      performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco", "Mass_TagPlusSCPassReco_Data_36", "Mass_TagPlusSCFailReco_Data_36", "Mass_TagPlusSCPassReco", "Mass_TagPlusSCFailReco" );
//      performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//      performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB_Minus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE_Minus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EB_Plus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCFailReco_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCPassReco_EB_Pt20ToInf", "Mass_TagPlusSCFailReco_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_SCToReco_EE_Plus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCFailReco_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusSCPassReco_EE_Pt20ToInf", "Mass_TagPlusSCFailReco_EE_Pt20ToInf" );



// //////////////////////////////////////////////////////////
//   //  gsfElectron --> WP-95 selection efficiency
// //////////////////////////////////////////////////////////

//**************
//TAG 80 - TPTree
//**************
//    performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95", "Mass_TagPlusRecoPassVBTF95IdIso_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso", "Mass_TagPlusRecoFailVBTF95IdIso" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );

//**************
//TAG 80 - BAMBU
//**************
//    performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95", "Mass_TagPlusRecoPassVBTF95IdIso_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso", "Mass_TagPlusRecoFailVBTF95IdIso" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );


// //**************
// //TAG 95 - BAMBU
// //**************
//    performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95", "Mass_TagPlusRecoPassVBTF95IdIso_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso", "Mass_TagPlusRecoFailVBTF95IdIso" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP95/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );

//**************
//TAG 60 - BAMBU
//**************
//    performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95", "Mass_TagPlusRecoPassVBTF95IdIso_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso", "Mass_TagPlusRecoFailVBTF95IdIso" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP60/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );





//       performFit("EfficiencyFitter/input/Data_36_09122010_JW_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EB", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EB_Pt20ToInf" );
//       performFit("EfficiencyFitter/input/Data_36_09122010_JW_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF95_EE", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF95IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF95IdIso_EE_Pt20ToInf" );

   cout << "########################################" << endl;



// // //////////////////////////////////////////////////////////
// //   //  gsfElectron --> WP-80 selection efficiency
// // //////////////////////////////////////////////////////////

//**************
//TAG 80 - TP
//**************
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80", "Mass_TagPlusRecoPassVBTF80IdIso_Data_36", "Mass_TagPlusRecoFailVBTF80IdIso_Data_36", "Mass_TagPlusRecoPassVBTF80IdIso", "Mass_TagPlusRecoFailVBTF80IdIso" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EB", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EE", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EB_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EE_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EB_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TP_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EE_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf" );



//**************
//TAG 80 - BAMBU
//**************

//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80", "Mass_TagPlusRecoPassVBTF80IdIso_Data_36", "Mass_TagPlusRecoFailVBTF80IdIso_Data_36", "Mass_TagPlusRecoPassVBTF80IdIso", "Mass_TagPlusRecoFailVBTF80IdIso" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EB", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EE", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf_Data_36", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EB_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EE_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf_Data_36_Minus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EB_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EB_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EB_Pt20ToInf" );
//     performFit("EfficiencyFitter/input/Data_36_09122010_TagWP80/", "EfficiencyFitter/results/Parameters.txt", "Efficiency_RecoToVBTF80_EE_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf_Data_36_Plus", "Mass_TagPlusRecoPassVBTF80IdIso_EE_Pt20ToInf", "Mass_TagPlusRecoFailVBTF80IdIso_EE_Pt20ToInf" );





   performFit("res/", "results/Parameters.txt", "Efficiency_Photon", "photonEfffromZee.passbar.dflag1.eT1.2.gT40.mt15.ptbin0.txt", "photonEfffromZee.failbar.dflag1.eT1.2.gT40.mt15.ptbin0.txt", "hh_Meg_barrel_mc_pt_0", "hh_Megf_barrel_mc_pt_0" );






// // //////////////////////////////////////////////////////////
// //   //   WP-95 --> HLT triggering efficiency
// // //////////////////////////////////////////////////////////



//    cout << "########################################" << endl;




// // //////////////////////////////////////////////////////////
// //   //   WP-80 --> HLT triggering efficiency
// // //////////////////////////////////////////////////////////

 
//    cout << "########################################" << endl;

   effTextFile.close();
}