Commit f8d63419 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Functionality in event classes was modified. Branch with event class was added...

Functionality in event classes was modified. Branch with event class was added to convertTektronix application.
parent 7f1eef39
...@@ -31,7 +31,7 @@ void read_root() ...@@ -31,7 +31,7 @@ void read_root()
tw->Branch("time1_pos", time1_pos, "time1_pos[1023]/D"); tw->Branch("time1_pos", time1_pos, "time1_pos[1023]/D");
const Long64_t nEntries = tr->GetEntries(); const Long64_t nEntries = tr->GetEntries();
cout <<"Number of entries: "<<nEntries<<endl; std::cout <<"Number of entries: "<<nEntries<<std::endl;
//----for pictures //----for pictures
/* TCanvas *c1 = new TCanvas(); /* TCanvas *c1 = new TCanvas();
...@@ -76,8 +76,8 @@ void read_root() ...@@ -76,8 +76,8 @@ void read_root()
} }
maxAmplitude1 = maxAmpl1; maxAmplitude1 = maxAmpl1;
timemaxAmplitude1 = timemaxAmpl1; timemaxAmplitude1 = timemaxAmpl1;
cout<<"Max amplitude "<<maxAmpl1<<" for entry "<<i<<endl; std::cout<<"Max amplitude "<<maxAmpl1<<" for entry "<<i<< std::endl;
cout<<"Time for max amplitude "<<timemaxAmpl1<<" for entry "<<i<<endl; std::cout<<"Time for max amplitude "<<timemaxAmpl1<<" for entry "<<i<< std::endl;
//fitting 90 percent of rising edge //fitting 90 percent of rising edge
for(Int_t k=0; k<1023; k++) { for(Int_t k=0; k<1023; k++) {
...@@ -93,7 +93,7 @@ void read_root() ...@@ -93,7 +93,7 @@ void read_root()
//getting integral //getting integral
TGraph *gr3 = new TGraph(1023, time1, ampl1_pos); TGraph *gr3 = new TGraph(1023, time1, ampl1_pos);
gr3->Integral(120,180); gr3->Integral(120,180);
cout<<"INtegral "<<gr3->Integral(120,180)<<endl; std::cout << "INtegral "<<gr3->Integral(120,180)<< std::endl;
tw->Fill(); tw->Fill();
......
#include <iostream>
#include <fstream>
#include "TFile.h"
#include "TTree.h"
#include "../dataClasses/RawEvent.h"
void read() { void read() {
//Double_t N[5]; // массив для чисел () //Double_t N[5]; // массив для чисел ()
//ifstream myfile; //ifstream myfile;
...@@ -9,41 +17,52 @@ void read() { ...@@ -9,41 +17,52 @@ void read() {
TFile *f1 = new TFile("exp2.root","RECREATE"); TFile *f1 = new TFile("exp2.root","RECREATE");
TTree *tree = new TTree("tree","signal"); TTree *tree = new TTree("tree","signal");
tree->Branch("A",A,"A[1000]/D"); tree->Branch("A",A,"A[1000]/D");
tree->Branch("T",T,"T[1000]/D"); tree->Branch("T",T,"T[1000]/D");
//std::vector<Double_t> *A = new std::vector<Double_t>();
//tree->Branch("mybranch","vector<Double_t>",A); RawEvent *event = new RawEvent;
rtree->Bronch("rawEvent", "RawEvent", &event);
//std::vector<Double_t> *A = new std::vector<Double_t>();
//tree->Branch("mybranch","vector<Double_t>",A);
ifstream myfile1; ifstream myfile1;
myfile1.open("ch12016.12.07-02.11.54.dat"); myfile1.open("../data/rawDataTektronix/ch12016.12.07-02.11.54.dat");
if (!myfile1.is_open()) {
Error("read.c", "Some error when opening file");
return;
}
for(i = 0; i<100000; i++){ for(i = 0; i<100000; i++){
n=i/1000; // if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;} n=i/1000; // if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
myfile1 >> A[i-1000*n]; myfile1 >> A[i-1000*n];
T[i-1000*n]=5e-013+ (i-1000*n)*1e-010; T[i-1000*n]=5e-013+ (i-1000*n)*1e-010;
if(i-1000*n ==999) { if(i-1000*n ==999) {
tree->Fill(); tree->Fill();
for(j=0;j<1000;j++){ for(j=0;j<1000;j++){
T[j]=0;A[j]=0; T[j]=0;A[j]=0;
} }
} }
} }
myfile1.close(); myfile1.close();
ifstream myfile2; ifstream myfile2;
myfile2.open("ch12016.12.07-08.48.05.dat"); myfile2.open("ch12016.12.07-08.48.05.dat");
for(i = 0; i<100000; i++){ for(i = 0; i<100000; i++){
n=i/1000; // if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;} n=i/1000; // if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
myfile2 >> A[i-1000*n]; myfile2 >> A[i-1000*n];
T[i-1000*n]=5e-013+ (i-1000*n)*1e-010; T[i-1000*n]=5e-013+ (i-1000*n)*1e-010;
if(i-1000*n ==999){ if(i-1000*n ==999){
tree->Fill(); tree->Fill();
for(j=0;j<1000;j++){ for(j=0;j<1000;j++){
T[j]=0;A[j]=0; T[j]=0;A[j]=0;
} }
} }
} }
myfile2.close(); myfile2.close();
...@@ -53,14 +72,14 @@ void read() { ...@@ -53,14 +72,14 @@ void read() {
n=i/1000;// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;} n=i/1000;// if ((i==1002)||(i==900)||(i==2002)||(i==8002)) {cout<<i<<" "<<n<<endl;}
myfile3 >> A[i-1000*n]; myfile3 >> A[i-1000*n];
T[i-1000*n]=5e-013+ (i-1000*n)*1e-010; T[i-1000*n]=5e-013+ (i-1000*n)*1e-010;
if(i-1000*n ==999) { if(i-1000*n ==999) {
tree->Fill(); tree->Fill();
for(j=0;j<1000;j++){ for(j=0;j<1000;j++){
T[j]=0;A[j]=0; T[j]=0;A[j]=0;
} }
} }
} }
myfile3.close(); myfile3.close();
......
...@@ -5,7 +5,7 @@ void analyse() ...@@ -5,7 +5,7 @@ void analyse()
TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root"); TFile *f = new TFile("../data/rawDataDSR4/NeuRad_test_07_1.root");
TTree *tr = (TTree*)f->Get("rtree"); TTree *tr = (TTree*)f->Get("rtree");
RawData *revent = new RawData(); RawEvent *revent = new RawEvent();
tr->SetBranchAddress("rawEvent", &revent); tr->SetBranchAddress("rawEvent", &revent);
// tr->SetMakeClass(1); // tr->SetMakeClass(1);
...@@ -13,14 +13,15 @@ void analyse() ...@@ -13,14 +13,15 @@ void analyse()
TFile *fw = new TFile("../data/dataDSR4/analysis_07_1.root", "RECREATE"); TFile *fw = new TFile("../data/dataDSR4/analysis_07_1.root", "RECREATE");
TTree *tw = new TTree("drs4analysis", "title of drs4 analysis tree"); TTree *tw = new TTree("drs4analysis", "title of drs4 analysis tree");
AnalyzeData *wevent = new AnalyzeData(); AEvent *wevent = new AEvent();
tw->Bronch("AEvent", "AnalyzeData", &wevent); wevent->SetInputEvent(&revent);
tw->Bronch("AEvent", "AEvent", &wevent);
Long64_t nentries = tr->GetEntries(); Long64_t nentries = tr->GetEntries();
for(Long64_t i = 0; i < nentries; i++) { for(Long64_t i = 0; i < nentries; i++) {
tr->GetEntry(i); tr->GetEntry(i);
wevent->ProcessEvent(revent); wevent->ProcessEvent();
tw->Fill(); tw->Fill();
} }
......
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