Exemplo n.º 1
0
void AgglWindow::on_agl_pushButton_create_clicked()
{
    errorwin = new ErrorWindow(this);

    QString output = ui->agl_lineEdit_output->text();
    int file_num = ui->agl_comboBox->currentIndex();
    int aggl_num = ui->agl_listWidget->currentRow();

    if (output == "")
    {
        errorwin->set_message(4);
        errorwin->show();
        return;
    }

    output = QFileInfo(output).absoluteFilePath();
    QFile f_out(output);
    if (!f_out.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        errorwin->set_message(9);
        errorwin->show();
        return;
    }
    QTextStream out(&f_out);
    out << "AGL=" << aggl[file_num].split(QString(";"))[aggl_num] << "\n";
    out << aggl_mol[file_num].split(QString(";"))[aggl_num];
    f_out.close();

    ui->agl_lineEdit_output->clear();

    delete errorwin;
}
Exemplo n.º 2
0
// This function writes the solution to solution.txt that can be visualized by gnuplot
void GridUtil::writeInitSol() const
{
        std::ofstream f_out("init.dat");
        real x, y, comp, startX, startY;
        size_t midValue = (numGrid_-1)*0.5;
        startX= -1.;
        startY = -1.;
        
        for(size_t i=0; i<numGrid_ ; ++i)
        {
                for(size_t j=0; j<numGrid_ ;++j)
                {
                        x = startX + j*h_ ;
                        y = startY + i*h_;
                        comp = u_.data_[i*numGrid_+j];
                        f_out << x << "\t" << y << "\t" << comp << std::endl;
                        
                }        
        }
             
        f_out.close();
        
        std::cout << "\nThe init solution has been written in the init.dat\n";
        //std::cout << "The Actual, computed solution and error solution has been written in actualSolution.txt, computedSolution.txt and errSolution.txt resp\n";        
}
Exemplo n.º 3
0
uaecptr consolehook_beginio (uaecptr request)
{
	uae_u32 io_data = get_long (request + 40); // 0x28
	uae_u32 io_length = get_long (request + 36); // 0x24
	uae_u32 io_actual = get_long (request + 32); // 0x20
	uae_u32 io_offset = get_long (request + 44); // 0x2c
	uae_u16 cmd = get_word (request + 28);

	if (cmd == CMD_WRITE) {
		TCHAR *buf;
		const char *src = (char*)get_real_address (io_data);
		int len = io_length;
		if (io_length == -1)
			len = strlen (src);
		buf = xmalloc (TCHAR, len + 1);
		au_copy (buf, len, src);
		buf[len] = 0;
		f_out (L"%s", buf);
		xfree (buf);
	} else if (cmd == CMD_READ) {

		write_log (L"%08x: CMD=%d LEN=%d OFF=%d ACT=%d\n", request, cmd, io_length, io_offset, io_actual);
	}
	return beginio;
}
Exemplo n.º 4
0
Deflate::Deflate(const char * out, const char * in)
{
    std::ofstream f_out(out, std::ios::binary | std::ios::app | std::ios::out); //file to write
    std::ifstream f_in;
    std::string input = "", result = "", line;

    f_in.open(in);

    if (f_in.is_open())	{

        while (std::getline(f_in, line))
            input.append(line);

        f_in.close();

    }

    else std::cout << "Unable to open file";


    auto tmp = LZ77::getInstance(input).getResult(input);
    auto vec_bit = HuffmanCode::getInstance(tmp).CompressHuff();

    for (auto it : vec_bit)
        binaryWrite(f_out, it);


}
Exemplo n.º 5
0
    void StringFunction::evalFunctions(MDArray& inp, double time_value_optional)
    {
      EXCEPTWATCH;
      std::map<Function *, std::vector<double> >::iterator it = m_func_to_value.begin();
      const std::map<Function *, std::vector<double> >::iterator it_end = m_func_to_value.end();

      //Evaluate the function and store the answer in its bound location
      for(; it != it_end; ++it)
        {
          Function& func = *it->first;

          PRINTQ(func.getName());

          // check to avoid infinite recursion
          if (&func == this)
            {
              std::ostringstream msg;
              msg << "StringFunction::evalFunctions: infinite recursion by self-referential string function, name= " << m_name;
              VERIFY_1(msg.str());
            }

          VERIFY_OP(func.getNewDomain().rank(), ==, 1, "StringFunction::evalFunctions: functions must be defined with domain/codomain of rank 1 for now");
          VERIFY_OP(func.getNewCodomain().rank(), ==, 1, "StringFunction::evalFunctions: functions must be defined with domain/codomain of rank 1 for now");
          int numCells = 1;

          MDArray f_inp = MDArray(numCells, func.getNewDomain().dimension(0));
          MDArray f_out = MDArray(numCells, func.getNewCodomain().dimension(0));

          int nInDim = last_dimension(f_inp);
          // FIXME - do we really need the extra array?
          for (int iDim = 0; iDim < nInDim; iDim++)
            {
              f_inp(0, iDim) = inp( iDim);
            }

          if (m_have_element)
            {
              func(f_inp, f_out, *m_element, m_parametric_coordinates, time_value_optional); 
            }
          else
            {
              func(f_inp, f_out); 
            }

          int nOutDim = last_dimension(f_out);

          for (int iDim = 0; iDim < nOutDim; iDim++)
            {
              (it->second)[iDim] = f_out(0, iDim);
            }

        }
    }
int main(int argc,char* argv[])
{
	vector<Diary> my_diary;
	string str;
	Diary diary;
	Diary *p;
	string date;
	ifstream f_in(fpath);
	while (!f_in.eof())
	{
		getline(f_in,date);
		diary.SetDate(date);
		diary.Reset();
		string str;
		getline(f_in,str);
		while (str!=".")
		{
			diary.AddLine(str);
			getline(f_in,str);
		}
		my_diary.push_back(diary);
	}
	f_in.close();

	date=argv[1];
	vector<Diary>::size_type i,ii,Size;
	Size=my_diary.size();
	for (i=0;i<Size;i++)
		if (my_diary[i].GetDate()==date) break;
	if (i==Size)
		cout<<"There is not such a diary which date is "<<date<<"."<<endl;
	else
	{	for (ii=i;ii<Size-1;ii++)
			my_diary[ii] = my_diary[ii+1];
		my_diary.pop_back();
	

		ofstream f_out(fpath);
		for (i=0;i<my_diary.size();i++)
		{
			f_out<<my_diary[i].GetDate()<<endl;
			vector<string>::size_type j;
			for (j=0;j<my_diary[i].Size();j++)
				f_out<<my_diary[i].GetText(j)<<endl;
			f_out<<"."<<endl;
		}

		f_out.close();
		return 1;
	}
	return 0;
}
Exemplo n.º 7
0
void main( int argc, char *argv[] )
  {
   if (argc!=4)
     {
      cout<<" argc "<<argc<<" \nUsage \n"<<argv[0]
          <<" File_X_col File_To_Build_Spline File_To_Write\n"
          <<" File_To_Build_Spline: NumX_Grid 50 Misfit 0.1+ data\n";
      exit(1);
     };     
   char tmp[256];
   double Misf,Mis;
   int NumX;
   fstream f_out(argv[3],ios::out);
   TData<real> *in=NULL,*in1=NULL,*out=NULL;
cout<<" coreleft "<<coreleft()<<"\n";
   InputTDataF(argv[1],in);
cout<<" NC "<<in->N<<" NR "<<in->I[0]<<"\n";
   InputTDataF(argv[2],in1);
cout<<" NC "<<in1->N<<" NR "<<in1->I[0]<<"\n";
   fstream f_in(argv[2],ios::in);f_in>>tmp>>NumX>>tmp>>Misf;f_in.close();
   DataRegister("TDataF",out);
   int NC=in1->N,NR=in->I[0];
   int *I=new int[in1->N];for (int k=0;k<NC;k++) I[k]=NR;
   out->SetDim(NC,I);movmem(in->D[0],out->D[0],sizeof(out->D[0][0])*NR);
cout<<" NC "<<NC<<" NR "<<NR<<"\n";
   CurveSpline *S=new CurveSpline[NC-1];
   int n=NumX;
   Mis=Misf;
//   TData<double> **S=new TData<double>*[NC-1];
   for (k=1;k<NC;k++) {S[k-1].Generate(NumX,Misf,0,*in1,0,k);NumX=n;Misf=Mis;}
cout<<" Constructed\n";
cout<<" coreleft "<<coreleft()<<"\n";

// for (k=1;k<NR;k++) {cout<<out->D[0][k]<<"\n";}
   for (k=1;k<NC;k++) {S[k-1].Evaluate(*out,0,k);}
   OutputTDataF(f_out,*out);
   delete in;delete in1;delete out;delete I;
//   for (k=0;k<NC-1;k++) delete S[k];
   delete S;
   f_out.close();
cout<<" coreleft "<<coreleft()<<"\n";
  }; 
Exemplo n.º 8
0
// This function writes the solution to solution.txt that can be visualized by gnuplot
void GridUtil::writeFinalSol(const TwoDimArr& arr) const
{
        std::ofstream f_out("solution.dat");
        //std::ofstream f_act("actualSolution.txt");
        //std::ofstream f_err("errSolution.txt");
        real x, y, comp, startX, startY; // act, phi, r,
        size_t midValue = (numGrid_-1)*0.5;
        startX= -1.;
        startY = -1.;
        
        for(size_t i=0; i<numGrid_ ; ++i)
        {
                for(size_t j=0; j<numGrid_ ;++j)
                {
                        x = startX + j*h_ ;
                        y = startY + i*h_;
                        comp = arr.data_[i*numGrid_+j];
                        //act = sin(M_PI*x)*sinh(M_PI*y);
                        /*r = calR(x,y);
                        phi = cal_phi(x,y);
                        
                        if (j<midValue)
                                phi+=M_PI;
                        
                        if(i<midValue && j>=midValue)
                                phi+= 2*M_PI;                  
                        
                        act = g(r, phi);*/
                        
                        f_out << x << "\t" << y << "\t" << comp << std::endl;
                        //f_act << x << "\t" << y << "\t" << act << std::endl;
                        //f_err << x << "\t" << y << "\t" << fabs(act-comp) << std::endl;
                }        
        }
             
        f_out.close();
        //f_act.close();
        //f_err.close();
        
        std::cout << "\nThe computed solution has been written in the solution.dat\n";
        //std::cout << "The Actual, computed solution and error solution has been written in actualSolution.txt, computedSolution.txt and errSolution.txt resp\n";        
}
Exemplo n.º 9
0
static int run_single_test(const char *test,
                           const uint8_t *block1, ptrdiff_t stride1,
                           const uint8_t *block2, ptrdiff_t stride2,
                           int align, int n)
{
    int out, ref;
    av_pixelutils_sad_fn f_ref = sad_c[n - 1];
    av_pixelutils_sad_fn f_out = av_pixelutils_get_sad_fn(n, n, align, NULL);

    switch (align) {
    case 0: block1++; block2++; break;
    case 1:           block2++; break;
    case 2:                     break;
    }

    out = f_out(block1, stride1, block2, stride2);
    ref = f_ref(block1, stride1, block2, stride2);
    printf("[%s] [%c%c] SAD [%s] %dx%d=%d ref=%d\n",
           out == ref ? "OK" : "FAIL",
           align ? 'A' : 'U', align == 2 ? 'A' : 'U',
           test, 1<<n, 1<<n, out, ref);
    return out != ref;
}
Exemplo n.º 10
0
std::ofstream MyFile::save(const std::string filename)
{
	std::ofstream f_out(filename);
	return f_out;
}
Exemplo n.º 11
0
void njet_mWW_Scale()
{
  //TString OutDir = "mWW_sf_reweighted";
  TString OutDir = "mWW_sf_unweighted";
  gSystem->mkdir(OutDir);
  
  TFile *fname_phantom;
  TFile *fname_powheg;

  fname_phantom  = new TFile("phantom/phantom_CommonCut_VBFnjet.root");
  fname_powheg   = new TFile("POWHEG_VBF_unweighted/POWHEG_VBF_CommonCut_VBFnjet.root");
  //fname_powheg   = new TFile("POWHEG_VBF_reweighted/POWHEG_VBF_CommonCut_VBFnjet.root");

  //Histograms
  TH1D* h1_njet_phantom[12];
  TH1D* h1_njet_powheg[12];
  TH1D* h1_njet_noW_phantom[12];
  TH1D* h1_njet_noW_powheg[12];
  TH1D* h1_reWeightFac[12];
  TH1D* h1_powheg_phantom[4];

  //Inclusive jet bin mWW histograms
  TH1D* h1_mWW_phantom;
  TH1D* h1_mWW_powheg;
  TH1D* h1_mWW_noW_phantom;
  TH1D* h1_mWW_noW_powheg;
  
  //Inclusive Total number
  double nTotalPha;
  double nTotalPow;
  
  double ymax;
  double err_phantom;
  double err_powheg;

  char tmpName[50];
  char histName[50];
  char mWWrange[50];

  double Bins[12] = {130.,200.,300.,400.,500.,600.,700.,800.,900.,1000.,1250.,1500.};
  TH1D *h1_tmp = new TH1D("h1_tmp","",11,Bins); h1_tmp->Sumw2();

  TCanvas *myCan = MakeCanvas("myCan", "myCan", 900, 800);

  //Read Histograms from root file
  for(int i(0);i<12;i++)
  {
    sprintf(tmpName,"h1_njet_OffSh_%d",i);

    sprintf(histName,"h1_njet_phantom_%d",i);
    h1_njet_phantom[i] = (TH1D*)fname_phantom->Get(tmpName)->Clone(histName); h1_njet_phantom[i]->Sumw2();
    
    sprintf(histName,"h1_njet_powheg_%d",i);
    h1_njet_powheg[i] = (TH1D*)fname_powheg->Get(tmpName)->Clone(histName); h1_njet_powheg[i]->Sumw2();
    
    sprintf(tmpName,"h1_njet_OffSh_noWeight_%d",i);

    sprintf(histName,"h1_njet_noW_phantom_%d",i);
    h1_njet_noW_phantom[i] = (TH1D*)fname_phantom->Get(tmpName)->Clone(histName); h1_njet_noW_phantom[i]->Sumw2();
    
    sprintf(histName,"h1_njet_noW_powheg_%d",i);
    h1_njet_noW_powheg[i] = (TH1D*)fname_powheg->Get(tmpName)->Clone(histName); h1_njet_noW_powheg[i]->Sumw2();

    for (int j(1);j<=h1_njet_phantom[i]->GetNbinsX();j++)
    {
      err_phantom = 0.;
      err_powheg  = 0.;
      if(h1_njet_noW_phantom[i]->GetBinContent(j)>0.)
        err_phantom = h1_njet_phantom[i]->GetBinContent(j) * sqrt(h1_njet_noW_phantom[i]->GetBinContent(j))/h1_njet_noW_phantom[i]->GetBinContent(j);
      if(h1_njet_noW_powheg[i]->GetBinContent(j)>0.)
        err_powheg = h1_njet_powheg[i]->GetBinContent(j) * sqrt(h1_njet_noW_powheg[i]->GetBinContent(j))/h1_njet_noW_powheg[i]->GetBinContent(j);
      h1_njet_phantom[i] -> SetBinError(j,err_phantom);
      h1_njet_powheg[i]  -> SetBinError(j,err_powheg);
    }
  }

  //Read inclusive jet bin mWW histograms
  h1_mWW_phantom = (TH1D*)fname_phantom->Get("h1_mww_off_CalcPowRew_4")->Clone("h1_mWW_phantom"); //h1_mWW_phantom->Sumw2();
  h1_mWW_powheg  = (TH1D*)fname_powheg ->Get("h1_mww_off_CalcPowRew_4")->Clone("h1_mWW_powheg"); //h1_mWW_powheg->Sumw2();
  h1_mWW_noW_phantom = (TH1D*)fname_phantom->Get("h1_mww_off_CalcPowRew_noWeight_4")->Clone("h1_mWW_noW_phantom"); //h1_mWW_noW_phantom->Sumw2();
  h1_mWW_noW_powheg  = (TH1D*)fname_powheg ->Get("h1_mww_off_CalcPowRew_noWeight_4")->Clone("h1_mWW_noW_powheg"); //h1_mWW_noW_powheg->Sumw2();
  
  for (int j(1);j<=h1_mWW_phantom->GetNbinsX();j++)
  {
    err_phantom = 0.;
    err_powheg  = 0.;
    if(h1_mWW_noW_phantom->GetBinContent(j)>0.)
      err_phantom = h1_mWW_phantom->GetBinContent(j) * sqrt(h1_mWW_noW_phantom->GetBinContent(j))/h1_mWW_noW_phantom->GetBinContent(j);
    if(h1_mWW_noW_powheg->GetBinContent(j)>0.)
      err_powheg = h1_mWW_powheg->GetBinContent(j) * sqrt(h1_mWW_noW_powheg->GetBinContent(j))/h1_mWW_noW_powheg->GetBinContent(j);
    h1_mWW_phantom -> SetBinError(j,err_phantom);
    h1_mWW_powheg  -> SetBinError(j,err_powheg);
  }
  
  //Inclusive Total number
  nTotalPha = h1_mWW_phantom -> Integral();
  nTotalPow = h1_mWW_powheg  -> Integral();

  //Inclusive Total number
  for(int i(0);i<12;i++)
  {
    h1_njet_phantom[i] -> Scale(1./nTotalPha);
    h1_njet_powheg[i]  -> Scale(1./nTotalPow);
    
    //Scale factors calculation for each jet bin
    sprintf(histName,"h1_reWeightFac_%d",i);
    h1_reWeightFac[i] = (TH1D*)h1_njet_powheg[i] -> Clone(histName); h1_reWeightFac[i]->Sumw2();
    h1_reWeightFac[i] -> Divide(h1_njet_phantom[i]);
    
    //Printout powheg/phantom scale factor for each mWW windows
    if(i==11)
      sprintf(mWWrange,"mWW > 130");
    else
      sprintf(mWWrange,"%.1f < mWW #leq %.1f",Bins[i],Bins[i+1]);
    for (int j(1);j<=h1_reWeightFac[i]->GetNbinsX();j++)
    {
      cout<<mWWrange<<"-bin, "<<j-1<<"=njet: "<<h1_reWeightFac[i]->GetBinContent(j)<<" +/- "<<h1_reWeightFac[i]->GetBinError(j)<<endl;
    }
    
    ymax = 1.15*(h1_njet_phantom[i]->GetMaximum()); 
    if(i==0 || i==11)
      ymax = 1.15*(h1_njet_powheg[i]->GetMaximum()); 
    
    //Save Histograms to file
    sprintf(histName,"Bin_%d",i);
    if(i==11)
      sprintf(histName,"incl_Bin");
    CPlot* plotNjet=new CPlot(histName,"","number of jets","");
    plotNjet->setOutDir(OutDir);
    if(i==11)
    {
      plotNjet->AddHist1D(h1_njet_powheg[i],"E1",kRed);
      plotNjet->AddHist1D(h1_njet_phantom[i],"E1",kBlue);
    }else{
      plotNjet->AddHist1D(h1_njet_powheg[i],"HIST",kRed);
      plotNjet->AddHist1D(h1_njet_phantom[i],"HIST",kBlue);
    }
    plotNjet->SetLegend(0.63,0.84,0.88,0.92);
    plotNjet->GetLegend()->AddEntry(h1_njet_powheg[i],"POWHEG","l");
    plotNjet->GetLegend()->AddEntry(h1_njet_phantom[i],"Phantom Sig.","l");
    plotNjet->AddTextBox(mWWrange,0.6,0.92,0.92,0.95,0);
    plotNjet->SetYRange(-0.001,ymax);
    plotNjet->Draw(myCan,kTRUE,"png");

    h1_njet_powheg[i]->Divide(h1_njet_phantom[i]);
    
    sprintf(histName,"Bin_%d_Ratio",i);
    if(i==11)
    {
      sprintf(histName,"incl_Bin_Ratio");
      cout<<h1_njet_powheg[i]->GetBinContent(3)<<"\t"<<h1_njet_powheg[i]->GetBinContent(4)<<endl;
    }
    CPlot* plotRatio=new CPlot(histName,"","number of jets","POWHEG/Phantom");
    plotRatio->setOutDir(OutDir);
    plotRatio->AddHist1D(h1_njet_powheg[i],"HIST",kRed);
    plotRatio->SetLegend(0.63,0.84,0.88,0.92);
    //plotRatio->GetLegend()->AddEntry(h1_njet_powheg[i],"POWHEG","l");
    plotRatio->AddTextBox(mWWrange,0.6,0.92,0.92,0.95,0);
    plotRatio->SetYRange(-0.001,1.15*(h1_njet_powheg[i]->GetMaximum()));
    plotRatio->Draw(myCan,kTRUE,"png");
  }

  //Write Scale Factors to root file
  TFile f_out(OutDir+"/scaleFactors.root","recreate");
  h1_mWW_phantom -> Scale(1./nTotalPha);
  h1_mWW_powheg  -> Scale(1./nTotalPow);
  h1_mWW_powheg  -> Divide(h1_mWW_phantom);
  for (int i(0);i<5;i++)
  {
    if(i==4)
    {
      h1_powheg_phantom[i] = (TH1D*)h1_mWW_powheg -> Clone("h1_powheg_phantom_4"); h1_powheg_phantom[i]->Sumw2();
    }else{
      sprintf(histName,"h1_powheg_phantom_%d",i);
      h1_powheg_phantom[i] = (TH1D*)h1_tmp -> Clone(histName); h1_powheg_phantom[i]->Sumw2();
      for (int j(1);j<=h1_powheg_phantom[i]->GetNbinsX();j++)
      {
	h1_powheg_phantom[i] -> SetBinContent(j,h1_reWeightFac[j-1]->GetBinContent(i+1));
	h1_powheg_phantom[i] -> SetBinError(j,h1_reWeightFac[j-1]->GetBinError(i+1));
      }
    }
    h1_powheg_phantom[i] -> Write();
  }
}
Exemplo n.º 12
0
int resbosComp(const TString BaseName)
{
  TString tmpTStr;
  CPlot* pltComp;
  CPlot* pltCompLog;

  TFile *F_29;
  TFile *F_30;
  TFile *F_31;
  TFile *F_32;
  TFile *F_33;
  TFile *F_34;
  TFile *F_35;
  TFile *F_Data;

  F_29 = new TFile("../"+BaseName+"/29lResbos.root");
  F_30 = new TFile("../"+BaseName+"/30lResbos.root");
  F_31 = new TFile("../"+BaseName+"/31lResbos.root");
  F_32 = new TFile("../"+BaseName+"/32lResbos.root");
  F_33 = new TFile("../"+BaseName+"/33lResbos.root");
  F_34 = new TFile("../"+BaseName+"/34lResbos.root");
  F_35 = new TFile("../"+BaseName+"/35lResbos.root");
  F_Data = new TFile("../RstUnfold/Result_"+BaseName+".root");

  TString resultDir = "Result";
  gSystem->mkdir(resultDir,kTRUE);
  TFile f_out(resultDir+"/Resbos_"+BaseName+".root","recreate");

  const int nBins = 14;
  double WptBins[nBins]    = {0.0,7.5,12.5,17.5,24,30,40,50,70,110,150,190,250,600};
  double WptLogBins[nBins] = {1.0,7.5,12.5,17.5,24,30,40,50,70,110,150,190,250,600};
  
  TH1D *hResbos29 = new TH1D("hResbos29","hResbos29",nBins-1,WptBins);hResbos29->Sumw2();
  TH1D *hResbos30 = new TH1D("hResbos30","hResbos30",nBins-1,WptBins);hResbos30->Sumw2();
  TH1D *hResbos31 = new TH1D("hResbos31","hResbos31",nBins-1,WptBins);hResbos31->Sumw2();
  TH1D *hResbos32 = new TH1D("hResbos32","hResbos32",nBins-1,WptBins);hResbos32->Sumw2();
  TH1D *hResbos33 = new TH1D("hResbos33","hResbos33",nBins-1,WptBins);hResbos33->Sumw2();
  TH1D *hResbos34 = new TH1D("hResbos34","hResbos34",nBins-1,WptBins);hResbos34->Sumw2();
  TH1D *hResbos35 = new TH1D("hResbos35","hResbos35",nBins-1,WptBins);hResbos35->Sumw2();
  TH1D *hData = new TH1D("hData","hData",nBins-1,WptBins);hData->Sumw2();
  
  TH1D *hResbosLog29 = new TH1D("hResbosLog29","hResbosLog29",13,WptLogBins);hResbosLog29->Sumw2();
  TH1D *hResbosLog30 = new TH1D("hResbosLog30","hResbosLog30",13,WptLogBins);hResbosLog30->Sumw2();
  TH1D *hResbosLog31 = new TH1D("hResbosLog31","hResbosLog31",13,WptLogBins);hResbosLog31->Sumw2();
  TH1D *hResbosLog32 = new TH1D("hResbosLog32","hResbosLog32",13,WptLogBins);hResbosLog32->Sumw2();
  TH1D *hResbosLog33 = new TH1D("hResbosLog33","hResbosLog33",13,WptLogBins);hResbosLog33->Sumw2();
  TH1D *hResbosLog34 = new TH1D("hResbosLog34","hResbosLog34",13,WptLogBins);hResbosLog34->Sumw2();
  TH1D *hResbosLog35 = new TH1D("hResbosLog35","hResbosLog35",13,WptLogBins);hResbosLog35->Sumw2();
  TH1D *hDataLog = new TH1D("hDataLog","hDataLog",13,WptLogBins);hDataLog->Sumw2();
  
  TH1D* lResbos29;
  TH1D* lResbos30;
  TH1D* lResbos31;
  TH1D* lResbos32;
  TH1D* lResbos33;
  TH1D* lResbos34;
  TH1D* lResbos35;
  TH1D* lData;

  lResbos29 =(TH1D*)F_29->Get("lResbos")->Clone();
  lResbos30 =(TH1D*)F_30->Get("lResbos")->Clone();
  lResbos31 =(TH1D*)F_31->Get("lResbos")->Clone();
  lResbos32 =(TH1D*)F_32->Get("lResbos")->Clone();
  lResbos33 =(TH1D*)F_33->Get("lResbos")->Clone();
  lResbos34 =(TH1D*)F_34->Get("lResbos")->Clone();
  lResbos35 =(TH1D*)F_35->Get("lResbos")->Clone();
  lData =(TH1D*)F_Data->Get("BornEffCorr")->Clone();

  lData->Scale(1./18.429);
  
  for( int ipt(1);ipt<nBins;ipt++)
  {
    hResbos29->SetBinContent(ipt,lResbos29->GetBinContent(ipt));
    hResbos30->SetBinContent(ipt,lResbos30->GetBinContent(ipt));
    hResbos31->SetBinContent(ipt,lResbos31->GetBinContent(ipt));
    hResbos32->SetBinContent(ipt,lResbos32->GetBinContent(ipt));
    hResbos33->SetBinContent(ipt,lResbos33->GetBinContent(ipt));
    hResbos34->SetBinContent(ipt,lResbos34->GetBinContent(ipt));
    hResbos35->SetBinContent(ipt,lResbos35->GetBinContent(ipt));
    hData->SetBinContent(ipt,lData->GetBinContent(ipt));
    hData->SetBinError(ipt,lData->GetBinError(ipt));
    
    hResbos29->SetBinError(ipt,lResbos29->GetBinError(ipt));
    hResbos30->SetBinError(ipt,lResbos30->GetBinError(ipt));
    hResbos31->SetBinError(ipt,lResbos31->GetBinError(ipt));
    hResbos32->SetBinError(ipt,lResbos32->GetBinError(ipt));
    hResbos33->SetBinError(ipt,lResbos33->GetBinError(ipt));
    hResbos34->SetBinError(ipt,lResbos34->GetBinError(ipt));
    hResbos35->SetBinError(ipt,lResbos35->GetBinError(ipt));
    
    hResbosLog29->SetBinContent(ipt,lResbos29->GetBinContent(ipt));
    hResbosLog30->SetBinContent(ipt,lResbos30->GetBinContent(ipt));
    hResbosLog31->SetBinContent(ipt,lResbos31->GetBinContent(ipt));
    hResbosLog32->SetBinContent(ipt,lResbos32->GetBinContent(ipt));
    hResbosLog33->SetBinContent(ipt,lResbos33->GetBinContent(ipt));
    hResbosLog34->SetBinContent(ipt,lResbos34->GetBinContent(ipt));
    hResbosLog35->SetBinContent(ipt,lResbos35->GetBinContent(ipt));
    hDataLog->SetBinContent(ipt,lData->GetBinContent(ipt));
    hDataLog->SetBinError(ipt,lData->GetBinError(ipt));
  }
  
  hResbos29->Write();
  hResbos30->Write();
  hResbos31->Write();
  hResbos32->Write();
  hResbos33->Write();
  hResbos34->Write();
  hResbos35->Write();

  TCanvas *c1 = new TCanvas("c1","c1",800,800);

  tmpTStr = BaseName+"_ResbosComp_Lin";
  pltComp = new CPlot(tmpTStr,"","W p_{T} [Gev]","Xsec [pb]");
  pltComp->setOutDir(resultDir);
  pltComp->AddHist1D(hResbos29,"Resbos grid29","HIST",3,1,0);
  pltComp->AddHist1D(hResbos30,"Resbos grid30","HIST",2,1,0);
  pltComp->AddHist1D(hResbos31,"Resbos grid31","HIST",4,1,0);
  pltComp->AddHist1D(hResbos32,"Resbos grid32","HIST",5,1,0);
  pltComp->AddHist1D(hResbos33,"Resbos grid33","HIST",6,1,0);
  pltComp->AddHist1D(hResbos34,"Resbos grid34","HIST",9,1,0);
  pltComp->AddHist1D(hResbos35,"Resbos grid35","HIST",7,1,0);
  pltComp->AddHist1D(hData,"Unfolded","E");
  pltComp->AddTextBox(BaseName,0.7,0.6,.9,0.63,0,1,0);
  pltComp->SetLegend(0.7,0.65,.9,0.88);
  pltComp->Draw(c1,kTRUE,"png");
  
  tmpTStr = BaseName+"_ResbosComp_Log";
  pltCompLog = new CPlot(tmpTStr,"","W p_{T} [Gev]","Xsec [pb]");
  pltCompLog->setOutDir(resultDir);
  pltCompLog->AddHist1D(hResbosLog29,"Resbos grid29","HIST",3,1,0);
  pltCompLog->AddHist1D(hResbosLog30,"Resbos grid30","HIST",2,1,0);
  pltCompLog->AddHist1D(hResbosLog31,"Resbos grid31","HIST",4,1,0);
  pltCompLog->AddHist1D(hResbosLog32,"Resbos grid32","HIST",5,1,0);
  pltCompLog->AddHist1D(hResbosLog33,"Resbos grid33","HIST",6,1,0);
  pltCompLog->AddHist1D(hResbosLog34,"Resbos grid34","HIST",9,1,0);
  pltCompLog->AddHist1D(hResbosLog35,"Resbos grid35","HIST",7,1,0);
  pltCompLog->AddHist1D(hDataLog,"Unfolded","E");
  pltCompLog->AddTextBox(BaseName,0.7,0.6,.9,0.63,0,1,0);
  pltCompLog->SetLegend(0.7,0.65,.9,0.88);
  pltCompLog->SetLogx();
  pltCompLog->Draw(c1,kTRUE,"png");
  return 0;
}