Commit 7b3acf5f authored by Kostyleva D.A's avatar Kostyleva D.A

Conversion script for drs4 became more user friendly

parent b8151a04
Application for convertation of binary files acquired by DRS4 to ROOT file. Application for convertation of binary files acquired by DRS4 to ROOT file.
1. g++ -o read_binary read_binary.cpp -lm `root-config --cflags --libs` 1. read_binary.cpp complies within makefile (commaned make clean, then make in Neurad_test) and makes object file read_binary in current directory
This compiles read_binary.cpp file and makes object file read_binary. 2. To convert binary file to root file do:
2. ./read_binary_DRS4 ./data/rawDataDSR4/file_name.dat ./read_binary_DRS4 ./data/rawDataDSR4/input_file_name.dat ../data/rawDataDSR4/output_file_name.root
With the help of the object file it is possible to convert binary file .dat to file .root (which we call raw /home/dariak/NeuRad_tests/data/rawDataDSR4) !both input and output files should be specified!
3. read_root.C
This script reads raw file and make another file .root with simple analysis /home/dariak/NeuRad_tests/data/dataDSR4
...@@ -85,15 +85,28 @@ int main(int argc, const char * argv[]) ...@@ -85,15 +85,28 @@ int main(int argc, const char * argv[])
float bin_width[16][4][1024]; float bin_width[16][4][1024];
int i, j, b, chn, n, chn_index, n_boards; int i, j, b, chn, n, chn_index, n_boards;
double t1, t2, t3, t4, dt, dt34; double t1, t2, t3, t4, dt, dt34;
char filename[256]; char filename[256]; //for input binary file
char outroot[256]; //for output root file
int ndt; int ndt;
double threshold, sumdt, sumdt2; double threshold, sumdt, sumdt2;
if (argc == 3) {
strcpy(filename, argv[1]);
strcpy(outroot, argv[2]);
}
else if (argc == 2) {
printf("Error: both input binary file and output root file should be specified!\n");
return -1;
}
else {
printf("Error: input binary file and output root file should be specified!\n");
return -1;
}
//for ROOT // ---------------for ROOT
TFile* rfile = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root", "RECREATE"); TFile* rfile = new TFile(outroot, "RECREATE");
TTree* rtree = new TTree("rtree", "tree for drs4 analysis"); TTree* rtree = new TTree("rtree", "tree for drs4 analysis");
//rtree->Branch("t1", &t1, "t1/D"); //br for time of threshold crossing signal in 1 ch //rtree->Branch("t1", &t1, "t1/D"); //br for time of threshold crossing signal in 1 ch
// rtree->Branch("t2", &t2, "t2/D"); //br for time of threshold crossing signal in 2 ch // rtree->Branch("t2", &t2, "t2/D"); //br for time of threshold crossing signal in 2 ch
...@@ -111,13 +124,8 @@ int main(int argc, const char * argv[]) ...@@ -111,13 +124,8 @@ int main(int argc, const char * argv[])
// rtree->Branch("amp_ch2", amp_ch2, "amp_ch2[ncell]/D"); // rtree->Branch("amp_ch2", amp_ch2, "amp_ch2[ncell]/D");
// rtree->Branch("time_ch2", time_ch2, "time_ch2[ncell]/D"); // rtree->Branch("time_ch2", time_ch2, "time_ch2[ncell]/D");
if (argc > 1) //----------------
strcpy(filename, argv[1]);
else {
printf("Usage: read_binary <filename>\n");
return 0;
}
// open the binary waveform file // open the binary waveform file
FILE *f = fopen(filename, "r"); FILE *f = fopen(filename, "r");
if (f == NULL) { if (f == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment