void makeSVfitPerformancePlots_WH()
{
  std::string inputFileName = "/data1/veelken/tmp/svFitStudies/WH/2012May01/svFitPerformanceAnalysisPlots_all_2012Mar13.root";
  TFile* inputFile = new TFile(inputFileName.data());

  gROOT->SetBatch(true);

  std::string directory_PSkine_woLogM_Int     = "nSVfitAnalyzerOption3b";
  std::string directory_PSkine_woLogM_Fit     = "nSVfitAnalyzerOption3a";
  std::string directory_PSkine_wLogM_Int      = "nSVfitAnalyzerOption1b";
  std::string directory_PSkine_wLogM_Fit      = "nSVfitAnalyzerOption1a";
  std::string directory_MEkine12_wPolZorH_Int = "nSVfitAnalyzerOption6b";
  std::string directory_MEkine12_wPolZorH_Fit = "nSVfitAnalyzerOption6a";
  
  std::string histogramName_svFitMass = "svFitMass";
  std::string xAxisTitle_svFitMass    = "M_{#tau#tau} / GeV";

  std::vector<double> xPoints_metResolution;
  xPoints_metResolution.push_back(5.);
  xPoints_metResolution.push_back(10.);
  xPoints_metResolution.push_back(15.);
  xPoints_metResolution.push_back(20.);

  std::vector<double> massPoints;
  massPoints.push_back(90.);
  massPoints.push_back(120.);
  massPoints.push_back(140.);
  massPoints.push_back(160.);

  std::vector<double> massPointsToCompare;
  massPointsToCompare.push_back(90.);
  massPointsToCompare.push_back(120.);

  double metResolution_nominal = -1.;
  //double metResolution_nominal = 15.;

  std::vector<std::string> channels;
  channels.push_back("WtoMuNuHiggsToDiTau");

  std::vector<std::string> label_ZplusJets;
  label_ZplusJets.push_back(std::string("Sim. WZ #rightarrow #mu#nu#tau#tau"));

  std::vector<std::string> label_Higgs120;
  label_Higgs120.push_back(std::string("Sim. WH #rightarrow #mu#nu#tau#tau"));
  label_Higgs120.push_back(std::string("M = 120 GeV"));

  //-----------------------------------------------------------------------------
  // make plots comparing Fit vs. Integration 
  // in terms of resolution
  //-----------------------------------------------------------------------------

  for ( std::vector<std::string>::const_iterator channel = channels.begin();
	channel != channels.end(); ++channel ) {
    for ( std::vector<double>::const_iterator massPoint = massPointsToCompare.begin();
	  massPoint != massPointsToCompare.end(); ++massPoint ) {
      TH1* histogram1 = 
	getHistogram(inputFile, *channel, *massPoint, directory_PSkine_woLogM_Int, 
		     histogramName_svFitMass, metResolution_nominal);
      std::string legendEntry1 = "PS, Int";
      TH1* histogram2 = 
	getHistogram(inputFile, *channel, *massPoint, directory_PSkine_wLogM_Fit, 
		     histogramName_svFitMass, metResolution_nominal);
      std::string legendEntry2 = "PS + log(M), Fit";
      std::vector<std::string> label;
      std::string process = "";
      double xMax = -1.;
      if ( (*massPoint) == 90. ) {
	label = label_ZplusJets;
	process = "ZToTauTau";
	xMax = 250.;
      } else if  ( (*massPoint) == 120. ) {
	label = label_Higgs120;
	process = "HToTauTau_M-120";
	xMax = 250.;
      } else assert(0);
      double yMax = 0.;
      if   ( (*massPoint) <  95. ) yMax = 0.30;
      else                         yMax = 0.25;
      double labelSizeY = label.size()*0.05;
      showHistograms(800, 600, 
		     histogram1, legendEntry1,
		     histogram2, legendEntry2,
		     NULL, "",
		     NULL, "",
		     0.04, 0.61, 0.74, 0.28, 0.15,
		     label, 0.04, 0.17, 0.89 - labelSizeY, 0.18, labelSizeY, 
		     0., xMax, xAxisTitle_svFitMass, 1.2,
		     false, 0., yMax, "a.u.", 1.4,
		     Form("svFitPerformance_%s_%s_Fit_vs_Int_linear_WH.eps", process.data(), channel->data()));
      showHistograms(800, 600, 
		     histogram1, legendEntry1,
		     histogram2, legendEntry2,
		     NULL, "",
		     NULL, "",
		     0.04, 0.61, 0.74, 0.28, 0.15,
		     label, 0.04, 0.17, 0.89 - labelSizeY, 0.18, labelSizeY, 
		     0., 1.4*xMax, xAxisTitle_svFitMass, 1.2,
		     true, 1.e-4, 1.e0, "a.u.", 1.4,
		     Form("svFitPerformance_%s_%s_Fit_vs_Int_log_WH.eps", process.data(), channel->data()));
    }
  }
    
  //-----------------------------------------------------------------------------
  // make plots comparing different Likelihood models 
  // for leptonic and hadronic tau decays (in Integration mode)
  // in terms of resolution
  //-----------------------------------------------------------------------------
    
  for ( std::vector<std::string>::const_iterator channel = channels.begin();
	channel != channels.end(); ++channel ) {
    for ( std::vector<double>::const_iterator massPoint = massPointsToCompare.begin();
	  massPoint != massPointsToCompare.end(); ++massPoint ) {
      TH1* histogram1 = 0;
      std::string legendEntry1 = "";
      TH1* histogram2 = 0;
      std::string legendEntry2 = "";
      TH1* histogram3 = 0;
      std::string legendEntry3 = "";
      TH1* histogram4 = 0;
      std::string legendEntry4 = "";
      double legendSizeX = 0.;      
      double yMax = 0.;
      if ( (*channel) == "WtoMuNuHiggsToDiTau" ) {	
	histogram1 = 
	  getHistogram(inputFile, *channel, *massPoint, directory_PSkine_woLogM_Int, 
		       histogramName_svFitMass, metResolution_nominal);
	legendEntry1 = "PS, Int";
	histogram2 = 
	  getHistogram(inputFile, *channel, *massPoint, directory_MEkine12_wPolZorH_Int, 
		       histogramName_svFitMass, metResolution_nominal);
	legendEntry2 = "ME, Int";
	//histogram3 = 
	//  getHistogram(inputFile, *channel, *massPoint, directory_MCkine_selected_Int, 
	//	       histogramName_svFitMass, metResolution_nominal);
	//legendEntry3 = "MC, Int";
	legendSizeX = 0.12;
	if   ( (*massPoint) <  95. ) yMax = 0.30;
	else                         yMax = 0.25;
      } else assert(0);
      unsigned numLegendEntries = 0;
      if ( legendEntry1 != "" ) ++numLegendEntries;
      if ( legendEntry2 != "" ) ++numLegendEntries;
      if ( legendEntry3 != "" ) ++numLegendEntries;
      if ( legendEntry4 != "" ) ++numLegendEntries;
      double legendSizeY = 0.05*numLegendEntries;
      std::vector<std::string> label;
      std::string process = "";
      double xMax = -1.;
      if ( (*massPoint) == 90. ) {
	label = label_ZplusJets;
	process = "ZToTauTau";
	xMax = 250.;
      } else if  ( (*massPoint) == 120. ) {
	label = label_Higgs120;
	process = "HToTauTau_M-120";
	xMax = 250.;
      } else assert(0);
      double labelSizeY = label.size()*0.05;
      showHistograms(800, 600, 
		     histogram1, legendEntry1,
		     histogram2, legendEntry2,
		     histogram3, legendEntry3,
		     histogram4, legendEntry4,
		     0.04, 0.89 - legendSizeX, 0.89 - legendSizeY, legendSizeX, legendSizeY,
		     label, 0.04, 0.17, 0.89 - labelSizeY, 0.18, labelSizeY, 
		     0., xMax, xAxisTitle_svFitMass, 1.2,
		     false, 0., yMax, "a.u.", 1.4,
		     Form("svFitPerformance_%s_%s_compLikelihoodModels_linear_WH.eps", process.data(), channel->data()));
      showHistograms(800, 600, 
		     histogram1, legendEntry1,
		     histogram2, legendEntry2,
		     histogram3, legendEntry3,
		     histogram4, legendEntry4,
		     0.04, 0.89 - legendSizeX, 0.74, legendSizeX, 0.15,
		     label, 0.04, 0.17, 0.89 - labelSizeY, 0.18, labelSizeY, 
		     0., xMax, xAxisTitle_svFitMass, 1.2,
		     true, 1.e-4, 1.e0, "a.u.", 1.4,
		     Form("svFitPerformance_%s_%s_compLikelihoodModels_log_WH.eps", process.data(), channel->data()));
    }
  }
  
  int colors_style1[3] = { 1, 2, 4 };                      // style 1: used to show respone and symmetric resolution for Z vs. Higgs(120)
  int markerStyles_style1[3] = { 20, 21, 33 };

  int colors_style2[6] = { 1, 1, 2, 2, 4, 4 };             // style 2: used to show asymmetric resolution for Z vs. Higgs(120)
  int markerStyles_style2[6] = { 22, 32, 20, 24, 21, 25 }; //   (22 = right tail of resolution, 23 = left tail of resolution)
  
  //-----------------------------------------------------------------------------
  // make plots comparing SVfit mass distributions 
  // obtained for different values of MET resolution
  // in terms of response and resolution
  //-----------------------------------------------------------------------------
/*    
  for ( std::vector<std::string>::const_iterator channel = channels.begin();
	channel != channels.end(); ++channel ) {
    for ( std::vector<double>::const_iterator massPoint = massPointsToCompare.begin();
	  massPoint != massPointsToCompare.end(); ++massPoint ) {
      std::vector<std::string> label;
      std::string process = "";
      double xMax = -1.;
      if ( (*massPoint) == 90. ) {
	label = label_ZplusJets;
	process = "ZToTauTau";
	xMax = 250.;
      } else if  ( (*massPoint) == 120. ) {
	label = label_Higgs120;
	process = "HToTauTau_M-120";
      } else assert(0);
      int numEntries = TMath::Max(4, (int)xPoints_metResolution.size());
      std::vector<TH1*> histograms(numEntries);
      std::vector<std::string> legendEntries(numEntries);
      int idx = 0;
      for ( std::vector<double>::const_iterator metResolution = xPoints_metResolution.begin();
	    metResolution != xPoints_metResolution.end(); ++metResolution ) {
	histograms[idx] =  
	  getHistogram(inputFile, *channel, *massPoint, directory_PSkine_woLogM_Int, 
		       histogramName_svFitMass, *metResolution);
	legendEntries[idx] = Form("#sigma_{X} = #sigma_{Y} = %1.0f GeV", *metResolution);
	++idx;
      }
      showHistograms(800, 600, 
		     histograms[0], legendEntries[0],
		     histograms[1], legendEntries[1],
		     histograms[2], legendEntries[2],
		     histograms[3], legendEntries[3],
		     0.04, 0.61, 0.74, 0.28, 0.15,
		     label, 0.04, 0.175, 0.725, 0.24, 0.165, 
		     0., xMax, xAxisTitle_svFitMass, 1.2,
		     false, 0., 0.35, "a.u.", 1.4,
		     Form("svFitPerformance_%s_%s_PSkine_woLogM_Int_vs_metResolution_linear_WH.eps", process.data(), channel->data()));
      showHistograms(800, 600,
		     histograms[0], legendEntries[0],
		     histograms[1], legendEntries[1],
		     histograms[2], legendEntries[2],
		     histograms[3], legendEntries[3],
		     0.04, 0.61, 0.74, 0.28, 0.15,
		     label, 0.04, 0.175, 0.725, 0.24, 0.165, 
		     0., xMax, xAxisTitle_svFitMass, 1.2,
		     true, 1.e-4, 1.e0, "a.u.", 1.4,
		     Form("svFitPerformance_%s_%s_PSkine_woLogM_Int_vs_metResolution_log_WH.eps", process.data(), channel->data()));
    }
  }

  for ( std::vector<std::string>::const_iterator channel = channels.begin();
	channel != channels.end(); ++channel ) {
    std::map<std::string, std::vector<histogram_vs_X_Type> > histograms_vs_metResolution; // key = process
    for ( std::vector<double>::const_iterator massPoint = massPointsToCompare.begin();
	  massPoint != massPointsToCompare.end(); ++massPoint ) {
      std::string process = "";
      if      ( (*massPoint) ==  90. ) process = "ZToTauTau";
      else if ( (*massPoint) == 120. ) process = "HToTauTau_M-120";
      else assert(0);
      for ( std::vector<double>::const_iterator metResolution = xPoints_metResolution.begin();
	    metResolution != xPoints_metResolution.end(); ++metResolution ) {
	TH1* histogram =  
	  getHistogram(inputFile, *channel, *massPoint, directory_PSkine_woLogM_Int, 
		       histogramName_svFitMass, *metResolution);
	histograms_vs_metResolution[process].push_back(
	  histogram_vs_X_Type(histogram, *metResolution, 0., 0.));
      }    
    }
    std::vector<std::string> label_metResolution;
    TGraph* graph_ZplusJets_response = makeGraph(histograms_vs_metResolution["ZToTauTau"], 90., "response");
    TGraph* graph_Higgs120_response  = makeGraph(histograms_vs_metResolution["HToTauTau_M-120"], 120., "response");
    showGraphs(800, 600,
	       graph_ZplusJets_response, "Sim. Z #rightarrow #tau#tau", 
	       graph_Higgs120_response, "Sim. H_{120} #rightarrow #tau#tau",
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style1, markerStyles_style1,
	       0.04, 0.61, 0.74, 0.28, 0.15,
	       label_metResolution, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       0., 25., "#sigma_{X/Y} / GeV", 1.2,
	       0.75, 1.25, "<M_{#tau#tau}>/M", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_response_vs_metResolution_WH.eps", channel->data()));
    TGraph* graph_ZplusJets_response_asymmetric = makeGraph(histograms_vs_metResolution["ZToTauTau"], 90., "response_asymmetric");
    TGraph* graph_Higgs120_response_asymmetric  = makeGraph(histograms_vs_metResolution["HToTauTau_M-120"], 120., "response_asymmetric");
    showGraphs(800, 600,
	       graph_ZplusJets_response_asymmetric, "Sim. Z #rightarrow #tau#tau", 
	       graph_Higgs120_response_asymmetric, "Sim. H_{120} #rightarrow #tau#tau",
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style1, markerStyles_style1,
	       0.04, 0.61, 0.74, 0.28, 0.15,
	       label_metResolution, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       0., 25., "#sigma_{X/Y} / GeV", 1.2,
	       0.75, 1.25, "M_{#tau#tau}^{max}/M", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_response_vs_metResolution_asymmetric_WH.eps", channel->data()));
    TGraph* graph_ZplusJets_resolution = makeGraph(histograms_vs_metResolution["ZToTauTau"], 90., "resolution");
    TGraph* graph_Higgs120_resolution  = makeGraph(histograms_vs_metResolution["HToTauTau_M-120"], 120., "resolution");
    showGraphs(800, 600,
	       graph_ZplusJets_resolution, "Sim. Z #rightarrow #tau#tau", 
	       graph_Higgs120_resolution, "Sim. H_{120} #rightarrow #tau#tau",
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style1, markerStyles_style1,
	       0.04, 0.61, 0.74, 0.28, 0.15,
	       label_metResolution, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       0., 25., "#sigma_{X/Y} / GeV", 1.2,
	       0., 0.50, "#sigmaM_{#tau#tau}/<M_{#tau#tau}>", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_resolution_vs_metResolution_WH.eps", channel->data()));
    TGraph* graph_ZplusJets_resolution_asymmetric_left  = makeGraph(histograms_vs_metResolution["ZToTauTau"], 90., "resolution_asymmetric_left");
    TGraph* graph_ZplusJets_resolution_asymmetric_right = makeGraph(histograms_vs_metResolution["ZToTauTau"], 90., "resolution_asymmetric_right");
    TGraph* graph_Higgs120_resolution_asymmetric_left   = makeGraph(histograms_vs_metResolution["HToTauTau_M-120"], 120., "resolution_asymmetric_left");
    TGraph* graph_Higgs120_resolution_asymmetric_right  = makeGraph(histograms_vs_metResolution["HToTauTau_M-120"], 120., "resolution_asymmetric_right");
    showGraphs(800, 600,
	       graph_ZplusJets_resolution_asymmetric_right, "Sim. Z #rightarrow #tau#tau +",
	       graph_ZplusJets_resolution_asymmetric_left, "Sim. Z #rightarrow #tau#tau -",
	       graph_Higgs120_resolution_asymmetric_right, "Sim. H_{120} #rightarrow #tau#tau +",
	       graph_Higgs120_resolution_asymmetric_left, "Sim. H_{120} #rightarrow #tau#tau -",
	       NULL, "", 
	       NULL, "", 
	       colors_style2, markerStyles_style2,
	       0.04, 0.59, 0.64, 0.30, 0.25,
	       label_metResolution, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       0., 25., "#sigma_{X/Y} / GeV", 1.2,
	       0., 0.60, "#sigmaM_{#tau#tau}/M_{#tau#tau}^{max}", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_resolution_vs_metResolution_asymmetric_WH.eps", channel->data()));
  }
 */
  //-----------------------------------------------------------------------------
  // make plots of response and resolution 
  // obtained for different values of the true tau-pair mass
  //-----------------------------------------------------------------------------

  for ( std::vector<std::string>::const_iterator channel = channels.begin();
	channel != channels.end(); ++channel ) {
    std::vector<histogram_vs_X_Type> histograms_vs_mA;
    std::vector<double> y_true_array;
    for ( std::vector<double>::const_iterator massPoint = massPoints.begin();
	  massPoint != massPoints.end(); ++massPoint ) {
      std::string process = "";
      if ( (*massPoint) == 90. ) {
	process = "ZToTauTau";
      } else {
	process = Form("HToTauTau_M-%1.0f", *massPoint);
      }
      TH1* histogram = 
	getHistogram(inputFile, *channel, *massPoint, directory_PSkine_woLogM_Int, 
		     histogramName_svFitMass, metResolution_nominal);
      histograms_vs_mA.push_back(
	histogram_vs_X_Type(histogram, *massPoint, 0., 0.));
      y_true_array.push_back(*massPoint);
    }
    std::vector<std::string> label_mA;
    TGraph* graph_response = makeGraph(histograms_vs_mA, y_true_array, "response");
    showGraphs(800, 600,
	       graph_response, "Sim. Z/H #rightarrow #tau#tau",
	       NULL, "", 
	       NULL, "",
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style1, markerStyles_style1,
	       0.04, 0.61, 0.74, 0.28, 0.15,
	       label_mA, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       70., 180., "M / GeV", 1.2,
	       0.75, 1.25, "<M_{#tau#tau}>/M", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_response_vs_mA_WH.eps", channel->data()));
    TGraph* graph_response_asymmetric = makeGraph(histograms_vs_mA, y_true_array, "response_asymmetric");
    showGraphs(800, 600,
	       graph_response_asymmetric, "Sim. Z/H #rightarrow #tau#tau", 
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style1, markerStyles_style1,
	       0.04, 0.61, 0.74, 0.28, 0.15,
	       label_mA, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       70., 180., "M / GeV", 1.2,
	       0.75, 1.25, "M_{#tau#tau}^{max}/M", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_response_vs_mA_asymmetric_WH.eps", channel->data()));
    TGraph* graph_resolution = makeGraph(histograms_vs_mA, y_true_array, "resolution");
    showGraphs(800, 600,
	       graph_resolution, "Sim. Z/H #rightarrow #tau#tau", 
	       NULL, "", 
	       NULL, "",
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style1, markerStyles_style1,
	       0.04, 0.61, 0.74, 0.28, 0.15,
	       label_mA, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       70., 180., "M / GeV", 1.2,
	       0., 0.50, "#sigmaM_{#tau#tau}/<M_{#tau#tau}>", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_resolution_vs_mA_WH.eps", channel->data()));
    TGraph* graph_resolution_asymmetric_left  = makeGraph(histograms_vs_mA, y_true_array, "resolution_asymmetric_left");
    TGraph* graph_resolution_asymmetric_right = makeGraph(histograms_vs_mA, y_true_array, "resolution_asymmetric_right");
    showGraphs(800, 600,
	       graph_resolution_asymmetric_right, "Sim. Z/H #rightarrow #tau#tau +",
	       graph_resolution_asymmetric_left, "Sim. Z/H #rightarrow #tau#tau -",
	       NULL, "",
	       NULL, "", 
	       NULL, "", 
	       NULL, "", 
	       colors_style2, markerStyles_style2,
	       0.04, 0.59, 0.74, 0.30, 0.15,
	       label_mA, 0.04, 0.175, 0.725, 0.24, 0.165, 
	       70., 180., "M / GeV", 1.2,
	       0., 0.50, "#sigmaM_{#tau#tau}/M_{#tau#tau}^{max}", 1.4,
	       Form("svFitPerformance_%s_PSkine_woLogM_Int_resolution_vs_mA_asymmetric_WH.eps", channel->data()));
  }
      
  delete inputFile;
}
void plotTauIdMVAEfficiency_and_FakeRate()
{
//--- stop ROOT from keeping references to all histograms
  TH1::AddDirectory(false);

//--- suppress the output canvas 
  gROOT->SetBatch(true);

  std::vector<mvaEntryType*> mvaEntries;
  mvaEntries.push_back(new mvaEntryType("/data1/veelken/tmp/tauIdMVATraining/tauId_v1_6/trainTauIdMVA_mvaIsolation3HitsDeltaR04opt1b.root",     "opt1b",   0.80, kLogTauPt, kTauAbsEta));
  mvaEntries.push_back(new mvaEntryType("/data1/veelken/tmp/tauIdMVATraining/tauId_v1_6/trainTauIdMVA_mvaIsolation3HitsDeltaR04opt1c.root",     "opt1c",   0.80, kTauPt, kTauAbsEta));
  mvaEntries.push_back(new mvaEntryType("/data1/veelken/tmp/tauIdMVATraining/tauId_v1_13_4/trainTauIdMVA_mvaIsolation3HitsDeltaR05opt2a.root",   "opt2a",   0.80, kLogTauPt, kTauAbsEta));
  mvaEntries.push_back(new mvaEntryType("/data1/veelken/tmp/tauIdMVATraining/tauId_v1_13_4/trainTauIdMVA_mvaIsolation3HitsDeltaR05opt2aLT.root", "opt2aLT", 0.80, kLogTauPt, kTauAbsEta));
  mvaEntries.push_back(new mvaEntryType("/data1/veelken/tmp/tauIdMVATraining/tauId_v1_13_4/trainTauIdMVA_mvaIsolation3HitsDeltaR05opt2b.root",   "opt2b",   0.80, kLogTauPt, kTauAbsEta));
  mvaEntries.push_back(new mvaEntryType("/data1/veelken/tmp/tauIdMVATraining/tauId_v1_13_4/trainTauIdMVA_mvaIsolation3HitsDeltaR05opt2bLT.root", "opt2bLT", 0.80, kLogTauPt, kTauAbsEta));

  for ( std::vector<mvaEntryType*>::iterator mvaEntry = mvaEntries.begin();
	mvaEntry != mvaEntries.end(); ++mvaEntry ) {
    std::cout << "processing " << (*mvaEntry)->legendEntry_ << std::endl;
    fillPlots((*mvaEntry)->inputFileName_, (*mvaEntry)->plots_signal_, (*mvaEntry)->plots_background_, 
	      (*mvaEntry)->mvaCut_, 
	      (*mvaEntry)->tauPtMode_, (*mvaEntry)->tauEtaMode_, 
	      (*mvaEntry)->mvaOutput_normalization_);
  }
/*  
  showEfficiency("", 800, 600,
		 mvaEntries[0]->plots_signal_->histogramPt_numerator_, mvaEntries[0]->plots_signal_->histogramPt_denominator_, mvaEntries[0]->legendEntry_,
		 mvaEntries[1]->plots_signal_->histogramPt_numerator_, mvaEntries[1]->plots_signal_->histogramPt_denominator_, mvaEntries[1]->legendEntry_,
		 mvaEntries[2]->plots_signal_->histogramPt_numerator_, mvaEntries[2]->plots_signal_->histogramPt_denominator_, mvaEntries[2]->legendEntry_,
		 mvaEntries[3]->plots_signal_->histogramPt_numerator_, mvaEntries[3]->plots_signal_->histogramPt_denominator_, mvaEntries[3]->legendEntry_,
		 mvaEntries[4]->plots_signal_->histogramPt_numerator_, mvaEntries[4]->plots_signal_->histogramPt_denominator_, mvaEntries[4]->legendEntry_,
		 mvaEntries[5]->plots_signal_->histogramPt_numerator_, mvaEntries[5]->plots_signal_->histogramPt_denominator_, mvaEntries[5]->legendEntry_,
		 "P_{T} / GeV", 1.2, 
		 false, 0.5, 1., "Efficiency", 1.2, 
		 0.61, 0.165, 
		 "plots/plotTauIdMVAEfficiency_vs_Pt.png");
  showEfficiency("", 800, 600,
		 mvaEntries[0]->plots_signal_->histogramEta_numerator_, mvaEntries[0]->plots_signal_->histogramEta_denominator_, mvaEntries[0]->legendEntry_,
		 mvaEntries[1]->plots_signal_->histogramEta_numerator_, mvaEntries[1]->plots_signal_->histogramEta_denominator_, mvaEntries[1]->legendEntry_,
		 mvaEntries[2]->plots_signal_->histogramEta_numerator_, mvaEntries[2]->plots_signal_->histogramEta_denominator_, mvaEntries[2]->legendEntry_,
		 mvaEntries[3]->plots_signal_->histogramEta_numerator_, mvaEntries[3]->plots_signal_->histogramEta_denominator_, mvaEntries[3]->legendEntry_,
		 mvaEntries[4]->plots_signal_->histogramEta_numerator_, mvaEntries[4]->plots_signal_->histogramEta_denominator_, mvaEntries[4]->legendEntry_,
		 mvaEntries[5]->plots_signal_->histogramEta_numerator_, mvaEntries[5]->plots_signal_->histogramEta_denominator_, mvaEntries[5]->legendEntry_,
		 "#eta", 1.2, 
		 false, 0.5, 1., "Efficiency", 1.2, 
		 0.61, 0.165, 
		 "plots/plotTauIdMVAEfficiency_vs_Eta.png");
  showEfficiency("", 800, 600,
		 mvaEntries[0]->plots_signal_->histogramNvtx_numerator_, mvaEntries[0]->plots_signal_->histogramNvtx_denominator_, mvaEntries[0]->legendEntry_,
		 mvaEntries[1]->plots_signal_->histogramNvtx_numerator_, mvaEntries[1]->plots_signal_->histogramNvtx_denominator_, mvaEntries[1]->legendEntry_,
		 mvaEntries[2]->plots_signal_->histogramNvtx_numerator_, mvaEntries[2]->plots_signal_->histogramNvtx_denominator_, mvaEntries[2]->legendEntry_,
		 mvaEntries[3]->plots_signal_->histogramNvtx_numerator_, mvaEntries[3]->plots_signal_->histogramNvtx_denominator_, mvaEntries[3]->legendEntry_,
		 mvaEntries[4]->plots_signal_->histogramNvtx_numerator_, mvaEntries[4]->plots_signal_->histogramNvtx_denominator_, mvaEntries[4]->legendEntry_,
		 mvaEntries[5]->plots_signal_->histogramNvtx_numerator_, mvaEntries[5]->plots_signal_->histogramNvtx_denominator_, mvaEntries[5]->legendEntry_,
		 "N_{vtx}", 1.2, 
		 false, 0.5, 1., "Efficiency", 1.2, 
		 0.61, 0.165, 
		 "plots/plotTauIdMVAEfficiency_vs_Nvtx.png");
  
  showEfficiency("", 800, 600,
		 mvaEntries[0]->plots_background_->histogramPt_numerator_, mvaEntries[0]->plots_background_->histogramPt_denominator_, mvaEntries[0]->legendEntry_,
		 mvaEntries[1]->plots_background_->histogramPt_numerator_, mvaEntries[1]->plots_background_->histogramPt_denominator_, mvaEntries[1]->legendEntry_,
		 mvaEntries[2]->plots_background_->histogramPt_numerator_, mvaEntries[2]->plots_background_->histogramPt_denominator_, mvaEntries[2]->legendEntry_,
		 mvaEntries[3]->plots_background_->histogramPt_numerator_, mvaEntries[3]->plots_background_->histogramPt_denominator_, mvaEntries[3]->legendEntry_,
		 mvaEntries[4]->plots_background_->histogramPt_numerator_, mvaEntries[4]->plots_background_->histogramPt_denominator_, mvaEntries[4]->legendEntry_,
		 mvaEntries[5]->plots_background_->histogramPt_numerator_, mvaEntries[5]->plots_background_->histogramPt_denominator_, mvaEntries[5]->legendEntry_,
		 "P_{T} / GeV", 1.2, 
		 true, 1.e-3, 1., "Fake-rate", 1.2, 
		 0.61, 0.545,
		 "plots/plotTauIdMVAFakeRate_vs_Pt.png");
  showEfficiency("", 800, 600,
		 mvaEntries[0]->plots_background_->histogramEta_numerator_, mvaEntries[0]->plots_background_->histogramEta_denominator_, mvaEntries[0]->legendEntry_,
		 mvaEntries[1]->plots_background_->histogramEta_numerator_, mvaEntries[1]->plots_background_->histogramEta_denominator_, mvaEntries[1]->legendEntry_,
		 mvaEntries[2]->plots_background_->histogramEta_numerator_, mvaEntries[2]->plots_background_->histogramEta_denominator_, mvaEntries[2]->legendEntry_,
		 mvaEntries[3]->plots_background_->histogramEta_numerator_, mvaEntries[3]->plots_background_->histogramEta_denominator_, mvaEntries[3]->legendEntry_,
		 mvaEntries[4]->plots_background_->histogramEta_numerator_, mvaEntries[4]->plots_background_->histogramEta_denominator_, mvaEntries[4]->legendEntry_,
		 mvaEntries[5]->plots_background_->histogramEta_numerator_, mvaEntries[5]->plots_background_->histogramEta_denominator_, mvaEntries[5]->legendEntry_,
		 "#eta", 1.2, 
		 true, 1.e-3, 1., "Fake-rate", 1.2, 
		 0.61, 0.545,
		 "plots/plotTauIdMVAFakeRate_vs_Eta.png");
  showEfficiency("", 800, 600,
		 mvaEntries[0]->plots_background_->histogramNvtx_numerator_, mvaEntries[0]->plots_background_->histogramNvtx_denominator_, mvaEntries[0]->legendEntry_,
		 mvaEntries[1]->plots_background_->histogramNvtx_numerator_, mvaEntries[1]->plots_background_->histogramNvtx_denominator_, mvaEntries[1]->legendEntry_,
		 mvaEntries[2]->plots_background_->histogramNvtx_numerator_, mvaEntries[2]->plots_background_->histogramNvtx_denominator_, mvaEntries[2]->legendEntry_,
		 mvaEntries[3]->plots_background_->histogramNvtx_numerator_, mvaEntries[3]->plots_background_->histogramNvtx_denominator_, mvaEntries[3]->legendEntry_,
		 mvaEntries[4]->plots_background_->histogramNvtx_numerator_, mvaEntries[4]->plots_background_->histogramNvtx_denominator_, mvaEntries[4]->legendEntry_,
		 mvaEntries[5]->plots_background_->histogramNvtx_numerator_, mvaEntries[5]->plots_background_->histogramNvtx_denominator_, mvaEntries[5]->legendEntry_,
		 "N_{vtx}", 1.2, 
		 true, 1.e-3, 1., "Fake-rate", 1.2, 
		 0.61, 0.545,
		 "plots/plotTauIdMVAFakeRate_vs_Nvtx.png");
 */

  for ( std::vector<mvaEntryType*>::iterator mvaEntry = mvaEntries.begin();
	mvaEntry != mvaEntries.end(); ++mvaEntry ) {

    normalizeHistogram((*mvaEntry)->plots_signal_->histogramPt_numerator_);
    normalizeHistogram((*mvaEntry)->plots_signal_->histogramPt_denominator_);
    normalizeHistogram((*mvaEntry)->plots_signal_->histogramEta_numerator_);
    normalizeHistogram((*mvaEntry)->plots_signal_->histogramEta_denominator_);
    normalizeHistogram((*mvaEntry)->plots_signal_->histogramNvtx_numerator_);
    normalizeHistogram((*mvaEntry)->plots_signal_->histogramNvtx_denominator_);

    normalizeHistogram((*mvaEntry)->plots_background_->histogramPt_numerator_);
    normalizeHistogram((*mvaEntry)->plots_background_->histogramPt_denominator_);
    normalizeHistogram((*mvaEntry)->plots_background_->histogramEta_numerator_);
    normalizeHistogram((*mvaEntry)->plots_background_->histogramEta_denominator_);
    normalizeHistogram((*mvaEntry)->plots_background_->histogramNvtx_numerator_);
    normalizeHistogram((*mvaEntry)->plots_background_->histogramNvtx_denominator_);

    showDistribution("", 800, 600,
		     (*mvaEntry)->plots_signal_->histogramPt_denominator_, "Signal",
		     (*mvaEntry)->plots_background_->histogramPt_denominator_, "Background",
		     0, "",
		     0, "",
		     "P_{T} / GeV", 1.2, 
		     true, 1.e-3, 1., "a.u.", 1.2, 
		     0.145, 0.745, 
		     TString(Form("plots/plotTauIdMVAEfficiency_and_FakeRate_denominatorPt_%s.png", (*mvaEntry)->legendEntry_.data())).ReplaceAll(" ", "").Data());
    showDistribution("", 800, 600,
		     (*mvaEntry)->plots_signal_->histogramEta_denominator_, "Signal",
		     (*mvaEntry)->plots_background_->histogramEta_denominator_, "Background",
		     0, "",
		     0, "",
		     "#eta", 1.2, 
		     true, 1.e-3, 1., "a.u.", 1.2, 
		     0.145, 0.745, 
		     TString(Form("plots/plotTauIdMVAEfficiency_and_FakeRate_denominatorEta_%s.png", (*mvaEntry)->legendEntry_.data())).ReplaceAll(" ", "").Data());
    showDistribution("", 800, 600,
		     (*mvaEntry)->plots_signal_->histogramNvtx_denominator_, "Signal",
		     (*mvaEntry)->plots_background_->histogramNvtx_denominator_, "Background",
		     0, "",
		     0, "",
		     "N_{vtx}", 1.2, 
		     true, 1.e-3, 1., "a.u.", 1.2, 
		     0.145, 0.745, 
		     TString(Form("plots/plotTauIdMVAEfficiency_and_FakeRate_denominatorNvtx_%s.png", (*mvaEntry)->legendEntry_.data())).ReplaceAll(" ", "").Data());

    TGraph* graphEfficiencyEq40percent = compMVAcut((*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_signal_->histogramPt_, 0.40);
    TGraph* graphEfficiencyEq50percent = compMVAcut((*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_signal_->histogramPt_, 0.50);
    TGraph* graphEfficiencyEq60percent = compMVAcut((*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_signal_->histogramPt_, 0.60);
    TGraph* graphEfficiencyEq70percent = compMVAcut((*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_signal_->histogramPt_, 0.70);
    TGraph* graphEfficiencyEq80percent = compMVAcut((*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_signal_->histogramPt_, 0.80);
    TGraph* graphEfficiencyEq90percent = compMVAcut((*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_signal_->histogramPt_, 0.90);

    showGraphs("#tau_{had} Efficiency", 800, 600,
	       graphEfficiencyEq90percent, "90%",
	       graphEfficiencyEq80percent, "80%",
	       graphEfficiencyEq70percent, "70%",
	       graphEfficiencyEq60percent, "60%",
	       graphEfficiencyEq50percent, "50%",
	       graphEfficiencyEq40percent, "40%",
	       0., 2500., 10, "P_{T} / GeV", 1.2,
	       0.0, 1.0, "MVA_{cut}", 1.35,
	       0.69, 0.145, 
	       TString(Form("plots/plotTauIdMVAEfficiency_MVAcutVsPtConstEfficiency_%s.png", (*mvaEntry)->legendEntry_.data())).ReplaceAll(" ", "").Data());

    std::string outputFileName_MVAoutput_vs_Pt = Form("plots/plotTauIdMVAEfficiency_and_FakeRate_MVAoutput_vs_Pt_%s.root", (*mvaEntry)->mvaName_.data());
    TFile* outputFile_MVAoutput_vs_Pt = new TFile(outputFileName_MVAoutput_vs_Pt.data(), "RECREATE");
    (*mvaEntry)->plots_signal_->histogramMVAoutput_vs_Pt_->Write();
    delete outputFile_MVAoutput_vs_Pt;

    std::string outputFileName_effGraphs = Form("wpDiscriminationByIsolationMVA3_%s.root", (*mvaEntry)->mvaName_.data());
    graphEfficiencyEq90percent->SetName(Form("%sEff90", (*mvaEntry)->mvaName_.data()));
    graphEfficiencyEq80percent->SetName(Form("%sEff80", (*mvaEntry)->mvaName_.data()));
    graphEfficiencyEq70percent->SetName(Form("%sEff70", (*mvaEntry)->mvaName_.data()));
    graphEfficiencyEq60percent->SetName(Form("%sEff60", (*mvaEntry)->mvaName_.data()));
    graphEfficiencyEq50percent->SetName(Form("%sEff50", (*mvaEntry)->mvaName_.data()));
    graphEfficiencyEq40percent->SetName(Form("%sEff40", (*mvaEntry)->mvaName_.data()));      
    TFile* outputFile_effGraphs = new TFile(outputFileName_effGraphs.data(), "RECREATE");
    graphEfficiencyEq90percent->Write();
    graphEfficiencyEq80percent->Write();
    graphEfficiencyEq70percent->Write();
    graphEfficiencyEq60percent->Write();
    graphEfficiencyEq50percent->Write();
    graphEfficiencyEq40percent->Write();
    (*mvaEntry)->mvaOutput_normalization_->Write();
    delete outputFile_effGraphs;

    TGraph* graphFakeRateEq001percent = compMVAcut((*mvaEntry)->plots_background_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_background_->histogramPt_, 0.001);
    TGraph* graphFakeRateEq002percent = compMVAcut((*mvaEntry)->plots_background_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_background_->histogramPt_, 0.002);
    TGraph* graphFakeRateEq005percent = compMVAcut((*mvaEntry)->plots_background_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_background_->histogramPt_, 0.005);
    TGraph* graphFakeRateEq010percent = compMVAcut((*mvaEntry)->plots_background_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_background_->histogramPt_, 0.010);
    TGraph* graphFakeRateEq020percent = compMVAcut((*mvaEntry)->plots_background_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_background_->histogramPt_, 0.020);
    TGraph* graphFakeRateEq050percent = compMVAcut((*mvaEntry)->plots_background_->histogramMVAoutput_vs_Pt_, (*mvaEntry)->plots_background_->histogramPt_, 0.050);
    
    showGraphs("#tau_{had} Fake-rate", 800, 600,
	       graphFakeRateEq050percent, "5%",
	       graphFakeRateEq020percent, "2%",
	       graphFakeRateEq010percent, "1%",
	       graphFakeRateEq005percent, "0.5%",
	       graphFakeRateEq002percent, "0.2%",
	       graphFakeRateEq001percent, "0.1%",
	       0., 2500., 10, "P_{T} / GeV", 1.2,
	       0.0, 1.0, "MVA_{cut}", 1.35,
	       0.69, 0.145, 
	       TString(Form("plots/plotTauIdMVAEfficiency_MVAcutVsPtConstFakeRate_%s.png", (*mvaEntry)->legendEntry_.data())).ReplaceAll(" ", "").Data());
  }    

  for ( std::vector<mvaEntryType*>::iterator it = mvaEntries.begin();
	it != mvaEntries.end(); ++it ) {
    delete (*it);
  }
}
void makeSVfitLikelihoodSeparationPlots()
{
  TString inputFileName_Z = "/data1/veelken/tmp/svFitStudies/testNSVfitTrackLikelihoods4_plots_Z_tautau_90_2013Aug06.root";
  TFile* inputFile_Z = new TFile(inputFileName_Z.Data());

  TString inputFileName_Higgs = "/data1/veelken/tmp/svFitStudies/testNSVfitTrackLikelihoods4_plots_Higgs_tautau_125_2013Aug06.root";
  TFile* inputFile_Higgs = new TFile(inputFileName_Higgs.Data());

  gROOT->SetBatch(true);

  std::vector<std::string> likelihoodOptions;
  //likelihoodOptions.push_back("const");
  //likelihoodOptions.push_back("decayKine");
  //likelihoodOptions.push_back("met");
  //likelihoodOptions.push_back("track");
  //likelihoodOptions.push_back("decayKinePlusMEt");
  //likelihoodOptions.push_back("trackPlusDecayKine");
  //likelihoodOptions.push_back("trackPlusMEt");
  //likelihoodOptions.push_back("trackPlusDecayKinePlusMEt");
  likelihoodOptions.push_back("decayKinePlusMEtVEGAS_max");
  likelihoodOptions.push_back("decayKinePlusMEtVEGAS_meanGt80%*max");
  likelihoodOptions.push_back("decayKinePlusMEtMarkovChain_max");
  likelihoodOptions.push_back("decayKinePlusMEtMarkovChain_meanGt80%*max");
  likelihoodOptions.push_back("trackPlusDecayKinePlusMEtVEGAS_max");
  likelihoodOptions.push_back("trackPlusDecayKinePlusMEtVEGAS_meanGt80%*max");
  likelihoodOptions.push_back("trackPlusDecayKinePlusMEtMarkovChain_max");
  likelihoodOptions.push_back("trackPlusDecayKinePlusMEtMarkovChain_meanGt80%*max");

  std::map<std::string, std::string> dqmDirectories; // key = likelihoodOption
  //dqmDirectories["const"]                     = "nSVfitProducerByIntegration2W";
  //dqmDirectories["decayKine"]                 = "nSVfitProducerByIntegration2WdecayKine";
  //dqmDirectories["met"]                       = "nSVfitProducerByIntegration2Wmet";
  //dqmDirectories["track"]                     = "nSVfitProducerByIntegration2Wtrack";
  //dqmDirectories["decayKinePlusMEt"]          = "nSVfitProducerByIntegration2WdecayKinePlusMEt";
  //dqmDirectories["trackPlusDecayKine"]        = "nSVfitProducerByIntegration2WtrackPlusDecayKine";
  //dqmDirectories["trackPlusMEt"]              = "nSVfitProducerByIntegration2WtrackPlusMEt";
  //dqmDirectories["trackPlusDecayKinePlusMEt"] = "nSVfitProducerByIntegration2WtrackPlusDecayKinePlusMEt";
  dqmDirectories["decayKinePlusMEtVEGAS_max"]                          = "nSVfitProducerByIntegration2WdecayKinePlusMEtMax";
  dqmDirectories["decayKinePlusMEtVEGAS_meanGt80%*max"]                = "nSVfitProducerByIntegration2WdecayKinePlusMEtMeanGt80pc";
  dqmDirectories["decayKinePlusMEtMarkovChain_max"]                    = "nSVfitProducerByIntegration2WtrackWlifetimeWdecayVertexForLeg1Leg2PlusDecayKinePlusMEtMax";
  dqmDirectories["decayKinePlusMEtMarkovChain_meanGt80%*max"]          = "nSVfitProducerByIntegration2WtrackWlifetimeWdecayVertexForLeg1Leg2PlusDecayKinePlusMEtMeanGt80pc";
  dqmDirectories["trackPlusDecayKinePlusMEtVEGAS_max"]                 = "nSVfitProducerByIntegrationWdecayKinePlusMEtMax";
  dqmDirectories["trackPlusDecayKinePlusMEtVEGAS_meanGt80%*max"]       = "nSVfitProducerByIntegrationWdecayKinePlusMEtMeanGt80pc";
  dqmDirectories["trackPlusDecayKinePlusMEtMarkovChain_max"]           = "nSVfitProducerByIntegrationWtrackWlifetimeWdecayVertexForLeg1Leg2PlusDecayKinePlusMEtMax";
  dqmDirectories["trackPlusDecayKinePlusMEtMarkovChain_meanGt80%*max"] = "nSVfitProducerByIntegrationWtrackWlifetimeWdecayVertexForLeg1Leg2PlusDecayKinePlusMEtMeanGt80pc";
  
  std::map<std::string, std::string> legendEntries; // key = likelihoodOption
  //legendEntries["const"]                      = "1";
  //legendEntries["decayKine"]                  = "Kine";
  //legendEntries["met"]                        = "MET";
  //legendEntries["track"]                      = "Trk";
  //legendEntries["decayKinePlusMEt"]           = "Kine+MET";
  //legendEntries["trackPlusDecayKine"]         = "Kine+Trk";
  //legendEntries["trackPlusMEt"]               = "MET+Trk";
  //legendEntries["trackPlusDecayKinePlusMEt"]  = "Kine+MET+Trk";
  legendEntries["decayKinePlusMEtVEGAS_max"]                           = "Kine+MET VEGAS_{max}";
  legendEntries["decayKinePlusMEtVEGAS_meanGt80%*max"]                 = "Kine+MET VEGAS_{mean}";
  legendEntries["decayKinePlusMEtMarkovChain_max"]                     = "Kine+MET MC_{max}";
  legendEntries["decayKinePlusMEtMarkovChain_meanGt80%*max"]           = "Kine+MET MC_{mean}";
  legendEntries["trackPlusDecayKinePlusMEtVEGAS_max"]                  = "Kine+MET+Trk VEGAS_{max}";
  legendEntries["trackPlusDecayKinePlusMEtVEGAS_meanGt80%*max"]        = "Kine+MET+Trk VEGAS_{mean}";
  legendEntries["trackPlusDecayKinePlusMEtMarkovChain_max"]            = "Kine+MET+Trk MC_{max}";
  legendEntries["trackPlusDecayKinePlusMEtMarkovChain_meanGt80%*max"]  = "Kine+MET+Trk MC_{mean}";

  std::string histogramName = "plotEntryType/svFitMass";

  std::map<std::string, const TH1*> histograms_Z;     // key = likelihoodOption
  std::map<std::string, const TH1*> histograms_Higgs; // key = likelihoodOption

  std::map<std::string, TGraph*> separationCurves; // key = likelihoodOption

  for ( std::vector<std::string>::const_iterator likelihoodOption = likelihoodOptions.begin();
	likelihoodOption != likelihoodOptions.end(); ++likelihoodOption ) {
    TH1* histogram_Z = getHistogram(inputFile_Z, dqmDirectories[*likelihoodOption], histogramName);
    histograms_Z[*likelihoodOption] = histogram_Z;

    TH1* histogram_Higgs = getHistogram(inputFile_Higgs, dqmDirectories[*likelihoodOption], histogramName);
    histograms_Higgs[*likelihoodOption] = histogram_Higgs;

    TGraph* separationCurve = makeSeparationCurve(histogram_Z, histogram_Higgs);
    separationCurves[*likelihoodOption] = separationCurve;
  }

  int colors[8]     = {  1,  2,  8,  4, 28,  6,  7, 14 };
  int lineWidths[8] = {  1,  1,  1,  1,  2,  2,  2,  1 }; 
  int lineStyles[8] = {  1,  1,  1,  1,  7,  7,  7,  1 }; 

  showGraphs(800, 600, 
	     likelihoodOptions,
	     separationCurves,
	     legendEntries,
	     colors, lineWidths, lineStyles,
	     0.050, 0.165, 0.165, 0.40, 0.40,
	     0., 1., "Int_{H}^{M > X}", 1.2,
	     0., 1., "1 - Int_{Z}^{M > X}", 1.2,
	     "makeSVfitLikelihoodSeparationPlots.pdf");

  TGraph* intGraph_Z_opt1     = makeIntGraph(histograms_Z["decayKinePlusMEtVEGAS_max"]);
  TGraph* intGraph_Higgs_opt1 = makeIntGraph(histograms_Higgs["decayKinePlusMEtVEGAS_meanGt80%*max"]);
  TGraph* intGraph_Z_opt2     = makeIntGraph(histograms_Z["trackPlusDecayKinePlusMEtVEGAS_max"]);
  TGraph* intGraph_Higgs_opt2 = makeIntGraph(histograms_Higgs["decayKinePlusMEtMarkovChain_meanGt80%*max"]);
  std::map<std::string, TGraph*> intGraphs;
  intGraphs["Z_opt1"]     = intGraph_Z_opt1;
  intGraphs["Higgs_opt1"] = intGraph_Higgs_opt1;
  intGraphs["Z_opt2"]     = intGraph_Z_opt2;
  intGraphs["Higgs_opt2"] = intGraph_Higgs_opt2;
  
  std::map<std::string, std::string> intLegendEntries;
  intLegendEntries["Z_opt1"]     = "Z/#gamma^{*} #rightarrow #tau#tau (Kine+MET)";
  intLegendEntries["Higgs_opt1"] = "Higgs #rightarrow #tau#tau (Kine+MET)";
  intLegendEntries["Z_opt2"]     = "Z/#gamma^{*} #rightarrow #tau#tau (Kine+MET+Trk)";
  intLegendEntries["Higgs_opt2"] = "Higgs #rightarrow #tau#tau (Kine+MET+Trk)";
  
  std::vector<std::string> intEntries;
  intEntries.push_back("Z_opt1");
  intEntries.push_back("Higgs_opt1");
  intEntries.push_back("Z_opt2");
  intEntries.push_back("Higgs_opt2");
  
  showGraphs(800, 600, 
	     intEntries,
	     intGraphs,
	     intLegendEntries,
	     colors, lineWidths, lineStyles,
	     0.035, 0.48, 0.725, 0.39, 0.16,
	     0., 250., "X / GeV", 1.2,
	     0., 1., "Int^{M > X}", 1.2,
	     "makeSVfitLikelihoodSeparationPlots_intGraphs.pdf");

  delete inputFile_Z;
  delete inputFile_Higgs;
}