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;
40 for(
int i = 0; i <
N; i++) {
87 std::cout<<
"Simga OF: "<<
sigma_of<<
" amp: "<<
amp<<std::endl;
90 TH1D* ahisto =
new TH1D(
"ahisto",
"ahisto",sqrt(
Ne),
amp*0.2,
amp*1.5);
91 TH1D* lhisto =
new TH1D(
"lhisto",
"lhisto",sqrt(
Ne),0,50);
92 TH1D* rhisto =
new TH1D(
"rhisto",
"rhisto",sqrt(
Ne),0,50);
93 TH1D* chisto =
new TH1D(
"chisto",
"chisto",sqrt(
Ne),0,2);
94 TH1D* jhisto =
new TH1D(
"jhisto",
"jhisto",240,-30,30);
95 TH1D* shisto =
new TH1D(
"shisto",
"shisto",sqrt(
Ne),0,
amp);
97 TH1D* ahisto2 =
new TH1D(
"ahisto2",
"ahisto2",sqrt(
Ne),
amp*0.2,
amp*1.5);
98 TH1D* lhisto2 =
new TH1D(
"lhisto2",
"lhisto2",sqrt(
Ne),0,50);
99 TH1D* rhisto2 =
new TH1D(
"rhisto2",
"rhisto2",sqrt(
Ne),0,50);
100 TH1D* chisto2 =
new TH1D(
"chisto2",
"chisto2",sqrt(
Ne),0,2);
101 TH1D* jhisto2 =
new TH1D(
"jhisto2",
"jhisto2",50*
taur,-5*
taur,5*
taur);
102 TH1D* shisto2 =
new TH1D(
"shisto2",
"shisto2",sqrt(
Ne),0,
amp);
109 for(
int e = 0; e <
Ne; e++) {
110 if(e%100 == 0) cout<<
"Event: "<<e<<std::endl;
112 double shift=rand.Uniform(-4*
taur,4*
taur);
113 QVector signal(
N),signal2(
N);
114 QVector noise(
N),noise2(
N);
115 signal.Initialize(0);
116 signal2.Initialize(0);
118 noise2.Initialize(0);
120 for(
int i = 0; i <
N; i++) {
121 double t = double(i-
t0)-shift;
122 noise[i] += rand.Gaus(0,
sigma);
123 noise2[i] += rand.Gaus(0,
sigma);
128 signal *=
amp/signal.GetMax();
129 signal2 *=
amp/signal2.GetMax()/1.15;
139 double jitter,chi2,amplitude,integral,left,right;
142 ahisto->Fill(amplitude);
146 jhisto->Fill(jitter-shift);
152 double jitter2,chi22,amplitude2,integral2,left2,right2;
155 ahisto2->Fill(amplitude2);
156 lhisto2->Fill(left2);
157 rhisto2->Fill(right2);
158 chisto2->Fill(chi22);
159 jhisto2->Fill(jitter2-shift);
168 for(
int i =
maxpos+jitter; i >0; i--) {
180 for(
int i =
maxpos+jitter2; i >0; i--) {
192 TCanvas * cs =
new TCanvas(
"cs",
"cs",800,600);
193 signal2.GetGraph()->Draw(
"AL");
195 ofbase = ofwave_man.GetMean(3./4*
t0);
199 TGraph* ofwave = ofwave_man.GetGraph();
202 ofwave->SetLineColor(kRed);
203 ofwave->Draw(
"LSAME");
204 TGraph* apgraph = (
ap.Shift(shift)*(
amp/
max)).GetGraph();
205 apgraph->SetLineColor(kBlue);
206 apgraph->Draw(
"LSAME");
207 offilter->SetLineColor(kGreen);
208 offilter->Draw(
"LSAME");
209 cs->SaveAs(
"checkof_wave.pdf");
216 std::cout<<
"Successfull filtering : "<<double(
success)/
Ne*100<<
" %"<<std::endl;
217 std::cout<<
"Successfull filtering 2: "<<double(
success2)/
Ne*100<<
" %"<<std::endl;
219 TCanvas* c1 =
new TCanvas(
"checkof",
"checkof",1200,800);
222 ahisto2->SetLineColor(kRed);
224 ahisto->Draw(
"SAME");
227 jhisto2->SetLineColor(kRed);
229 jhisto->Draw(
"SAME");
231 chisto2->SetLineColor(kRed);
233 chisto->Draw(
"SAME");
235 lhisto2->SetLineColor(kRed);
237 lhisto->Draw(
"SAME");
239 rhisto2->SetLineColor(kRed);
241 rhisto->Draw(
"SAME");
243 shisto2->SetLineColor(kRed);
245 shisto->Draw(
"SAME");
246 TF1*
fg =
new TF1(
"fg",
"gaus");
249 m1 =
fg->GetParameter(1);
250 s1 =
fg->GetParameter(2);
252 m2 =
fg->GetParameter(1);
253 s2 =
fg->GetParameter(2);
255 std::cout<<
"DP: "<<
dp<<std::endl;
257 c1->SaveAs(
"checkof.pdf");
QOptimumFilter of(ap, an,-1, false)
QOptimumShapeFilter of2(ap, an,-1, false, 2)
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
Diana::QVector GetFilterTD() const
kernel of the filter in the time domain
QError Filter(const Diana::QVector &p)
filter. In case of failure an error is returned.
Filter based on optimum filter tailored to preserve the shape of the original signal.
const Diana::QVector & GetOriginalAveragePulseFilteredShifted()
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...