6 gSystem->Load(
"libpq");
7 gSystem->Load(
"libqroot");
8 gSystem->Load(
"libthreadwrapper");
9 gSystem->Load(
"libbase");
10 gSystem->Load(
"libcoretools");
11 gSystem->Load(
"libglobalrw");
12 gSystem->Load(
"libqstyle");
13 gSystem->Load(
"libdbbase");
14 gSystem->Load(
"librundatadb");
15 gSystem->Load(
"libdianadata");
16 gSystem->Load(
"libcalderdata");
17 gSystem->Load(
"libcaldertools");
18 gSystem->Load(
"libqstyleloader");
19 gSystem->Load(
"liboptimumfilter");
20 using namespace Diana;
41 for(
int i = 0; i <
N; i++) {
60 std::cout<<
"Simga OF: "<<
sigma_of<<
" amp: "<<
amp<<std::endl;
61 std::cout<<
"Simga OF2: "<<
sigma_of<<std::endl;;
64 TH1D* lhisto =
new TH1D(
"lhisto",
"lhisto",sqrt(
Ne),0,10);
65 TH1D* rhisto =
new TH1D(
"rhisto",
"rhisto",sqrt(
Ne),0,10);
66 TH1D* chisto =
new TH1D(
"chisto",
"chisto",sqrt(
Ne),0,2);
67 TH1D* jhisto =
new TH1D(
"jhisto",
"jhisto",240,-30,30);
70 TH1D* lhisto2 =
new TH1D(
"lhisto2",
"lhisto2",sqrt(
Ne),0,10);
71 TH1D* rhisto2 =
new TH1D(
"rhisto2",
"rhisto2",sqrt(
Ne),0,10);
72 TH1D* chisto2 =
new TH1D(
"chisto2",
"chisto2",sqrt(
Ne),0,2);
73 TH1D* jhisto2 =
new TH1D(
"jhisto2",
"jhisto2",50*
taur,-5*
taur,5*
taur);
80 for(
int e = 0; e <
Ne; e++) {
81 if(e%100 == 0) cout<<
"Event: "<<e<<std::endl;
83 double shift=rand.Uniform(-4*
taur,4*
taur);
84 QVector signal(
N),signal2(
N);
86 signal2.Initialize(0);
87 for(
int i = 0; i <
N; i++) {
88 double t = double(i-
t0)-shift;
89 signal[i] += rand.Gaus(0,
sigma);
90 signal2[i] += rand.Gaus(0,
sigma);
104 double jitter,chi2,amplitude,integral,left,right;
107 ahisto->Fill(amplitude);
111 jhisto->Fill(jitter-shift);
118 double jitter2,chi22,amplitude2,integral2,left2,right2;
121 ahisto2->Fill(amplitude2);
122 lhisto2->Fill(left2);
123 rhisto2->Fill(right2);
124 chisto2->Fill(chi22);
125 jhisto2->Fill(jitter2-shift);
130 TCanvas * cs =
new TCanvas(
"cs",
"cs",800,600);
131 signal.GetGraph()->Draw(
"AL");
134 ofwave->SetLineColor(kRed);
135 ofwave->Draw(
"LSAME");
136 TGraph* apgraph = (
ap.Shift(shift)*(
amp/
max)).GetGraph();
137 apgraph->SetLineColor(kBlue);
138 apgraph->Draw(
"LSAME");
139 cs->SaveAs(
"checkof_wave.pdf");
145 std::cout<<
"Successfull filtering : "<<double(
success)/
Ne*100<<
" %"<<std::endl;
146 std::cout<<
"Successfull filtering 2: "<<double(
success2)/
Ne*100<<
" %"<<std::endl;
148 TCanvas* c1 =
new TCanvas(
"checkof",
"checkof",1200,800);
151 ahisto2->SetLineColor(kRed);
153 ahisto->Draw(
"SAME");
156 jhisto2->SetLineColor(kRed);
158 jhisto->Draw(
"SAME");
160 chisto2->SetLineColor(kRed);
162 chisto->Draw(
"SAME");
164 lhisto2->SetLineColor(kRed);
166 lhisto->Draw(
"SAME");
168 rhisto2->SetLineColor(kRed);
170 rhisto->Draw(
"SAME");
171 c1->SaveAs(
"checkof.pdf");
QOptimumFilter of(ap, an,-1, false)
QOptimumFilter of2(ap2, an,-1, false)
Diana::QVector exp(const Diana::QVector &v)
error class with error type and description
Optimum filter implemented with windowing and zeros.
QError GetInterpolated(double &jitter, double &chi2, double &litude, double &integral, double &left, double &right) const
get values at interpolated chi^2 minimum. Three points around the minimum are used for a parabolic in...
Diana::QVector GetFilteredShifted() const
get filtered and shifted samples by fMaxPos
QError SetJitter(JitterMode mode, int start=0)
double GetFilteredNoiseRMS() const
expected noise rms after the filter
QError Filter(const Diana::QVector &p)
filter. In case of failure an error is returned.
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...