From 23dea104778ef7e1ab6c6770a18dc27a4f1a7514 Mon Sep 17 00:00:00 2001 From: "Muzalevsky I.A" Date: Thu, 9 Feb 2017 17:04:41 +0300 Subject: [PATCH] smoothing in AEvent modified --- convertRawToAnalyzed/analyse.cpp | 36 ++++++++++++++++++++++---------- dataClasses/AEvent.cpp | 16 +++++++------- dataClasses/AEvent.h | 6 +++--- 3 files changed, 36 insertions(+), 22 deletions(-) diff --git a/convertRawToAnalyzed/analyse.cpp b/convertRawToAnalyzed/analyse.cpp index d4fdcd1..0d979c6 100644 --- a/convertRawToAnalyzed/analyse.cpp +++ b/convertRawToAnalyzed/analyse.cpp @@ -23,9 +23,9 @@ int main(int argc, char* argv[]) - if ( (argc < 3) || (argc > 4) ) { + if ( (argc < 3) || (argc > 5) ) { // 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)]" << std::endl; + std::cerr << "Usage: " << argv[0] << " [list with input files] [outputfile] [smoothParameter (1 - smoothed, 0 - not)] [number of points in one event (1000 or 1024)]" << std::endl; /* "Usage messages" are a conventional way of telling the user * how to run a program if they enter the command incorrectly. */ @@ -34,8 +34,10 @@ int main(int argc, char* argv[]) TString infiles = argv[1]; TString ofile = argv[2]; - TString Asize = argv[3]; - Int_t kEventSize; + TString smooth = argv[3]; + TString Asize = argv[4]; + Int_t kEventSize,intSmoth; + Bool_t smoothPar = kFALSE; if(argc==3) { kEventSize = 1024; @@ -43,10 +45,24 @@ int main(int argc, char* argv[]) noiseMax = 100.; Info("convertRawToAnalyzed", "Event size was set to %d", kEventSize); } - if(argc==4) { + + if(argc>3) { + intSmoth = smooth.Atoi(); + if((intSmoth!=1) && (intSmoth!=0)) { + std::cerr<< argv[3] << " smoothpar should be 1 or 0 " << std::endl; + return 1; + } + if( intSmoth == 1 ) { + smoothPar = kTRUE; + Info("convertRawToAnalyzed", "we gona SMOOTH"); + } + else {Info("convertRawToAnalyzed", "we NOT gonna SMOOTH");} + } + + if(argc==5) { kEventSize = Asize.Atoi(); - if(kEventSize!=1000) { - std::cerr<< argv[0] << " the size of Events should be 1000 in this case " << std::endl; + if((kEventSize!=1000) && ((kEventSize!=1024))) { + std::cerr<< argv[0] << " the size of Events should be 1000 or 1024 " << std::endl; return 1; } } @@ -54,7 +70,7 @@ int main(int argc, char* argv[]) TFile *f = new TFile(infiles.Data()); if (/*f == 0 || */f->IsZombie()) { Error("convertRawToAnalyzed", "Input file was not opened. Program will be terminated"); - return 2; + return 1; } TTree *tr = (TTree*)f->Get("rtree"); @@ -66,8 +82,6 @@ int main(int argc, char* argv[]) tr->SetBranchAddress(bName.Data(), &revent[j]); } - - 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 @@ -90,7 +104,7 @@ int main(int argc, char* argv[]) //cout<<" Event "<Reset(); - wevent[j]->ProcessEvent(); //here all the analysis is going on so far + wevent[j]->ProcessEvent(smoothPar); //here all the analysis is going on so far } if ( !(i%100) ) { printf("Found event #%lld\n", i); } diff --git a/dataClasses/AEvent.cpp b/dataClasses/AEvent.cpp index 57985c7..7ecf781 100644 --- a/dataClasses/AEvent.cpp +++ b/dataClasses/AEvent.cpp @@ -50,15 +50,17 @@ void AEvent::ProcessEvent(Bool_t bSmooth) { SetMaxAmplitudes(); - SetGraphs(); - if (bSmooth == kTRUE) { SmoothGraphs(); } + else { + SetGraphs(); + } FindFrontProperties(); SetLED(); // SetGraphs(); + SetCFD(); SetChargeCFD(); SetChargeLED(); @@ -110,7 +112,7 @@ void AEvent::Init() { fGraphSignal = new TGraph(); fGraphCFD = new TGraph(); - fGraphSmooth = new TGraph(); +// fGraphSmooth = new TGraph(); fInputEvent = 0; fCFratio = 0.; @@ -135,10 +137,8 @@ void AEvent::SetGraphs() { void AEvent::SmoothGraphs() { //smoothing graph + fGraphSignal->Set(fNPoints - fWinSize/2); - fGraphSmooth->Set(fNPoints - fWinSize/2); - - //Int_t winSize = 5; //number of smoothing points Int_t winMidSize = fWinSize / 2; Double_t tmin, tmax, meanTime, meanAmp, sumAmp; @@ -159,11 +159,11 @@ void AEvent::SmoothGraphs() { meanAmp = sumAmp / fWinSize; //cout<<"mean amp "<SetPoint(i, meanTime, meanAmp); + fGraphSignal->SetPoint(i, meanTime, meanAmp); } - fGraphSignal->Clone +// fGraphSignal->Clone return; } diff --git a/dataClasses/AEvent.h b/dataClasses/AEvent.h index 6f6b36a..779610f 100644 --- a/dataClasses/AEvent.h +++ b/dataClasses/AEvent.h @@ -56,7 +56,7 @@ private: TGraph *fGraphSignal; TGraph *fGraphCFD; - TGraph *fGraphSmooth; +// TGraph *fGraphSmooth; RawEvent *fInputEvent; //! @@ -121,10 +121,10 @@ public: return fGraphSignal; } - TGraph* GetGraphSmooth() { + /*TGraph* GetGraphSmooth() { return fGraphSmooth; - } + }*/ //draws signal shape graphs void FindFrontProperties(); -- 2.18.1