int main(int argc, char** argv)
{
	if (argc < 3)
	{
		std::cout << "Usage: combustion-vineyard FRAME1 FRAME2" << std::endl;
		exit(0);
	}
	
	int size0, nc0;
	int size1, nc1;

	std::cout << "Reading: " << argv[1] << std::endl;
	std::ifstream ifs0(argv[1], std::ios::binary);
	std::cout << "Reading: " << argv[2] << std::endl;
	std::ifstream ifs1(argv[2], std::ios::binary);

	if (!ifs0 || !ifs1)
	{
		std::cout << "Could not open the frames" << std::endl;
		exit(0);
	}

	read(ifs0, size0); read(ifs0, nc0);
	read(ifs1, size1); read(ifs1, nc1);

	assert(size0 == size1); assert(nc0 == nc1);
	assert(size0 == xsize*ysize);
	
	Grid2D g0(xsize, ysize), g1(xsize, ysize);
	
	for (int y = 0; y < ysize; ++y)
		for (int x = 0; x < xsize; ++x)
			for (int d = 0; d < nc0; ++d)
			{
				float val0, val1;
				read(ifs0, val0);
				read(ifs1, val1);
				if (d == var)
				{
					g0(x,y) = val0;
					g1(x,y) = val1;
				}
			}
	std::cout << "Grids read" << std::endl;
	
	// Generate filtration and compute pairing
	Grid2DVineyard v(&g0);
	std::cout << "Filtration generated, size: " << v.filtration()->size() << std::endl;
	v.compute_pairing();
	std::cout << "Pairing computed" << std::endl;
	
	// Compute vineyard
	v.compute_vineyard(&g1, true);
	std::cout << "Vineyard computed" << std::endl;

	v.vineyard()->save_edges("combustion");
}
Beispiel #2
0
void testResult(){
  
  std::ifstream ifs0("simGain.txt");
  std::ifstream ifs1("CalibrationN.txt");
  if( !ifs0.is_open() ){return;}
  if( !ifs1.is_open() ){return;}

  TH1D* hisGain = new TH1D("test","",200,0,2);
  TH1D* hisInit = new TH1D("test1","",200,0,2);
  double cal0;
  double cal1;
  double calfactor0[2716]={0};
  double calfactor1[2716]={0};
  
  Int_t  N;
  Int_t ID;
  while( !ifs0.eof() ){
    ifs0 >> ID >> cal0;
    calfactor0[ID] = cal0;
    std::cout<< ID << std::endl;
  }

  while( !ifs1.eof() ){
    ifs1 >> ID >> cal1 >> N;
    std::cout<< ID << std::endl;
    calfactor1[ID] = cal1;
  }
  
  for( int i = 0; i< 2716; i++){
    if(calfactor0[i] ==0 || calfactor1[i] ==0){
      continue;
    }
    hisGain->Fill(calfactor0[i]/calfactor1[i]);
    hisInit->Fill(calfactor0[i]);
  }
  hisGain->Draw();
  hisInit->SetLineColor(2);
  hisInit->Draw("same");

  std::cout<< hisGain->GetRMS()/hisGain->GetMean() << "\t"
	   << hisInit->GetRMS()/hisInit->GetMean() << std::endl;
}