mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 08:38:00 +02:00
directory restuctured
This commit is contained in:
57
slsDetectorCalibration/moenchExecutables/tiff_to_th2f.cpp
Normal file
57
slsDetectorCalibration/moenchExecutables/tiff_to_th2f.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include <TPaveText.h>
|
||||
#include <TLegend.h>
|
||||
#include <TF1.h>
|
||||
#include <TGraphErrors.h>
|
||||
#include <TH2F.h>
|
||||
#include <TASImage.h>
|
||||
#include <TImage.h>
|
||||
#include <TFile.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include "tiffIO.h"
|
||||
|
||||
#include<iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
/**
|
||||
* trial.o [socket ip] [starting port number] [outfname]
|
||||
*
|
||||
*/
|
||||
|
||||
if (argc<3) {
|
||||
cout << "Wrong usage! Should be: "<< argv[0] << " infile " << " outfile " << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32 nx, ny;
|
||||
|
||||
float *data=ReadFromTiff(argv[1],nx, ny);
|
||||
|
||||
TH2F *h2=NULL;
|
||||
if (data) {
|
||||
TFile *fout=new TFile(argv[2],"RECREATE");
|
||||
if (fout) {
|
||||
h2=new TH2F("h2",argv[1],nx,0,nx,ny,0, ny);
|
||||
for (int ix=0; ix<nx ; ix++) {
|
||||
for (int iy=0; iy<ny ; iy++) {
|
||||
|
||||
h2->SetBinContent(ix+1, iy+1, data[ix+iy*nx]);
|
||||
}
|
||||
}
|
||||
h2->Write();
|
||||
fout->Close();
|
||||
}
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user