From ea515242c8fbd5ae3966bb4a780d8dc1671bfb95 Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Thu, 12 Jan 2017 13:28:34 +0300 Subject: [PATCH] Non-working application "convertRawToAnalyzed" added. --- convertRawToAnalyzed/analyse.cpp | 58 +++++++++++++++++++ .../IntegralCFD.c => macros/IntegralCFD.cxx | 0 makefile | 8 ++- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 convertRawToAnalyzed/analyse.cpp rename convertTektronix/IntegralCFD.c => macros/IntegralCFD.cxx (100%) diff --git a/convertRawToAnalyzed/analyse.cpp b/convertRawToAnalyzed/analyse.cpp new file mode 100644 index 0000000..abde307 --- /dev/null +++ b/convertRawToAnalyzed/analyse.cpp @@ -0,0 +1,58 @@ +void analyse() +{ + gSystem->Load("../libData.so"); + + TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root"); + TTree *tr = (TTree*)f->Get("rtree"); + + const Int_t noBranches = 4; + const Double_t cfRatio = 0.5; + const Int_t cfTD = 5; + + TString bName; + RawEvent *revent[noBranches]; // pointer to the array (of RawEvent class) in which raw data for each channel will be put + for (Int_t j = 0; jSetBranchAddress(bName.Data(), &revent[j]); //read the tree tr with raw data and fill array revent with raw data + } + +// tr->SetMakeClass(1); + + TFile *fw = new TFile("../data/dataDSR4/analysis_07_1.root", "RECREATE"); //create .root file with somehow analyzed data + TTree *tw = new TTree("atree", "title of drs4 analysis tree"); //create analysis tree atree in it + + AEvent *wevent[noBranches]; // pointer to the array (of AEvent class) in which analyzed data for each channel will be put + for (Int_t j = 0; jSetInputEvent(&revent[j]); //takes raw event from RawEvent + wevent[j]->SetCFratio(cfRatio); + wevent[j]->SetCFtimeDelay(cfTD); + tw->Bronch(bName.Data(), "AEvent", &wevent[j]); // create branches in atree to hold analyzed data + } + +//----event loop in tr input tree + Long64_t nentries = tr->GetEntries(); + + for(Long64_t i = 0; i < nentries; i++) { + tr->GetEntry(i); + if ( !(tr->GetEntry(i)%100) ) { + printf("Found event #%d\n", tr->GetEntry(i)); + } + + for (Int_t j = 0; jReset(); + wevent[j]->ProcessEvent(); //here all the analysis is going on so far + } + + tw->Fill(); + } + +//----end of event loop + + tw->Write(); + fw->Close(); + + return; +} diff --git a/convertTektronix/IntegralCFD.c b/macros/IntegralCFD.cxx similarity index 100% rename from convertTektronix/IntegralCFD.c rename to macros/IntegralCFD.cxx diff --git a/makefile b/makefile index 6d4fdcd..bf7ba1a 100755 --- a/makefile +++ b/makefile @@ -25,12 +25,14 @@ PWD = $(shell pwd) DATA = $(PWD)/dataClasses CONVERTDRS4 = $(PWD)/convertDRS4 CONVERTTEKTRONIX = $(PWD)/convertTektronix +CONVERTRAWTOANALYZED = $(PWD)/convertRawToAnalyzed -include $(DATA)/Data.mk all: libData.so \ read_binary_DRS4 \ - convertTektronix + convertTektronix \ + convertRawToAnalyzed #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 @@ -69,11 +71,11 @@ read_binary_DRS4: $(CONVERTDRS4)/read_binary.cpp libData.so @echo 'Finished building target: $@' @echo ' ' -convertTektronix: $(CONVERTTEKTRONIX)/read1.cpp libData.so +convertRawToAnalyzed: $(CONVERTRAWTOANALYZED)/analyse.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) + $(CC) -o $(CONVERTRAWTOANALYZED)/convertRawToAnalyzed $(CONVERTRAWTOANALYZED)/analyse.cpp -lm `root-config --cflags --libs` -L $(PWD) -lData -Wl,-rpath,$(PWD) @echo 'Finished building target: $@' @echo ' ' -- 2.18.1