Commit 58a38423 authored by Vratislav Chudoba's avatar Vratislav Chudoba

"convertTektronix" is application now.

parent f8d14ce8
void read1() { #include <fstream>
gSystem->Load("../libData.so");
#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 A1[1000],A2[1000],A3[1000],A4[1000];
Double_t T[1000]; Double_t T[1000];
...@@ -7,7 +33,7 @@ void read1() { ...@@ -7,7 +33,7 @@ void read1() {
TString line1,line2,line3,line4,fileName; TString line1,line2,line3,line4,fileName;
Double_t amp1,amp2,amp3,amp4,time; 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"); TTree *tree = new TTree("rtree","signal");
tree->Branch("A1",A1,"A1[1000]/D"); tree->Branch("A1",A1,"A1[1000]/D");
tree->Branch("A2",A2,"A2[1000]/D"); tree->Branch("A2",A2,"A2[1000]/D");
...@@ -37,7 +63,7 @@ void read1() { ...@@ -37,7 +63,7 @@ void read1() {
ifstream myfile3; ifstream myfile3;
ifstream myfile4; ifstream myfile4;
myfile.open("../data/rawDataTektronix/infiles.dat"); // открываю файл с названиями файлов с данными для подсчёта общего количества файлов myfile.open(infiles.Data()); // открываю файл с названиями файлов с данными для подсчёта общего количества файлов
if (myfile.is_open()) { /// для создания динамического массива с путями к файлам с данными if (myfile.is_open()) { /// для создания динамического массива с путями к файлам с данными
while(1){ while(1){
fileName.ReadLine(myfile); fileName.ReadLine(myfile);
...@@ -46,12 +72,15 @@ void read1() { ...@@ -46,12 +72,15 @@ void read1() {
} }
myfile.close(); 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 = new TString[Nlines]; // создание массива в котором хранятся строки из файла "infiles.dat"
// TString NameLines[Nlines]; // TString NameLines[Nlines];
myfile.open("../data/rawDataTektronix/infiles.dat"); myfile.open(infiles.Data());
for(i=0;;i++){ for(i=0;;i++){
fileName.ReadLine(myfile); fileName.ReadLine(myfile);
NameLines[i] = fileName; NameLines[i] = fileName;
...@@ -127,9 +156,11 @@ void read1() { ...@@ -127,9 +156,11 @@ void read1() {
} }
else { else {
Error("read.cpp", "Some error when opening data file number of %d", i); Error("read.cpp", "Some error when opening data file number of %d", i);
return; return 1;
} }
}//for i }//for i
tree->Write(); tree->Write();
f1->Close(); f1->Close();
return 0;
} }
...@@ -24,11 +24,13 @@ PWD = $(shell pwd) ...@@ -24,11 +24,13 @@ PWD = $(shell pwd)
DATA = $(PWD)/dataClasses DATA = $(PWD)/dataClasses
CONVERTDRS4 = $(PWD)/convertDRS4 CONVERTDRS4 = $(PWD)/convertDRS4
CONVERTTEKTRONIX = $(PWD)/convertTektronix
-include $(DATA)/Data.mk -include $(DATA)/Data.mk
all: libData.so \ 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 #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 ...@@ -67,6 +69,14 @@ read_binary_DRS4: $(CONVERTDRS4)/read_binary.cpp libData.so
@echo 'Finished building target: $@' @echo 'Finished building target: $@'
@echo ' ' @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 .PHONY: all clean
# Each subdirectory must supply rules for building sources it contributes # Each subdirectory must supply rules for building sources it contributes
......
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