diff --git a/convertRawToAnalyzed/analyse.cpp b/convertRawToAnalyzed/analyse.cpp index 1b45bb81b3687172e2c449c0f421d8e6f34ba9e2..84aacf062040509ffdfc34857a4322aaf9f0bc60 100644 --- a/convertRawToAnalyzed/analyse.cpp +++ b/convertRawToAnalyzed/analyse.cpp @@ -12,20 +12,31 @@ int main(int argc, char* argv[]) { -// gSystem->Load("../libData.so"); - - if (argc != 4) { + if ( (argc < 3) || (argc > 4) ) { // Tell the user how to run the program - std::cerr << "Usage: " << argv[0] << " [list with input files] [outputfile] [number of points in one event (1000 of 1024)]" << std::endl; + std::cerr << "Usage: " << argv[0] << " [list with input files] [outputfile] [number of points in one event (1000)]" << 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]; - TString Asize = argv[3]; + TString Asize = argv[3]; + Int_t kEventSize; + + if(argc==3) { + kEventSize = 1024; + Info("convertRawToAnalyzed", "Event size was set to %d", kEventSize); + } + if(argc==4) { + kEventSize = Asize.Atoi(); + if(kEventSize!=1000) { + std::cerr<< argv[0] << " the size of Events should be 1000 in this case " << std::endl; + return 1; + } + } TFile *f = new TFile(infiles.Data()); TTree *tr = (TTree*)f->Get("rtree"); @@ -35,28 +46,27 @@ int main(int argc, char* argv[]) 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 + RawEvent *revent[noBranches]; 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->SetBranchAddress(bName.Data(), &revent[j]); } -// tr->SetMakeClass(1); + TFile *fw = new TFile(ofile.Data(), "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(); @@ -75,6 +85,7 @@ int main(int argc, char* argv[]) } //----end of event loop + printf("%d events are processed\n", nentries); tw->Write(); fw->Close(); diff --git a/macros/integralFormSignal.cpp b/macros/integralFormSignal.cpp index 764961e7dfcf8e99705b6e57a08d9bb4c89abcf6..5184d71c357cc3d3317e24b81534aeb2659b7320 100644 --- a/macros/integralFormSignal.cpp +++ b/macros/integralFormSignal.cpp @@ -1,22 +1,22 @@ -void integralFormSignal() +//void integralFormSignal() { gSystem->Load("../libData.so"); - TFile *f = new TFile("../data/dataTektronix/exp2.root"); + TFile *f = new TFile("../data/dataTektronix/exp7.root"); TTree *tr = (TTree*)f->Get("atree"); const Int_t noBranches = 4; Double_t ZeroTime[4]; Int_t iZero[4],PosZero[4],deltaT[4]; - TString bName; AEvent *aevent[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(), &aevent[j]); //read the tree tr with raw data and fill array revent with raw data + //cout << tr->SetBranchAddress(bName.Data(), &aevent[j]) << endl; //read the tree tr with raw data and fill array revent with raw data } - + TH1F *hist0 = new TH1F("hist1", "h1 title", 2000, -100, 100); TH1F *hist1 = new TH1F("hist2", "h2 title", 2000, -100, 100); TH1F *hist2 = new TH1F("hist3", "h3 title", 2000, -100, 100); @@ -38,15 +38,12 @@ void integralFormSignal() deltaT[k] = iZero[k] - PosZero[k]; } - - //for(k=0;k<4;k++) { for(Int_t i = 0; i<1000; i++){ if( ((i+deltaT[0])>-1) && ((i+deltaT[0])<1000)) hist0->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i+deltaT[0])); if( ((i+deltaT[1])>-1) && ((i+deltaT[1])<1000)) hist1->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i+deltaT[1])); hist2->AddBinContent(i+500,aevent[0]->GetOnefAmpPos(i)); hist3->AddBinContent(i+500,aevent[1]->GetOnefAmpPos(i)); } - //} } TCanvas *c1 = new TCanvas("c1","test",10,10,1000,600); diff --git a/makefile b/makefile index efa733bfb9df7fdab3c738e5fc16bf64bfb31974..f4bc21e7ae23b17e8dd50105971396adbaa1ad0c 100755 --- a/makefile +++ b/makefile @@ -47,6 +47,10 @@ clean: -@echo ' ' -$(RM) $(CONVERTDRS4)/read_binary_DRS4 -@echo ' ' + -$(RM) $(CONVERTTEKTRONIX)/convertTektronix + -@echo ' ' + -$(RM) $(CONVERTRAWTOANALYZED)/convertRawToAnalyzed + -@echo ' ' # Those *Cint* files below need special treating: $(DATA)/DataCint.cpp: