Commit 422bae7d authored by Muzalevsky I.A's avatar Muzalevsky I.A

raw GSI data added

parent 300d656a

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

#include <fstream>
#include "TString.h"
#include "TFile.h"
#include "TError.h"
#include "TTree.h"
#include "../dataClasses/RawEvent.h"
void read2()
{
// std::cout << argv[1] << "says hello, " << argv[2] << "!" << std::endl;
// std::cout << infiles << "says hello, " << ofile << "!" << std::endl;
// return 0;
gSystem->Load("../libData.so");
Double_t A1[1000],A2[1000];
Double_t T1[1000],T2[1000];
Int_t k,n,p,Nchannel,nHun,nDec;
TString line1,line2,filename1,filename2;
Double_t amp1,amp2,time1,time2;
const Int_t nfiles = 400;
const Int_t Nlines = 500;
TFile *f1 = new TFile("source.root","RECREATE");
TTree *tree = new TTree("rtree","signal");
tree->Branch("A1",A1,"A1[1000]/D");
tree->Branch("A2",A2,"A2[1000]/D");
tree->Branch("T1",T1,"T1[1000]/D");
tree->Branch("T2",T2,"T2[1000]/D");
ifstream myfile1,myfile2;
Int_t i=0;
//for(Int_t i=0;i<nfiles;i++)
{
nHun = (i%1000 - i%100)/100; // изза кривых названий файла приходится выяснять количетсво единиц, сотен, десятков, в данноом числе.
nDec = (i%100 - i%10)/10; // делю на соответствующие числа для получения цифры
n = i%10;
filename1.Form("../data/rawDataTektronix/SORCE/trigger_10mv/C2BCF12_H9500_1000_ToT00%d%d%d.txt",nHun,nDec,n);
myfile1.open("../data/rawDataTektronix/SORCE/trigger_10mv/try.txt");
if (myfile1.is_open()) {cout<<"file opened "<<filename1.Data()<<endl;}
else{
Error("read2.cpp", "Some error when opening file %s", filename1.Data());
return;
}
filename2.Form("../data/rawDataTektronix/SORCE/nontrigger_10mV/C3BCF12_H9500_1000_ToT00%d%d%d.txt",nHun,nDec,n);
myfile2.open(filename2.Data());
if (myfile2.is_open()) {/*cout<<"file opened "<<filename2.Data()<<endl;*/}
else{
Error("read2.cpp", "Some error when opening file %s", filename2.Data());
return;
}
for(Int_t j=0;j<5;j++){// пропускаю первые 5 строк
line1.ReadLine(myfile1);
line2.ReadLine(myfile2);
//cout<<line1<<endl;
}
for(Int_t j =0;j<Nlines;j++){
if(j==1) break;
line1.ReadLine(myfile1);
line2.ReadLine(myfile2);
//cout<<line1<<endl;
if( line1.IsNull() || line2.IsNull() ) break;
sscanf(line1.Data(), "%e%*c%e", &amp1, &time1);
sscanf(line2.Data(), "%f%*c%f", &amp2, &time2);
cout<<line1.Data()<<endl;
cout<<amp1<<" "<<time1<<endl;
//cout<<amp2<<" "<<time2<<endl;
A1[j] = amp1; T1[j] = time1;
A2[j] = amp2; T2[j] = time2;
}
tree->Fill();
for(j=0;j<Nlines;j++){ // reset
T1[j]=0; T2[j]=0;
A1[j]=0;A2[j]=0;
}
myfile1.close();
myfile2.close();
}
tree->Write();
f1->Close();
}
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