Ejemplo n.º 1
0
void pidHistogramMaker::distributionReport( string pType ){

	uint nBinsPt = ptBins.size() - 1;
	string rName = speciesName( pType, 0 );

	taskProgress tp( pType + " distribution report", nBinsPt );

	book->cd( "tof" );
	for ( uint i = 0; i < nBinsPt; i ++ ){

		tp.showProgress( i );

		// momentum value used for finding nice range
		double p = ptBins[ i ];
		double p2 = ptBins[ i + 1 ];
		double avgP = 0.2;
		avgP = (ptBins[ i ] + ptBins[ i + 1])/2.0;
		

		string name = speciesName( pType, 0, i, 0 );

		book->cd( "dedx_tof" );
		TH2 * pTof = book->get2D( name );
		book->cd( "scratch" );
		TH2 * pDedx = (TH2*)pTof->Clone( "pDedx__" );

		// start a new page on the report file
		pReport[ rName ]->newPage( 2, 2 );


		// get information on plot ranges
		double tofLow, tofHigh, dedxLow, dedxHigh;
		autoViewport( pType, p, &tofLow, &tofHigh, &dedxLow, &dedxHigh, tofPadding, dedxPadding, tofScalePadding, dedxScalePadding );
		
		if ( true ) {	// show the tof proj

			string title = "#beta^{-1} : " + ts(ptBins[ i ], 4) + " < pT < " + ts(ptBins[i+1], 4);
			vector<string> others = otherSpecies( pType );
			vector< double > tofMean = enhanceTof( pType, others, avgP );
			vector< double > dedxMean = enhanceDedx( pType, others, avgP );
			pReport[ rName ]->cd( 1, 1 );
			//hdt->GetXaxis()->SetRangeUser( -.06, .06 );
			// Make the all tof tracks histogram
			string hName = sTofName( pType, 0, i );
			book->cd( "scratch" );
			TH1* hTof = (TH1D*)pTof->ProjectionY( "_py" );
			book->cd( "tof" );
			book->add( hName, (TH1*)hTof->Clone( hName.c_str() )  );
			book->style( hName )->set( "style.tof" )
			 	->set( "title", title )->draw();

			TLine * l1 = new TLine( tofMean[ 0 ], hTof->GetMinimum(), tofMean[ 0 ], hTof->GetMaximum() );
			l1->Draw();
			TLine * l2 = new TLine( tofMean[ 1 ], hTof->GetMinimum(), tofMean[ 1 ], hTof->GetMaximum() );
			l2->Draw();

			pReport[ rName ]->cd( 2, 1 );
			pTof->GetXaxis()->SetRangeUser( -.06, .06 );
			// Make the all tof tracks histogram
			hName = sTofName( pType, 0, i, 0, pType );
			book->cd( "scratch" );
			hTof = (TH1D*)pTof->ProjectionY( "_py" );
			book->cd( "tof" );
			book->add( hName, (TH1*)hTof->Clone( hName.c_str() )  );
			book->style( hName )->set( "style.tof" )
			 	->set( "title", title + " " + pType + " enhanced" )->draw();

			for ( int j = 0; j < dedxMean.size(); j++ ){

				pReport[ rName ]->cd( j+1, 2 );
				pTof->GetXaxis()->SetRangeUser( dedxMean[j]-0.06, dedxMean[j]+0.06 );
				// Make the all tof tracks histogram
				hName = sTofName( pType, 0, i, 0, others[ j ] );
				book->cd( "scratch" );
				hTof = (TH1D*)pTof->ProjectionY( "_py" );
				book->cd( "tof" ); 
				book->add( hName, (TH1*)hTof->Clone( hName.c_str() )  );
				book->style( hName )->set( "style.tof" )
				 	->set( "title", title + " " + others[ j ] + " enhanced" )->draw();
			}

		}

		pReport[ rName ]->savePage();
		pReport[ rName ]->newPage( 2, 2 );


		if ( true ) {	// show the dedx proj

			string title = "dEdx : " + ts(ptBins[ i ], 4) + " < pT < " + ts(ptBins[i+1], 4);
			pTof->GetXaxis()->SetRange( 1, pTof->GetXaxis()->GetNbins() );
			pTof->GetYaxis()->SetRange( 1, pTof->GetYaxis()->GetNbins() );

			vector<string> others = otherSpecies( pType );
			vector< double > tofMean = enhanceTof( pType, others, avgP );
			vector< double > dedxMean = enhanceDedx( pType, others, avgP );
			pReport[ rName ]->cd( 1, 1 );
			
			// Make the all dedx tracks histogram
			string hName = sDedxName( pType, 0, i );
			book->cd( "scratch" );
			TH1* hDedx = (TH1D*)pTof->ProjectionX( "_px" );
			book->cd( "dedx" );
			book->add( hName, (TH1*)hDedx->Clone( hName.c_str() )  );
			book->style( hName )->set( "style.dedx" )
			 	->set( "title", title )->draw();

			TLine * l1 = new TLine( dedxMean[ 0 ], hDedx->GetMinimum(), dedxMean[ 0 ], hDedx->GetMaximum() );
			l1->Draw();
			TLine * l2 = new TLine( dedxMean[ 1 ], hDedx->GetMinimum(), dedxMean[ 1 ], hDedx->GetMaximum() );
			l2->Draw();

			pReport[ rName ]->cd( 2, 1 );
			pTof->GetYaxis()->SetRangeUser( -.012, .012 );
			// Make the all tof tracks histogram
			hName = sDedxName( pType, 0, i, 0, pType );
			book->cd( "scratch" );
			hDedx = (TH1D*)pTof->ProjectionX( "_px" );
			book->cd( "dedx" );
			book->add( hName, (TH1*)hDedx->Clone( hName.c_str() )  );
			book->style( hName )->set( "style.dedx" )
			 	->set( "title", title + " " + pType + " enhanced" )->draw();
			
			for ( int j = 0; j < dedxMean.size(); j++ ){

				pReport[ rName ]->cd( j+1, 2 );
				pTof->GetYaxis()->SetRangeUser( tofMean[j]-0.012, tofMean[j]+0.012 );
				// Make the all tof tracks histogram
				hName = sDedxName( pType, 0, i, 0, others[ j ] );
				book->cd( "scratch" );
				hDedx = (TH1D*)pTof->ProjectionX( "_px" );
				book->cd( "dedx" ); 
				book->add( hName, (TH1*)hDedx->Clone( hName.c_str() )  );
				book->style( hName )->set( "style.dedx" )
				 	->set( "title", title + " " + others[ j ] + " enhanced" )->draw();
			}

		}

		pReport[ rName ]->savePage();
		
	}



}
Ejemplo n.º 2
0
TH1 *
UnfoldMe(Char_t *data, Char_t *mc, Char_t *anatag, Int_t bin, Bool_t useMBcorr = kTRUE, Bool_t usecorrfit = kFALSE, Bool_t ismc = kFALSE, Float_t smooth = 0.001, Int_t iter = 50, Int_t regul = AliUnfolding::kPowerLaw, Float_t weight = 100., Bool_t bayesian = kTRUE, Int_t nloop = 1)
{

  if (ismc)
    TFile *fdt = TFile::Open(data);
  else
    TFile *fdt = TFile::Open(data);
  TFile *fmc = TFile::Open(mc);
  
  TList *ldt = (TList *)fdt->Get(Form("clist_%s", anatag));
  TList *lmc = (TList *)fmc->Get(Form("clist_%s", anatag));
  
  TH2 *hmatdt = (TH2 *)ldt->FindObject(Form("b%d_corrMatrix", bin));
  if (useMBcorr)
    TH2 *hmatmc = (TH2 *)lmc->FindObject("effMatrix");
  else
    TH2 *hmatmc = (TH2 *)lmc->FindObject(Form("b%d_corrMatrix", bin));
 
  TH1 *hdata = hmatdt->ProjectionY("hdata");
  hdata->Sumw2();
  hdata->SetBinContent(1, 0.);
  hdata->SetBinError(1, 0.);
  //  hdata->Scale(1. / hdata->Integral());
  hdata->SetMarkerStyle(25);
  TH1 *htrue = hmatdt->ProjectionX("htrue");
  htrue->Sumw2();
  //  htrue->Scale(1. / htrue->Integral());
  htrue->SetMarkerStyle(7);
  htrue->SetMarkerColor(2);
  htrue->SetBinContent(1, 0.);
  htrue->SetBinError(1, 0.);
  TH2 *hcorr = (TH2 *)hmatmc->Clone("hcorr");
  TH1 *hinit = (TH1 *)hdata->Clone("hinit");
  TH1 *hresu = (TH1 *)hdata->Clone("hresu");
  TH1 *hbias = (TH1 *)hdata->Clone("hbias");
  hresu->SetMarkerStyle(20);
  hresu->SetMarkerColor(4);
  hresu->Reset();

  TH1 *hnum = hcorr->ProjectionY("hnum");
  TH1 *hden = hcorr->ProjectionY("hden");
  TH1 *heff = hcorr->ProjectionY("heff");
  hnum->Reset();
  hnum->Sumw2();
  hden->Reset();
  hden->Sumw2();
  heff->Reset();
  for (Int_t i = 0; i < heff->GetNbinsX(); i++) {
    Float_t int1 = hcorr->Integral(i + 1, i + 1, 0, -1);
    if (int1 <= 0.) continue;
    Float_t int2 = hcorr->Integral(i + 1, i + 1, 2, -1);
    hnum->SetBinContent(i + 1, int2);
    hnum->SetBinError(i + 1, TMath::Sqrt(int2));
    hden->SetBinContent(i + 1, int1);
    hden->SetBinError(i + 1, TMath::Sqrt(int1));
  }
  new TCanvas("cEfficiency");
  heff->Divide(hnum, hden, 1., 1., "B");
  heff->Draw();
#if 0
  for (Int_t ii = 0; ii < heff->GetNbinsX(); ii++) {
    heff->SetBinContent(ii + 1, 1.);
    heff->SetBinError(ii + 1, 0.);
  }
#endif
  
  for (Int_t i = 0; i < hcorr->GetNbinsX(); i++) {
    hcorr->SetBinContent(i + 1, 1, 0.);
    hcorr->SetBinError(i + 1, 1, 0.);
  }
  for (Int_t i = 0; i < hcorr->GetNbinsY(); i++) {
    hcorr->SetBinContent(1, i + 1, 0.);
    hcorr->SetBinError(1, i + 1, 0.);
  }
  TH2 *hcorrfit = ReturnCorrFromFit(hcorr);

  for (Int_t iloop = 0; iloop < nloop; iloop++) {
    if (bayesian) {
      AliUnfolding::SetUnfoldingMethod(AliUnfolding::kBayesian);
      AliUnfolding::SetBayesianParameters(smooth, iter);
    } else {
      AliUnfolding::SetUnfoldingMethod(AliUnfolding::kChi2Minimization);
      AliUnfolding::SetChi2Regularization(regul, weight);
    }
    AliUnfolding::SetSkip0BinInChi2(kTRUE);
    AliUnfolding::SetSkipBinsBegin(1);
    AliUnfolding::SetNbins(150, 150);
    AliUnfolding::Unfold(usecorrfit ? hcorrfit : hcorr, heff, hdata, hinit, hresu);
    hinit = (TH1 *)hresu->Clone(Form("hinit_%d", iloop));
  }

  printf("hdata->Integral(2, -1) = %f\n", hdata->Integral(2, -1));
  printf("hresu->Integral(2, -1) = %f\n", hresu->Integral(2, -1));
  
  
  TCanvas *cUnfolded = new TCanvas ("cUnfolded", "", 400, 800);
  cUnfolded->Divide(1, 2);
  cUnfolded->cd(1)->SetLogx();
  cUnfolded->cd(1)->SetLogy();
  hdata->Draw();
  hresu->Draw("same");
  htrue->Draw("same");
  cUnfolded->cd(2)->SetLogx();
  cUnfolded->cd(2)->DrawFrame(1., 0.75, 300., 1.25);
  TH1 *hrat = (TH1 *)hresu->Clone("hrat");
  hrat->Divide(htrue);
  hrat->Draw("same");

  TH1 *htrig = (TH1 *)hresu->Clone("htrig");
  htrig->Multiply(heff);

  Float_t dndeta_resu = 0.;
  Float_t integr_resu = 0.;
  Float_t dndeta_trig = 0.;
  Float_t integr_trig = 0.;
  for (Int_t i = 1; i < hresu->GetNbinsX(); i++) {
    dndeta_resu += hresu->GetBinContent(i + 1) * hresu->GetBinLowEdge(i + 1);
    integr_resu += hresu->GetBinContent(i + 1);
    dndeta_trig += htrig->GetBinContent(i + 1) * htrig->GetBinLowEdge(i + 1);
    integr_trig += htrig->GetBinContent(i + 1);
  }
  //  dndeta_resu /= integr_resu;
  //  dndeta_trig /= integr_trig;

  integr_eff = integr_trig / integr_resu;
  integr_eff_err = TMath::Sqrt(integr_eff * (1. - integr_eff) / integr_resu);
  dndeta_eff = dndeta_trig / dndeta_resu;
  dndeta_eff_err = TMath::Sqrt(dndeta_eff * (1. - dndeta_eff) / dndeta_resu);
  
  printf("INEL > 0 efficiency: %.3f +- %.3f\n", integr_eff, integr_eff_err);
  printf("dN/dEta correction:  %.3f +- %.3f\n", dndeta_eff, dndeta_eff_err);

  return hresu;
}
Ejemplo n.º 3
0
TH1 *
UnfoldMe_MB2(const Char_t *data, const Char_t *mc, const Char_t *anatag, Int_t bin, Bool_t useMBcorr , Bool_t usecorrfit , Bool_t ismc , Float_t smooth , Int_t iter , Int_t regul , Float_t weight , Bool_t bayesian , Int_t nloop )
{

  // MF comments:
  // usedMBcorr: changes the matrix used for unfonding, from effMatrix to bin matrix (I think this is just to use mult dependent v s mb correction_)
  // usecorrfit: if I understand correctly, fits the response matrix and uses fit to extrapolate it

  
  TFile *fdt =0;
  if (ismc)
    fdt =  TFile::Open(data);
  else
    fdt = TFile::Open(data);
  TFile *fmc = TFile::Open(mc);

  TList *ldt = (TList *)fdt->Get(Form("%s", anatag));
  TList *lmc = (TList *)fmc->Get(Form("%s", anatag));
  
  TH2 *hmatdt = (TH2 *)ldt->FindObject(Form(responseMatrix, bin));
  TH2 *hmatmc = 0;
  if (useMBcorr){
     hmatmc = (TH2 *)lmc->FindObject("effMatrix");
     std::cout << "USING MB" << std::endl;
     
  }
  else {
    hmatmc = (TH2 *)lmc->FindObject(Form(responseMatrix, bin));
  }

  TH1 *hdata = hmatdt->ProjectionY("hdata");
//  TH1 *hdata = hmatdt->ProjectionY("htrue");  // For truth Only Calculations

  hdata->Sumw2();
  hdata->SetBinContent(1, 0.);
  hdata->SetBinError(1, 0.);
  //  hdata->Scale(1. / hdata->Integral());
  hdata->SetMarkerStyle(25);
  TH1 *htrue = hmatdt->ProjectionX("htrue");
  htrue->Sumw2();
  //  htrue->Scale(1. / htrue->Integral());
  htrue->SetMarkerStyle(7);
  htrue->SetMarkerColor(2);
  htrue->SetBinContent(1, 0.);
  htrue->SetBinError(1, 0.);

  TH2 *hcorr = (TH2 *)hmatmc->Clone("hcorr");
  TH1 *hinit = (TH1 *)hdata->Clone("hinit");
  TH1 *hresu = (TH1 *)hdata->Clone("hresu");
  TH1 *hbias = (TH1 *)hdata->Clone("hbias");
  hresu->SetMarkerStyle(20);
  hresu->SetMarkerColor(4);
  hresu->Reset();

  TH1 *hnum = hcorr->ProjectionY("hnum");
  TH1 *hden = hcorr->ProjectionY("hden");
  TH1 *heff = hcorr->ProjectionY("heff");
  hnum->Reset();
  hnum->Sumw2();
  hden->Reset();
  hden->Sumw2();
  heff->Reset();
  for (Int_t i = 0; i < heff->GetNbinsX(); i++) {
    Float_t int1 = hcorr->Integral(i + 1, i + 1, 0, -1);
    if (int1 <= 0.) continue;
    Float_t int2 = hcorr->Integral(i + 1, i + 1, 2, -1);
    hnum->SetBinContent(i + 1, int2);
    hnum->SetBinError(i + 1, TMath::Sqrt(int2));
    hden->SetBinContent(i + 1, int1);
    hden->SetBinError(i + 1, TMath::Sqrt(int1));
  }
  TCanvas *cEfficiency = new TCanvas("cEfficiency", "cEfficiency");
  cEfficiency->SetLogx();
  cEfficiency->SetLogy();

  heff->Divide(hnum, hden, 1., 1., "B");
  heff->Draw();
#if 0
  for (Int_t ii = 0; ii < heff->GetNbinsX(); ii++) {
    heff->SetBinContent(ii + 1, 1.);
    heff->SetBinError(ii + 1, 0.);
  }
#endif

  for (Int_t i = 0; i < hcorr->GetNbinsX(); i++) {
    hcorr->SetBinContent(i + 1, 1, 0.);
    hcorr->SetBinError(i + 1, 1, 0.);
  }
  for (Int_t i = 0; i < hcorr->GetNbinsY(); i++) {
    hcorr->SetBinContent(1, i + 1, 0.);
    hcorr->SetBinError(1, i + 1, 0.);
  }
  TH2 *hcorrfit = ReturnCorrFromFit(hcorr);
  // Docs from AliUnfolding
  //Int_t AliUnfolding::Unfold(TH2* correlation, TH1* efficiency, TH1* measured, TH1* initialConditions, TH1* result, Bool_t check)
  // unfolds with unfolding method fgMethodType
  //
  // parameters:
  //  correlation: response matrix as measured vs. generated
  //  efficiency:  (optional) efficiency that is applied on the unfolded spectrum, i.e. it has to be in unfolded variables. If 0 no efficiency is applied.
  //  measured:    the measured spectrum
  //  initialConditions: (optional) initial conditions for the unfolding. if 0 the measured spectrum is used as initial conditions.
  //  result:      target for the unfolded result
  //  check:       depends on the unfolding method, see comments in specific functions

  for (Int_t iloop = 0; iloop < nloop; iloop++) {
    if (bayesian) {
      AliUnfolding::SetUnfoldingMethod(AliUnfolding::kBayesian);
      AliUnfolding::SetBayesianParameters(smooth, iter);
    } else {
      AliUnfolding::SetUnfoldingMethod(AliUnfolding::kChi2Minimization);
      AliUnfolding::SetChi2Regularization(AliUnfolding::RegularizationType(regul), weight);
    }
    AliUnfolding::SetSkip0BinInChi2(kTRUE);
    AliUnfolding::SetSkipBinsBegin(1);
    AliUnfolding::SetNbins(150, 150);
    AliUnfolding::Unfold(usecorrfit ? hcorrfit : hcorr, heff, hdata, hinit, hresu);
    hinit = (TH1 *)hresu->Clone(Form("hinit_%d", iloop));
  }

  printf("hdata->Integral(2, -1) = %f\n", hdata->Integral(2, -1));
  printf("hresu->Integral(2, -1) = %f\n", hresu->Integral(2, -1));


  TCanvas *cUnfolded = new TCanvas ("cUnfolded", "cUnfolded", 400, 800);
  cUnfolded->Divide(1, 2);
  cUnfolded->cd(1)->SetLogx();
  cUnfolded->cd(1)->SetLogy();
  hdata->Draw();
  hresu->Draw("same");
  htrue->Draw("same");
  cUnfolded->cd(2)->SetLogx();
  cUnfolded->cd(2)->DrawFrame(1., 0, 300., 10);
  TH1 *hrat = (TH1 *)hresu->Clone("hrat");
  hrat->Divide(htrue);
  hrat->Draw("same");

  TH1 *htrig = (TH1 *)hresu->Clone("htrig");
  htrig->Multiply(heff); 
  

  Float_t dndeta_resu = 0.;
  Float_t integr_resu = 0.;
  Float_t dndeta_trig = 0.;
  Float_t integr_trig = 0.;
  for (Int_t i = 1; i < hresu->GetNbinsX(); i++) {
    dndeta_resu += hresu->GetBinContent(i + 1) * hresu->GetBinLowEdge(i + 1);
    integr_resu += hresu->GetBinContent(i + 1);
    dndeta_trig += htrig->GetBinContent(i + 1) * htrig->GetBinLowEdge(i + 1);
    integr_trig += htrig->GetBinContent(i + 1);
  }

  cUnfolded->SaveAs("unfold_efficiency.pdf");

  integr_eff = integr_trig / integr_resu;
  integr_eff_err = TMath::Sqrt(integr_eff * (1. - integr_eff) / integr_resu);
  dndeta_eff = dndeta_trig / dndeta_resu;
  dndeta_eff_err = TMath::Sqrt(dndeta_eff * (1. - dndeta_eff) / dndeta_resu);

  printf("INEL > 0 efficiency: %.3f +- %.3f\n", integr_eff, integr_eff_err);
  printf("dN/dEta correction:  %.3f +- %.3f\n", dndeta_eff, dndeta_eff_err);

  return hresu;
}
Ejemplo n.º 4
0
void smooth(std::string model){

  TFile *f_xsec = new TFile("xsec_susy_13tev.root", "READ");
  TH1F *h_xsec = (TH1F*)f_xsec->Get("h_xsec_c1n2");//FIXME for Gluino models
  //TH1F *h_xsec = (TH1F*)f_xsec->Get("h_xsec_stop");// for stop/sbottom models

  TFile *f = new TFile(Form("r-values_%s.root", model.c_str()), "UPDATE");
  f->cd();

  TH2 *hExp   = (TH2*)f->Get("hExp");
  TH2 *hObs   = (TH2*)f->Get("hObs");
  TH2 *hExp1m = (TH2*)f->Get("hExp1m");
  TH2 *hExp2m = (TH2*)f->Get("hExp2m");
  TH2 *hExp1p = (TH2*)f->Get("hExp1p");
  TH2 *hExp2p = (TH2*)f->Get("hExp2p");

  if(!hExp) std::cout << "hist not found" << std::endl;

  TH2* hXsec_obs = (TH2*)hObs->Clone("hXsec_obs"); 
  TH1D* proj_x = hXsec_obs->ProjectionX();

  for(int i=1; i<=hXsec_obs->GetNbinsX(); i++){
    for(int j=1; j<=hXsec_obs->GetNbinsY(); j++){
      float xsec_limit = hXsec_obs->GetBinContent(i,j);
      if(xsec_limit == 0){
        continue;
      }
      xsec_limit *= GetValue(proj_x->GetBinCenter(i), *h_xsec);
      hXsec_obs->SetBinContent(i,j,xsec_limit);
    }
  } 


  TH2* hObs1m = (TH2*)hObs->Clone("hObs1m"); 
  TH1D* proj_x_1m = hObs1m->ProjectionX();

  for(int i=1; i<=hObs1m->GetNbinsX(); i++){
    for(int j=1; j<=hObs1m->GetNbinsY(); j++){
      float xsec_limit = hObs1m->GetBinContent(i,j);
      if(xsec_limit == 0){
        continue;
      }
      xsec_limit *= (GetValueMinus(proj_x_1m->GetBinCenter(i), *h_xsec)/GetValue(proj_x_1m->GetBinCenter(i), *h_xsec));
      hObs1m->SetBinContent(i,j,xsec_limit);
    }
  } 

  TH2* hObs1p = (TH2*)hObs->Clone("hObs1p"); 
  TH1D* proj_x_1p = hObs1p->ProjectionX();

  for(int i=1; i<=hObs1p->GetNbinsX(); i++){
    for(int j=1; j<=hObs1p->GetNbinsY(); j++){
      float xsec_limit = hObs1p->GetBinContent(i,j);
      if(xsec_limit == 0){
        continue;
      }
      xsec_limit *= (GetValuePlus(proj_x_1p->GetBinCenter(i), *h_xsec)/GetValue(proj_x_1p->GetBinCenter(i), *h_xsec));
      hObs1p->SetBinContent(i,j,xsec_limit);
    }
  } 


  TGraph2D *hExp_graph   = new TGraph2D(hExp);
  TGraph2D *hObs_graph   = new TGraph2D(hObs);
  TGraph2D *hObs1m_graph   = new TGraph2D(hObs1m);
  TGraph2D *hObs1p_graph   = new TGraph2D(hObs1p);
  TGraph2D *hExp1m_graph = new TGraph2D(hExp1m);
  TGraph2D *hExp2m_graph = new TGraph2D(hExp2m);
  TGraph2D *hExp1p_graph = new TGraph2D(hExp1p);
  TGraph2D *hExp2p_graph = new TGraph2D(hExp2p);
  TGraph2D *hXsec_obs_graph = new TGraph2D(hXsec_obs);

  //hExp_graph->SetNpx(2*hExp_graph->GetNpx());
  //hObs_graph->SetNpx(2*hObs_graph->GetNpx());
  //hObs1m_graph->SetNpx(2*hObs1m_graph->GetNpx());
  //hObs1p_graph->SetNpx(2*hObs1p_graph->GetNpx());
  //hExp1m_graph->SetNpx(2*hExp1m_graph->GetNpx());
  //hExp2m_graph->SetNpx(2*hExp2m_graph->GetNpx());
  //hExp1p_graph->SetNpx(2*hExp1p_graph->GetNpx());
  //hExp2p_graph->SetNpx(2*hExp2p_graph->GetNpx());
  //hXsec_obs_graph->SetNpx(2*hXsec_obs_graph->GetNpx());

  //hExp_graph->SetNpy(2*hExp_graph->GetNpy());
  //hObs_graph->SetNpy(2*hObs_graph->GetNpy());
  //hObs1m_graph->SetNpy(2*hObs1m_graph->GetNpy());
  //hObs1p_graph->SetNpy(2*hObs1p_graph->GetNpy());
  //hExp1m_graph->SetNpy(2*hExp1m_graph->GetNpy());
  //hExp2m_graph->SetNpy(2*hExp2m_graph->GetNpy());
  //hExp1p_graph->SetNpy(2*hExp1p_graph->GetNpy());
  //hExp2p_graph->SetNpy(2*hExp2p_graph->GetNpy());
  //hXsec_obs_graph->SetNpy(2*hXsec_obs_graph->GetNpy());

  TH2D *hExp_smooth   = hExp_graph->GetHistogram();
  TH2D *hObs_smooth   = hObs_graph->GetHistogram();
  TH2D *hObs1m_smooth   = hObs1m_graph->GetHistogram();
  TH2D *hObs1p_smooth   = hObs1p_graph->GetHistogram();
  TH2D *hExp1m_smooth = hExp1m_graph->GetHistogram();
  TH2D *hExp2m_smooth = hExp2m_graph->GetHistogram();
  TH2D *hExp1p_smooth = hExp1p_graph->GetHistogram();
  TH2D *hExp2p_smooth = hExp2p_graph->GetHistogram();
  TH2D *hXsec_obs_smooth = hXsec_obs_graph->GetHistogram();

  hExp_smooth->Write("hExp_smooth",TObject::kOverwrite);
  hObs_smooth->Write("hObs_smooth",TObject::kOverwrite);
  hObs1m_smooth->Write("hObs1m_smooth",TObject::kOverwrite);
  hObs1p_smooth->Write("hObs1p_smooth",TObject::kOverwrite);
  hExp1m_smooth->Write("hExp1m_smooth",TObject::kOverwrite);
  hExp2m_smooth->Write("hExp2m_smooth",TObject::kOverwrite);
  hExp1p_smooth->Write("hExp1p_smooth",TObject::kOverwrite);
  hExp2p_smooth->Write("hExp2p_smooth",TObject::kOverwrite);
  hXsec_obs_smooth->Write("hXsec_obs_smooth",TObject::kOverwrite);
  f->Close();
  delete f;

  f_xsec->Close();
  delete f_xsec;

}