diff --git a/convertTektronix/exp2.root b/convertTektronix/exp2.root deleted file mode 100644 index 862ca8338b506ba016b1f4d7bba94a7b118cdf54..0000000000000000000000000000000000000000 Binary files a/convertTektronix/exp2.root and /dev/null differ diff --git a/convertTektronix/read1.cpp b/convertTektronix/read1.cpp index c56e33be550c7d8edffd3d66227163686b853f7d..953608616d2c9c38cd5511ba22547a4bcad2b0f8 100644 --- a/convertTektronix/read1.cpp +++ b/convertTektronix/read1.cpp @@ -1,5 +1,31 @@ -void read1() { - gSystem->Load("../libData.so"); +#include + +#include "TString.h" +#include "TFile.h" +#include "TError.h" +#include "TTree.h" + +#include "../dataClasses/RawEvent.h" + + +int main(int argc, char* argv[]) +{ + + if (argc != 3) { + // Tell the user how to run the program + std::cerr << "Usage: " << argv[0] << " [list with input files] [outputfile]" << std::endl; + /* "Usage messages" are a conventional way of telling the user + * how to run a program if they enter the command incorrectly. + */ + return 1; + } + // Print the user's name: + TString infiles = argv[1]; + TString ofile = argv[2]; + +// std::cout << argv[1] << "says hello, " << argv[2] << "!" << std::endl; +// std::cout << infiles << "says hello, " << ofile << "!" << std::endl; +// return 0; Double_t A1[1000],A2[1000],A3[1000],A4[1000]; Double_t T[1000]; @@ -7,7 +33,7 @@ void read1() { TString line1,line2,line3,line4,fileName; Double_t amp1,amp2,amp3,amp4,time; - TFile *f1 = new TFile("exp2.root","RECREATE"); + TFile *f1 = new TFile(ofile.Data(),"RECREATE"); TTree *tree = new TTree("rtree","signal"); tree->Branch("A1",A1,"A1[1000]/D"); tree->Branch("A2",A2,"A2[1000]/D"); @@ -37,7 +63,7 @@ void read1() { ifstream myfile3; ifstream myfile4; - myfile.open("../data/rawDataTektronix/infiles.dat"); // открываю файл с названиями файлов с данными для подсчёта общего количества файлов + myfile.open(infiles.Data()); // открываю файл с названиями файлов с данными для подсчёта общего количества файлов if (myfile.is_open()) { /// для создания динамического массива с путями к файлам с данными while(1){ fileName.ReadLine(myfile); @@ -46,12 +72,15 @@ void read1() { } myfile.close(); } - else {Error("read.cpp", "Some error when opening file","infiles.dat");return;} + else { + Error("read.cpp", "Some error when opening file %s", infiles.Data()); + return 1; + } TString *NameLines = new TString[Nlines]; // создание массива в котором хранятся строки из файла "infiles.dat" // TString NameLines[Nlines]; - myfile.open("../data/rawDataTektronix/infiles.dat"); + myfile.open(infiles.Data()); for(i=0;;i++){ fileName.ReadLine(myfile); NameLines[i] = fileName; @@ -127,9 +156,11 @@ void read1() { } else { Error("read.cpp", "Some error when opening data file number of %d", i); - return; + return 1; } }//for i tree->Write(); f1->Close(); + + return 0; } diff --git a/makefile b/makefile index a30f0f007bfabcfb84bcb13e861757ad1ed2dc65..6d4fdcdfb376610cef1826f75f664c0389a14f01 100755 --- a/makefile +++ b/makefile @@ -24,11 +24,13 @@ PWD = $(shell pwd) DATA = $(PWD)/dataClasses CONVERTDRS4 = $(PWD)/convertDRS4 +CONVERTTEKTRONIX = $(PWD)/convertTektronix -include $(DATA)/Data.mk all: libData.so \ - read_binary_DRS4 + read_binary_DRS4 \ + convertTektronix #ROOT html documentation, it will be done as a program which will be alsa compiled by this makefile, program will be as a last condition after all of the libraries @@ -67,6 +69,14 @@ read_binary_DRS4: $(CONVERTDRS4)/read_binary.cpp libData.so @echo 'Finished building target: $@' @echo ' ' +convertTektronix: $(CONVERTTEKTRONIX)/read1.cpp libData.so + @echo 'Building target: $@' + @echo 'Invoking: GCC C++ Linker' +# $(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS) + $(CC) -o $(CONVERTTEKTRONIX)/convertTektronix $(CONVERTTEKTRONIX)/read1.cpp -lm `root-config --cflags --libs` -L $(PWD) -lData -Wl,-rpath,$(PWD) + @echo 'Finished building target: $@' + @echo ' ' + .PHONY: all clean # Each subdirectory must supply rules for building sources it contributes