Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-17 01:47:51

0001 //================================================================================================
0002 //
0003 //
0004 //________________________________________________________________________________________________
0005 
0006 #if !defined(__CINT__) || defined(__MAKECINT__)
0007 #include <TROOT.h>       // access to gROOT, entry point to ROOT system
0008 #include <TSystem.h>     // interface to OS
0009 #include <TStyle.h>      // class to handle ROOT plotting style
0010 #include <TCanvas.h>     // class for drawing
0011 #include <TBenchmark.h>  // class to track macro running statistics
0012 #include <iostream>      // standard I/O
0013 #include <iomanip>
0014 #include <fstream>
0015 
0016 // RooFit headers
0017 #include "RooRealVar.h"
0018 #include "RooDataSet.h"
0019 #include "RooCategory.h"
0020 #include "RooArgList.h"
0021 #include "RooDataHist.h"
0022 #include "RooFormulaVar.h"
0023 #include "RooHistPdf.h"
0024 #include "RooGenericPdf.h"
0025 #include "RooAddPdf.h"
0026 #include "RooSimultaneous.h"
0027 #include "RooGaussian.h"
0028 #include "RooNLLVar.h"
0029 #include "RooConstVar.h"
0030 #include "RooFitResult.h"
0031 #include "RooExponential.h"
0032 #include "RooFFTConvPdf.h"
0033 
0034 #include "TFile.h"
0035 #include "TH1D.h"
0036 #include "TPaveText.h"
0037 #include "RooPlot.h"
0038 
0039 #endif
0040 
0041 #define LUMINOSITY 2.88  //(in pb^-1)
0042 #define NBINSPASS 60
0043 #define NBINSFAIL 24
0044 
0045 ofstream effTextFile("efficiency.txt");
0046 
0047 double ErrorInProduct(double x, double errx, double y, double erry, double corr) {
0048   double xFrErr = errx / x;
0049   double yFrErr = erry / y;
0050   return sqrt(pow(xFrErr, 2) + pow(yFrErr, 2) + 2.0 * corr * xFrErr * yFrErr) * x * y;
0051 }
0052 
0053 RooRealVar* LoadParameters(string filename, string label, string parname) {
0054   RooRealVar* newVar = 0;
0055 
0056   // now read in the parameters from the file.  Stored in the file as
0057   // parameter manager   |   name   | initial val  | min  | max  | step
0058   fstream parameter_file(filename.c_str(), ios::in);
0059   if (!parameter_file) {
0060     cout << "Error:  Couldn't open parameters file " << filename << endl;
0061     return false;
0062   }
0063 
0064   string name;
0065   string category;
0066   double initial_val, min, max, step;
0067 
0068   char c;
0069   Bool_t foundPar = kFALSE;
0070   while (true) {
0071     // skip white spaces and look for a #
0072     while (parameter_file.get(c)) {
0073       if (isspace(c) || c == '\n')
0074         continue;
0075       else if (c == '#')
0076         while (c != '\n')
0077           parameter_file.get(c);
0078       else {
0079         parameter_file.putback(c);
0080         break;
0081       }
0082     }
0083     if (parameter_file.fail())
0084       break;
0085 
0086     parameter_file >> category >> name >> initial_val >> min >> max >> step;
0087     if (parameter_file.fail())
0088       break;
0089 
0090     if (category == label && parname == name) {
0091       // create a new fit parameter
0092       newVar = new RooRealVar(name.c_str(), name.c_str(), initial_val, min, max);
0093       if (step == 0) {
0094         newVar->setConstant(kTRUE);
0095       }
0096 
0097       break;
0098     }
0099   }  //end while loop
0100 
0101   if (!newVar) {
0102     cout << "Could not load parameter " << parname << " from file " << filename << " , category " << label << endl;
0103     assert(newVar);
0104   }
0105 
0106   return newVar;
0107 }
0108 
0109 void PrintParameter(RooRealVar* var, string label, string name) {
0110   cout.width(50);
0111   cout << left << label;
0112   cout.width(40);
0113   cout << left << name;
0114   cout.precision(5);
0115   cout.width(15);
0116   cout << left << scientific << var->getVal();
0117   cout.width(15);
0118   cout << left << scientific << var->getMin();
0119   cout.width(15);
0120   cout << left << scientific << var->getMax();
0121   cout.width(15);
0122   if (var->getAttribute("Constant")) {
0123     cout << left << scientific << 0.0;
0124   } else {
0125     cout << left << scientific << 1.0;
0126   }
0127   cout << endl;
0128 }
0129 
0130 void performFit(string inputDir,
0131                 string inputParameterFile,
0132                 string label,
0133                 string PassInputDataFilename,
0134                 string FailInputDataFilename,
0135                 string PassSignalTemplateHistName,
0136                 string FailSignalTemplateHistName) {
0137   gBenchmark->Start("fitZCat");
0138 
0139   //--------------------------------------------------------------------------------------------------------------
0140   // Settings
0141   //==============================================================================================================
0142 
0143   const Double_t mlow = 60;
0144   const Double_t mhigh = 120;
0145   const Int_t nbins = 24;
0146 
0147   TString effType = inputDir;
0148 
0149   // The fit variable - lepton invariant mass
0150   RooRealVar* rooMass_ = new RooRealVar("Mass", "m_{ee}", mlow, mhigh, "GeV/c^{2}");
0151   RooRealVar Mass = *rooMass_;
0152   Mass.setBins(nbins);
0153 
0154   // Make the category variable that defines the two fits,
0155   // namely whether the probe passes or fails the eff criteria.
0156   RooCategory sample("sample", "");
0157   sample.defineType("Pass", 1);
0158   sample.defineType("Fail", 2);
0159 
0160   RooDataSet* dataPass = RooDataSet::read((inputDir + PassInputDataFilename).c_str(), RooArgList(Mass));
0161   RooDataSet* dataFail = RooDataSet::read((inputDir + FailInputDataFilename).c_str(), RooArgList(Mass));
0162 
0163   RooDataSet* dataCombined = new RooDataSet("dataCombined",
0164                                             "dataCombined",
0165                                             RooArgList(Mass),
0166                                             RooFit::Index(sample),
0167                                             RooFit::Import("Pass", *dataPass),
0168                                             RooFit::Import("Fail", *dataFail));
0169 
0170   //*********************************************************************************************
0171   //Define Free Parameters
0172   //*********************************************************************************************
0173   RooRealVar* ParNumSignal = LoadParameters(inputParameterFile, label, "ParNumSignal");
0174   RooRealVar* ParNumBkgPass = LoadParameters(inputParameterFile, label, "ParNumBkgPass");
0175   RooRealVar* ParNumBkgFail = LoadParameters(inputParameterFile, label, "ParNumBkgFail");
0176   RooRealVar* ParEfficiency = LoadParameters(inputParameterFile, label, "ParEfficiency");
0177   RooRealVar* ParPassBackgroundExpCoefficient =
0178       LoadParameters(inputParameterFile, label, "ParPassBackgroundExpCoefficient");
0179   RooRealVar* ParFailBackgroundExpCoefficient =
0180       LoadParameters(inputParameterFile, label, "ParFailBackgroundExpCoefficient");
0181   RooRealVar* ParPassSignalMassShift = LoadParameters(inputParameterFile, label, "ParPassSignalMassShift");
0182   RooRealVar* ParFailSignalMassShift = LoadParameters(inputParameterFile, label, "ParFailSignalMassShift");
0183   RooRealVar* ParPassSignalResolution = LoadParameters(inputParameterFile, label, "ParPassSignalResolution");
0184   RooRealVar* ParFailSignalResolution = LoadParameters(inputParameterFile, label, "ParFailSignalResolution");
0185 
0186   // new RooRealVar  ("ParPassSignalMassShift","ParPassSignalMassShift",-2.6079e-02,-10.0, 10.0);   //ParPassSignalMassShift->setConstant(kTRUE);
0187   //   RooRealVar* ParFailSignalMassShift = new RooRealVar  ("ParFailSignalMassShift","ParFailSignalMassShift",7.2230e-01,-10.0, 10.0);   //ParFailSignalMassShift->setConstant(kTRUE);
0188   //   RooRealVar* ParPassSignalResolution = new RooRealVar ("ParPassSignalResolution","ParPassSignalResolution",6.9723e-01,0.0, 10.0);     ParPassSignalResolution->setConstant(kTRUE);
0189   //   RooRealVar* ParFailSignalResolution = new RooRealVar ("ParFailSignalResolution","ParFailSignalResolution",1.6412e+00,0.0, 10.0);     ParFailSignalResolution->setConstant(kTRUE);
0190 
0191   //*********************************************************************************************
0192   //
0193   //Load Signal PDFs
0194   //
0195   //*********************************************************************************************
0196 
0197   TFile* Zeelineshape_file = new TFile("res/photonEfffromZee.dflag1.eT1.2.gT40.mt15.root", "READ");
0198   TH1* histTemplatePass = (TH1D*)Zeelineshape_file->Get(PassSignalTemplateHistName.c_str());
0199   TH1* histTemplateFail = (TH1D*)Zeelineshape_file->Get(FailSignalTemplateHistName.c_str());
0200 
0201   //Introduce mass shift coordinate transformation
0202   //   RooFormulaVar PassShiftedMass("PassShiftedMass","@0-@1",RooArgList(Mass,*ParPassSignalMassShift));
0203   //   RooFormulaVar FailShiftedMass("FailShiftedMass","@0-@1",RooArgList(Mass,*ParFailSignalMassShift));
0204 
0205   RooGaussian* PassSignalResolutionFunction = new RooGaussian("PassSignalResolutionFunction",
0206                                                               "PassSignalResolutionFunction",
0207                                                               Mass,
0208                                                               *ParPassSignalMassShift,
0209                                                               *ParPassSignalResolution);
0210   RooGaussian* FailSignalResolutionFunction = new RooGaussian("FailSignalResolutionFunction",
0211                                                               "FailSignalResolutionFunction",
0212                                                               Mass,
0213                                                               *ParFailSignalMassShift,
0214                                                               *ParFailSignalResolution);
0215 
0216   RooDataHist* dataHistPass = new RooDataHist("dataHistPass", "dataHistPass", RooArgSet(Mass), histTemplatePass);
0217   RooDataHist* dataHistFail = new RooDataHist("dataHistFail", "dataHistFail", RooArgSet(Mass), histTemplateFail);
0218   RooHistPdf* signalShapePassTemplatePdf =
0219       new RooHistPdf("signalShapePassTemplatePdf", "signalShapePassTemplatePdf", Mass, *dataHistPass, 1);
0220   RooHistPdf* signalShapeFailTemplatePdf =
0221       new RooHistPdf("signalShapeFailTemplatePdf", "signalShapeFailTemplatePdf", Mass, *dataHistFail, 1);
0222 
0223   RooFFTConvPdf* signalShapePassPdf = new RooFFTConvPdf(
0224       "signalShapePassPdf", "signalShapePassPdf", Mass, *signalShapePassTemplatePdf, *PassSignalResolutionFunction, 2);
0225   RooFFTConvPdf* signalShapeFailPdf = new RooFFTConvPdf(
0226       "signalShapeFailPdf", "signalShapeFailPdf", Mass, *signalShapeFailTemplatePdf, *FailSignalResolutionFunction, 2);
0227 
0228   // Now define some efficiency/yield variables
0229   RooFormulaVar* NumSignalPass =
0230       new RooFormulaVar("NumSignalPass", "ParEfficiency*ParNumSignal", RooArgList(*ParEfficiency, *ParNumSignal));
0231   RooFormulaVar* NumSignalFail =
0232       new RooFormulaVar("NumSignalFail", "(1.0-ParEfficiency)*ParNumSignal", RooArgList(*ParEfficiency, *ParNumSignal));
0233 
0234   //*********************************************************************************************
0235   //
0236   // Create Background PDFs
0237   //
0238   //*********************************************************************************************
0239   RooExponential* bkgPassPdf = new RooExponential("bkgPassPdf", "bkgPassPdf", Mass, *ParPassBackgroundExpCoefficient);
0240   RooExponential* bkgFailPdf = new RooExponential("bkgFailPdf", "bkgFailPdf", Mass, *ParFailBackgroundExpCoefficient);
0241 
0242   //*********************************************************************************************
0243   //
0244   // Create Total PDFs
0245   //
0246   //*********************************************************************************************
0247   RooAddPdf pdfPass(
0248       "pdfPass", "pdfPass", RooArgList(*signalShapePassPdf, *bkgPassPdf), RooArgList(*NumSignalPass, *ParNumBkgPass));
0249   RooAddPdf pdfFail(
0250       "pdfFail", "pdfFail", RooArgList(*signalShapeFailPdf, *bkgFailPdf), RooArgList(*NumSignalFail, *ParNumBkgFail));
0251 
0252   // PDF for simultaneous fit
0253   RooSimultaneous totalPdf("totalPdf", "totalPdf", sample);
0254   totalPdf.addPdf(pdfPass, "Pass");
0255   //    totalPdf.Print();
0256   totalPdf.addPdf(pdfFail, "Fail");
0257   totalPdf.Print();
0258 
0259   //*********************************************************************************************
0260   //
0261   // Perform Fit
0262   //
0263   //*********************************************************************************************
0264   RooFitResult* fitResult = 0;
0265 
0266   // ********* Fix with Migrad first ********** //
0267   fitResult = totalPdf.fitTo(*dataCombined, RooFit::Save(true), RooFit::Extended(true), RooFit::PrintLevel(-1));
0268   fitResult->Print("v");
0269 
0270   //   // ********* Fit With Minos ********** //
0271   //    fitResult = totalPdf.fitTo(*dataCombined, RooFit::Save(true),
0272   //                               RooFit::Extended(true), RooFit::PrintLevel(-1), RooFit::Minos());
0273   //    fitResult->Print("v");
0274 
0275   //   // ********* Fix Mass Shift and Fit For Resolution ********** //
0276   //    ParPassSignalMassShift->setConstant(kTRUE);
0277   //    ParFailSignalMassShift->setConstant(kTRUE);
0278   //    ParPassSignalResolution->setConstant(kFALSE);
0279   //    ParFailSignalResolution->setConstant(kFALSE);
0280   //    fitResult = totalPdf.fitTo(*dataCombined, RooFit::Save(true),
0281   //    RooFit::Extended(true), RooFit::PrintLevel(-1));
0282   //    fitResult->Print("v");
0283 
0284   //   // ********* Do Final Fit ********** //
0285   //    ParPassSignalMassShift->setConstant(kFALSE);
0286   //    ParFailSignalMassShift->setConstant(kFALSE);
0287   //    ParPassSignalResolution->setConstant(kTRUE);
0288   //    ParFailSignalResolution->setConstant(kTRUE);
0289   //    fitResult = totalPdf.fitTo(*dataCombined, RooFit::Save(true),
0290   //                                             RooFit::Extended(true), RooFit::PrintLevel(-1));
0291   //    fitResult->Print("v");
0292 
0293   double nSignalPass = NumSignalPass->getVal();
0294   double nSignalFail = NumSignalFail->getVal();
0295   double denominator = nSignalPass + nSignalFail;
0296 
0297   printf("\nFit results:\n");
0298   if (fitResult->status() != 0) {
0299     std::cout << "ERROR: BAD FIT STATUS" << std::endl;
0300   }
0301 
0302   printf("    Efficiency = %.4f +- %.4f\n", ParEfficiency->getVal(), ParEfficiency->getPropagatedError(*fitResult));
0303   cout << "Signal Pass: " << nSignalPass << endl;
0304   cout << "Signal Fail: " << nSignalFail << endl;
0305 
0306   cout << "*********************************************************************\n";
0307   cout << "Final Parameters\n";
0308   cout << "*********************************************************************\n";
0309   PrintParameter(ParNumSignal, label, "ParNumSignal");
0310   PrintParameter(ParNumBkgPass, label, "ParNumBkgPass");
0311   PrintParameter(ParNumBkgFail, label, "ParNumBkgFail");
0312   PrintParameter(ParEfficiency, label, "ParEfficiency");
0313   PrintParameter(ParPassBackgroundExpCoefficient, label, "ParPassBackgroundExpCoefficient");
0314   PrintParameter(ParFailBackgroundExpCoefficient, label, "ParFailBackgroundExpCoefficient");
0315   PrintParameter(ParPassSignalMassShift, label, "ParPassSignalMassShift");
0316   PrintParameter(ParFailSignalMassShift, label, "ParFailSignalMassShift");
0317   PrintParameter(ParPassSignalResolution, label, "ParPassSignalResolution");
0318   PrintParameter(ParFailSignalResolution, label, "ParFailSignalResolution");
0319   cout << endl << endl;
0320 
0321   //--------------------------------------------------------------------------------------------------------------
0322   // Make plots
0323   //==============================================================================================================
0324   TFile* canvasFile = new TFile("Efficiency_FitResults.root", "UPDATE");
0325 
0326   RooAbsData::ErrorType errorType = RooAbsData::Poisson;
0327 
0328   Mass.setBins(NBINSPASS);
0329   TString cname = TString((label + "_Pass").c_str());
0330   TCanvas* c = new TCanvas(cname, cname, 800, 600);
0331   RooPlot* frame1 = Mass.frame();
0332   frame1->SetMinimum(0);
0333   dataPass->plotOn(frame1, RooFit::DataError(errorType));
0334   pdfPass.plotOn(frame1, RooFit::ProjWData(*dataPass), RooFit::Components(*bkgPassPdf), RooFit::LineColor(kRed));
0335   pdfPass.plotOn(frame1, RooFit::ProjWData(*dataPass));
0336   frame1->Draw("e0");
0337 
0338   TPaveText* plotlabel = new TPaveText(0.23, 0.87, 0.43, 0.92, "NDC");
0339   plotlabel->SetTextColor(kBlack);
0340   plotlabel->SetFillColor(kWhite);
0341   plotlabel->SetBorderSize(0);
0342   plotlabel->SetTextAlign(12);
0343   plotlabel->SetTextSize(0.03);
0344   plotlabel->AddText("CMS Preliminary 2010");
0345   TPaveText* plotlabel2 = new TPaveText(0.23, 0.82, 0.43, 0.87, "NDC");
0346   plotlabel2->SetTextColor(kBlack);
0347   plotlabel2->SetFillColor(kWhite);
0348   plotlabel2->SetBorderSize(0);
0349   plotlabel2->SetTextAlign(12);
0350   plotlabel2->SetTextSize(0.03);
0351   plotlabel2->AddText("#sqrt{s} = 7 TeV");
0352   TPaveText* plotlabel3 = new TPaveText(0.23, 0.75, 0.43, 0.80, "NDC");
0353   plotlabel3->SetTextColor(kBlack);
0354   plotlabel3->SetFillColor(kWhite);
0355   plotlabel3->SetBorderSize(0);
0356   plotlabel3->SetTextAlign(12);
0357   plotlabel3->SetTextSize(0.03);
0358   char temp[100];
0359   sprintf(temp, "%.4f", LUMINOSITY);
0360   plotlabel3->AddText((string("#int#font[12]{L}dt = ") + temp + string(" pb^{ -1}")).c_str());
0361   TPaveText* plotlabel4 = new TPaveText(0.6, 0.82, 0.8, 0.87, "NDC");
0362   plotlabel4->SetTextColor(kBlack);
0363   plotlabel4->SetFillColor(kWhite);
0364   plotlabel4->SetBorderSize(0);
0365   plotlabel4->SetTextAlign(12);
0366   plotlabel4->SetTextSize(0.03);
0367   double nsig = ParNumSignal->getVal();
0368   double nErr = ParNumSignal->getError();
0369   double e = ParEfficiency->getVal();
0370   double eErr = ParEfficiency->getError();
0371   double corr = fitResult->correlation(*ParEfficiency, *ParNumSignal);
0372   double err = ErrorInProduct(nsig, nErr, e, eErr, corr);
0373   sprintf(temp, "Signal = %.2f #pm %.2f", NumSignalPass->getVal(), err);
0374   plotlabel4->AddText(temp);
0375   TPaveText* plotlabel5 = new TPaveText(0.6, 0.77, 0.8, 0.82, "NDC");
0376   plotlabel5->SetTextColor(kBlack);
0377   plotlabel5->SetFillColor(kWhite);
0378   plotlabel5->SetBorderSize(0);
0379   plotlabel5->SetTextAlign(12);
0380   plotlabel5->SetTextSize(0.03);
0381   sprintf(temp, "Bkg = %.2f #pm %.2f", ParNumBkgPass->getVal(), ParNumBkgPass->getError());
0382   plotlabel5->AddText(temp);
0383   TPaveText* plotlabel6 = new TPaveText(0.6, 0.87, 0.8, 0.92, "NDC");
0384   plotlabel6->SetTextColor(kBlack);
0385   plotlabel6->SetFillColor(kWhite);
0386   plotlabel6->SetBorderSize(0);
0387   plotlabel6->SetTextAlign(12);
0388   plotlabel6->SetTextSize(0.03);
0389   plotlabel6->AddText("Passing probes");
0390   TPaveText* plotlabel7 = new TPaveText(0.6, 0.72, 0.8, 0.77, "NDC");
0391   plotlabel7->SetTextColor(kBlack);
0392   plotlabel7->SetFillColor(kWhite);
0393   plotlabel7->SetBorderSize(0);
0394   plotlabel7->SetTextAlign(12);
0395   plotlabel7->SetTextSize(0.03);
0396   sprintf(temp, "Eff = %.3f #pm %.3f", ParEfficiency->getVal(), ParEfficiency->getErrorHi());
0397   plotlabel7->AddText(temp);
0398   TPaveText* plotlabel8 = new TPaveText(0.6, 0.72, 0.8, 0.66, "NDC");
0399   plotlabel8->SetTextColor(kBlack);
0400   plotlabel8->SetFillColor(kWhite);
0401   plotlabel8->SetBorderSize(0);
0402   plotlabel8->SetTextAlign(12);
0403   plotlabel8->SetTextSize(0.03);
0404   sprintf(temp, "#chi^{2}/DOF = %.3f", frame1->chiSquare());
0405   plotlabel8->AddText(temp);
0406 
0407   plotlabel4->Draw();
0408   plotlabel5->Draw();
0409   plotlabel6->Draw();
0410   plotlabel7->Draw();
0411   plotlabel8->Draw();
0412 
0413   //   c->SaveAs( cname + TString(".eps"));
0414   c->SaveAs(cname + TString(".gif"));
0415   canvasFile->WriteTObject(c, c->GetName(), "WriteDelete");
0416 
0417   Mass.setBins(NBINSFAIL);
0418   cname = TString((label + "_Fail").c_str());
0419   TCanvas* c2 = new TCanvas(cname, cname, 800, 600);
0420   RooPlot* frame2 = Mass.frame();
0421   frame2->SetMinimum(0);
0422   dataFail->plotOn(frame2, RooFit::DataError(errorType));
0423   pdfFail.plotOn(frame2, RooFit::ProjWData(*dataFail), RooFit::Components(*bkgFailPdf), RooFit::LineColor(kRed));
0424   pdfFail.plotOn(frame2, RooFit::ProjWData(*dataFail));
0425   frame2->Draw("e0");
0426 
0427   plotlabel = new TPaveText(0.23, 0.87, 0.43, 0.92, "NDC");
0428   plotlabel->SetTextColor(kBlack);
0429   plotlabel->SetFillColor(kWhite);
0430   plotlabel->SetBorderSize(0);
0431   plotlabel->SetTextAlign(12);
0432   plotlabel->SetTextSize(0.03);
0433   plotlabel->AddText("CMS Preliminary 2010");
0434   plotlabel2 = new TPaveText(0.23, 0.82, 0.43, 0.87, "NDC");
0435   plotlabel2->SetTextColor(kBlack);
0436   plotlabel2->SetFillColor(kWhite);
0437   plotlabel2->SetBorderSize(0);
0438   plotlabel2->SetTextAlign(12);
0439   plotlabel2->SetTextSize(0.03);
0440   plotlabel2->AddText("#sqrt{s} = 7 TeV");
0441   plotlabel3 = new TPaveText(0.23, 0.75, 0.43, 0.80, "NDC");
0442   plotlabel3->SetTextColor(kBlack);
0443   plotlabel3->SetFillColor(kWhite);
0444   plotlabel3->SetBorderSize(0);
0445   plotlabel3->SetTextAlign(12);
0446   plotlabel3->SetTextSize(0.03);
0447   sprintf(temp, "%.4f", LUMINOSITY);
0448   plotlabel3->AddText((string("#int#font[12]{L}dt = ") + temp + string(" pb^{ -1}")).c_str());
0449   plotlabel4 = new TPaveText(0.6, 0.82, 0.8, 0.87, "NDC");
0450   plotlabel4->SetTextColor(kBlack);
0451   plotlabel4->SetFillColor(kWhite);
0452   plotlabel4->SetBorderSize(0);
0453   plotlabel4->SetTextAlign(12);
0454   plotlabel4->SetTextSize(0.03);
0455   err = ErrorInProduct(nsig, nErr, 1.0 - e, eErr, corr);
0456   sprintf(temp, "Signal = %.2f #pm %.2f", NumSignalFail->getVal(), err);
0457   plotlabel4->AddText(temp);
0458   plotlabel5 = new TPaveText(0.6, 0.77, 0.8, 0.82, "NDC");
0459   plotlabel5->SetTextColor(kBlack);
0460   plotlabel5->SetFillColor(kWhite);
0461   plotlabel5->SetBorderSize(0);
0462   plotlabel5->SetTextAlign(12);
0463   plotlabel5->SetTextSize(0.03);
0464   sprintf(temp, "Bkg = %.2f #pm %.2f", ParNumBkgFail->getVal(), ParNumBkgFail->getError());
0465   plotlabel5->AddText(temp);
0466   plotlabel6 = new TPaveText(0.6, 0.87, 0.8, 0.92, "NDC");
0467   plotlabel6->SetTextColor(kBlack);
0468   plotlabel6->SetFillColor(kWhite);
0469   plotlabel6->SetBorderSize(0);
0470   plotlabel6->SetTextAlign(12);
0471   plotlabel6->SetTextSize(0.03);
0472   plotlabel6->AddText("Failing probes");
0473   plotlabel7 = new TPaveText(0.6, 0.72, 0.8, 0.77, "NDC");
0474   plotlabel7->SetTextColor(kBlack);
0475   plotlabel7->SetFillColor(kWhite);
0476   plotlabel7->SetBorderSize(0);
0477   plotlabel7->SetTextAlign(12);
0478   plotlabel7->SetTextSize(0.03);
0479   sprintf(
0480       temp, "Eff = %.3f #pm %.3f", ParEfficiency->getVal(), ParEfficiency->getErrorHi(), ParEfficiency->getErrorLo());
0481   plotlabel7->AddText(temp);
0482   plotlabel8 = new TPaveText(0.6, 0.72, 0.8, 0.66, "NDC");
0483   plotlabel8->SetTextColor(kBlack);
0484   plotlabel8->SetFillColor(kWhite);
0485   plotlabel8->SetBorderSize(0);
0486   plotlabel8->SetTextAlign(12);
0487   plotlabel8->SetTextSize(0.03);
0488   sprintf(temp, "#chi^{2}/DOF = %.3f", frame2->chiSquare());
0489   plotlabel8->AddText(temp);
0490 
0491   //   plotlabel->Draw();
0492   //   plotlabel2->Draw();
0493   //   plotlabel3->Draw();
0494   plotlabel4->Draw();
0495   plotlabel5->Draw();
0496   plotlabel6->Draw();
0497   plotlabel7->Draw();
0498   plotlabel8->Draw();
0499 
0500   c2->SaveAs(cname + TString(".gif"));
0501   //   c2->SaveAs( cname + TString(".eps"));
0502   //   c2->SaveAs( cname + TString(".root"));
0503   canvasFile->WriteTObject(c2, c2->GetName(), "WriteDelete");
0504 
0505   canvasFile->Close();
0506 
0507   effTextFile.width(40);
0508   effTextFile << label;
0509   effTextFile.width(20);
0510   effTextFile << setiosflags(ios::fixed) << setprecision(4) << left << ParEfficiency->getVal();
0511   effTextFile.width(20);
0512   effTextFile << left << ParEfficiency->getErrorHi();
0513   effTextFile.width(20);
0514   effTextFile << left << ParEfficiency->getErrorLo();
0515   effTextFile.width(14);
0516   effTextFile << setiosflags(ios::fixed) << setprecision(2) << left << nSignalPass;
0517   effTextFile.width(14);
0518   effTextFile << left << nSignalFail << endl;
0519 }
0520 
0521 void ElectronTagAndProbeFitter() {
0522   // //////////////////////////////////////////////////////////
0523   effTextFile.width(40);
0524   effTextFile << left << "Type";
0525   effTextFile.width(20);
0526   effTextFile << left << "Efficiency";
0527   effTextFile.width(20);
0528   effTextFile << left << " Uncertainty(+) ";
0529   effTextFile.width(20);
0530   effTextFile << left << " Uncertainty(-) ";
0531   effTextFile.width(14);
0532   effTextFile << left << "NPass";
0533   effTextFile.width(14);
0534   effTextFile << left << "NFail" << endl;
0535 
0536   // //////////////////////////////////////////////////////////
0537 
0538   // //////////////////////////////////////////////////////////
0539   //   //  Super cluster --> gsfElectron efficiency
0540   // //////////////////////////////////////////////////////////
0541 
0542   //**************
0543   //User Pass Template For Fail Sample - TPTree
0544   //**************
0545   //       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" );
0546   //     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" );
0547   //       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" );
0548   //     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" );
0549   //     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" );
0550   //     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" );
0551   //     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" );
0552 
0553   //**************
0554   //User Fail Template For Fail Sample - TPTree
0555   //**************
0556   //      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" );
0557   //      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" );
0558   //      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" );
0559   //     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" );
0560   //     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" );
0561   //     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" );
0562   //     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" );
0563 
0564   //**************
0565   //Impose WP95 Iso Cut on Photon probes - TPTree  SYstematics
0566   //**************
0567   //     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" );
0568   //     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" );
0569   //     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" );
0570 
0571   //**************
0572   //Impose WP95 Iso Cut on Photon probes - BAMBU
0573   //**************
0574   //      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" );
0575   //      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" );
0576   //      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" );
0577   //     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" );
0578   //     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" );
0579   //     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" );
0580   //     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" );
0581 
0582   // //////////////////////////////////////////////////////////
0583   //   //  gsfElectron --> WP-95 selection efficiency
0584   // //////////////////////////////////////////////////////////
0585 
0586   //**************
0587   //TAG 80 - TPTree
0588   //**************
0589   //    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" );
0590   //     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" );
0591   //     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" );
0592   //     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" );
0593   //     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" );
0594   //     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" );
0595   //     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" );
0596 
0597   //**************
0598   //TAG 80 - BAMBU
0599   //**************
0600   //    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" );
0601   //     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" );
0602   //     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" );
0603   //     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" );
0604   //     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" );
0605   //     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" );
0606   //     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" );
0607 
0608   // //**************
0609   // //TAG 95 - BAMBU
0610   // //**************
0611   //    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" );
0612   //     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" );
0613   //     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" );
0614   //     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" );
0615   //     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" );
0616   //     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" );
0617   //     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" );
0618 
0619   //**************
0620   //TAG 60 - BAMBU
0621   //**************
0622   //    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" );
0623   //     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" );
0624   //     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" );
0625   //     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" );
0626   //     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" );
0627   //     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" );
0628   //     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" );
0629 
0630   //       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" );
0631   //       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" );
0632 
0633   cout << "########################################" << endl;
0634 
0635   // // //////////////////////////////////////////////////////////
0636   // //   //  gsfElectron --> WP-80 selection efficiency
0637   // // //////////////////////////////////////////////////////////
0638 
0639   //**************
0640   //TAG 80 - TP
0641   //**************
0642   //     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" );
0643   //     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" );
0644   //     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" );
0645   //     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" );
0646   //     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" );
0647   //     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" );
0648   //     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" );
0649 
0650   //**************
0651   //TAG 80 - BAMBU
0652   //**************
0653 
0654   //     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" );
0655   //     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" );
0656   //     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" );
0657   //     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" );
0658   //     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" );
0659   //     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" );
0660   //     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" );
0661 
0662   performFit("res/",
0663              "results/Parameters.txt",
0664              "Efficiency_Photon",
0665              "photonEfffromZee.passbar.dflag1.eT1.2.gT40.mt15.ptbin0.txt",
0666              "photonEfffromZee.failbar.dflag1.eT1.2.gT40.mt15.ptbin0.txt",
0667              "hh_Meg_barrel_mc_pt_0",
0668              "hh_Megf_barrel_mc_pt_0");
0669 
0670   // // //////////////////////////////////////////////////////////
0671   // //   //   WP-95 --> HLT triggering efficiency
0672   // // //////////////////////////////////////////////////////////
0673 
0674   //    cout << "########################################" << endl;
0675 
0676   // // //////////////////////////////////////////////////////////
0677   // //   //   WP-80 --> HLT triggering efficiency
0678   // // //////////////////////////////////////////////////////////
0679 
0680   //    cout << "########################################" << endl;
0681 
0682   effTextFile.close();
0683 }