...
 
Commits (7)

Too many changes to show.

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

......@@ -14,9 +14,9 @@ int main(int argc, char* argv[])
{
//to be extracted from the source as parameters
const Int_t noBranches = 4;
const Int_t noBranches = 2;
const Double_t cfRatio = 0.3;
const Double_t cfTD = 1.5; //in ns
const Double_t cfTD = 0.6; //in ns
Double_t noiseMin = 5;
Double_t noiseMax = 25;
Int_t nump = 5; //number of points for smoothing
......
#include <fstream>
#include "TString.h"
#include "TFile.h"
#include "TError.h"
#include "TTree.h"
//#include "../dataClasses/RawEvent.h"
void read2()
{
// find . -type f | wc -l для подсчёта файлов в папке
// cout << gSystem->Load("../libData.so") << endl;
gSystem->Load("../libData.so");
using std::cout;
using std::endl;
Int_t k,n,p,Nchannel,nHun,nDec,counter;
TString line1,line2,filename1,filename2;
Double_t amp1,amp2,time1,time2;
const Int_t nfiles = 5000;
const Int_t NEvents = 1000;
//Double_t A1[1000],A2[1000];
//Double_t T1[1000],T2[1000];
p=0;
TFile *f1 = new TFile("../data/rawDataTektronix/GSItests/1000v_5mv.root","RECREATE");
//TFile *f1 = new TFile("1000V_10mv.root","RECREATE");
TTree *rtree = new TTree("rtree","signal");
/* rtree->Branch("A1",A1,"A1[1000]/D");
rtree->Branch("A2",A2,"A2[1000]/D");
rtree->Branch("T1",T1,"T1[1000]/D");
rtree->Branch("T2",T2,"T2[1000]/D");*/
RawEvent *event1 = new RawEvent(1000);
rtree->Bronch("ch0.", "RawEvent", &event1);
RawEvent *event2 = new RawEvent(1000);
rtree->Bronch("ch1.", "RawEvent", &event2);
RawEvent *event3 = new RawEvent(1000);
rtree->Bronch("ch2.", "RawEvent", &event3);
RawEvent *event4 = new RawEvent(1000);
rtree->Bronch("ch3.", "RawEvent", &event4);
counter = 0;
ifstream myfile1,myfile2; // i=0;
for(Int_t i=0; i<nfiles; i++) { if(i%1000==0){ cout<<i<<endl;}
filename1.Form("../data/rawDataTektronix/muzalevsky/1000V_trigg5mv_nosurce/1000V_5.2mv_nosource%dWfm_Ch1.txt",i+1);
myfile1.open(filename1.Data());
if (myfile1.is_open()) {
filename2.Form("../data/rawDataTektronix/muzalevsky/1000V_trigg5mv_nosurce/1000V_5.2mv_nosource%dWfm_Ch2.txt",i+1);
myfile2.open(filename2.Data());
if (myfile2.is_open()) {
p++;
for(Int_t j =0;j<NEvents;j++){
line1.ReadLine(myfile1);
line2.ReadLine(myfile2);
//cout<<line1<<endl;
if( line1.IsNull() || line2.IsNull() ) break;
sscanf(line1.Data(), "%lf", &amp1);
sscanf(line2.Data(), "%lf", &amp2);
//cout<<line1.Data()<<endl;
//cout<<amp1<<" "<<j<<endl;
time1 = j*0.1;
time2 = j*0.1;
event1->SetAmp(amp1, j);
event2->SetAmp(amp2, j);
event1->SetTime(time1, j);
event2->SetTime(time2, j);
}
rtree->Fill();
counter++;
//cout<<counter<<" events founded"<<endl;
for(j=0;j<NEvents;j++){ // reset
event1->Reset();
event2->Reset();
}
myfile1.close();
myfile2.close();
}
else{
Error("read2.cpp", "Some error when opening file %s", filename2.Data());
return;
}
}
else{
Error("read2.cpp", "Some error when opening file %s", filename1.Data());
return;
}//*/
} //for
cout << p << " files processed" << endl;
rtree->Write();
f1->Close();
}