Commit 9eebe8b9 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Finding of zero levels modified.

parent 13088ecc
......@@ -12,6 +12,17 @@
int main(int argc, char* argv[])
{
//to be extracted from the source as parameters
const Int_t noBranches = 4;
const Double_t cfRatio = 0.5;
const Int_t cfTD = 5;
Double_t noiseMin = 5;
Double_t noiseMax = 25;
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)]" << std::endl;
......@@ -28,6 +39,8 @@ int main(int argc, char* argv[])
if(argc==3) {
kEventSize = 1024;
noiseMin = 10.;
noiseMax = 100.;
Info("convertRawToAnalyzed", "Event size was set to %d", kEventSize);
}
if(argc==4) {
......@@ -41,10 +54,6 @@ int main(int argc, char* argv[])
TFile *f = new TFile(infiles.Data());
TTree *tr = (TTree*)f->Get("rtree");
const Int_t noBranches = 4;
const Double_t cfRatio = 0.5;
const Int_t cfTD = 5;
TString bName;
RawEvent *revent[noBranches];
for (Int_t j = 0; j<noBranches; j++) {
......@@ -65,6 +74,7 @@ int main(int argc, char* argv[])
wevent[j]->SetInputEvent(&revent[j]); //takes raw event from RawEvent
wevent[j]->SetCFratio(cfRatio);
wevent[j]->SetCFtimeDelay(cfTD);
wevent[j]->SetNoiseRange(noiseMin, noiseMax);
tw->Bronch(bName.Data(), "AEvent", &wevent[j]); // create branches in atree to hold analyzed data
}
//----event loop in tr input tree
......@@ -85,7 +95,7 @@ int main(int argc, char* argv[])
}
//----end of event loop
printf("%d events are processed\n", nentries);
printf("%lld events are processed\n", nentries);
tw->Write();
fw->Close();
......
......@@ -119,6 +119,9 @@ void AEvent::Init() {
fCFratio = 0.;
fCFtimeDelay = 0.;
fNoiseRangeMin = 0.;
fNoiseRangeMax = 1.;
}
void AEvent::SetGraphs() {
......@@ -174,12 +177,12 @@ void AEvent::SetCFD() {
}
}
Double_t AEvent::FindZeroLevel(Int_t pmin, Int_t pmax) {
Double_t AEvent::FindZeroLevel() {
SetGraphs();
Double_t correction = 0;
TF1 *fit1 = new TF1("fit1","[0]"); //function for one parameter fitting in the range of pmin-pmax
fit1->SetRange(pmin,pmax);
fit1->SetRange(fNoiseRangeMin,fNoiseRangeMax);
if (!fGraphSignal) {
Warning("AEvent::FindZeroLevel", "Graph was not set");
......
......@@ -52,6 +52,9 @@ private:
Double_t fCFratio; //!
Double_t fCFtimeDelay; //!
Double_t fNoiseRangeMin; //!
Double_t fNoiseRangeMax; //!
public:
AEvent();
AEvent(const Int_t npoints);
......@@ -70,6 +73,9 @@ public:
void SetCFtimeDelay(Double_t timeDelay) { fCFtimeDelay = timeDelay; };
//CFD set time delay (in points)
void SetNoiseRange(Double_t min, Double_t max) { fNoiseRangeMin = min; fNoiseRangeMax = max; };
//Set noise range to be used in FindZeroLevel()
void Reset();
//Resets arrays to zeros
......@@ -85,7 +91,7 @@ public:
}
//draws signal shape graphs
Double_t FindZeroLevel(Int_t pmin = 10, Int_t pmax = 100);
Double_t FindZeroLevel();
//for zero level correction. one parameter fit between pmin and pmax
//returns fit parameter i.e. number on which amplitude should be corrected
......
//void integralFormSignal()
void integralFormSignal()
{
gSystem->Load("../libData.so");
TFile *f = new TFile("../data/dataTektronix/exp7.root");
TFile *f = new TFile("../data/dataTektronix/analysisExp7.root");
TTree *tr = (TTree*)f->Get("atree");
const Int_t noBranches = 4;
......
......@@ -6,7 +6,8 @@ void testShowGraphs()
const Long64_t kFirstEvent = 128;
// TFile fr("../data/dataDSR4/analysis_07_1.root");
TFile fr("../data/dataDSR4/analysis_07_8.root");
// TFile fr("../data/dataDSR4/analysis_07_8.root");
TFile fr("../data/dataTektronix/analysisExp7.root");
TTree *tr = (TTree*)fr.Get("atree");
AEvent *revent = new AEvent();
......
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