![]() |
Diana Software
|
Go to the source code of this file.
Functions | |
| gSystem | Load ("libpq") |
| gSystem | Load ("libqroot") |
| gSystem | Load ("libthreadwrapper") |
| gSystem | Load ("libbase") |
| gSystem | Load ("libcoretools") |
| gSystem | Load ("libglobalrw") |
| gSystem | Load ("libqstyle") |
| gSystem | Load ("libdbbase") |
| gSystem | Load ("librundatadb") |
| gSystem | Load ("libdianadata") |
| gSystem | Load ("libcalderdata") |
| gSystem | Load ("libcaldertools") |
| gSystem | Load ("libqstyleloader") |
| gSystem | Load ("liboptimumfilter") |
| QVector | an (N) |
| an | Initialize (sigma *sigma *N) |
| QVector | ap (N) |
| ap | Initialize (0) |
| for (int i=0;i< N;i++) | |
| for (int i=maxpos;i > 0;i--) | |
| std::cout<< deltat20<<" "<< deltat50<<" "<< deltat80<< std::endl;double sigma_of=of.GetFilteredNoiseRMS();double sigma_of2=of2.GetFilteredNoiseRMS();std::cout<<"Simga OF: "<< sigma_of<<" amp: "<< amp<< std::endl;TH1D *ahisto=new TH1D("ahisto","ahisto", sqrt(Ne), amp *0.2, amp *1.5);TH1D *lhisto=new TH1D("lhisto","lhisto", sqrt(Ne), 0, 50);TH1D *rhisto=new TH1D("rhisto","rhisto", sqrt(Ne), 0, 50);TH1D *chisto=new TH1D("chisto","chisto", sqrt(Ne), 0, 2);TH1D *jhisto=new TH1D("jhisto","jhisto", 240,-30, 30);TH1D *shisto=new TH1D("shisto","shisto", sqrt(Ne), 0, amp);TH1D *ahisto2=new TH1D("ahisto2","ahisto2", sqrt(Ne), amp *0.2, amp *1.5);TH1D *lhisto2=new TH1D("lhisto2","lhisto2", sqrt(Ne), 0, 50);TH1D *rhisto2=new TH1D("rhisto2","rhisto2", sqrt(Ne), 0, 50);TH1D *chisto2=new TH1D("chisto2","chisto2", sqrt(Ne), 0, 2);TH1D *jhisto2=new TH1D("jhisto2","jhisto2", 50 *taur,-5 *taur, 5 *taur);TH1D *shisto2=new TH1D("shisto2","shisto2", sqrt(Ne), 0, amp);TRandom rand;rand.SetSeed(0);int success=0, success2=0;for(int e=0;e< Ne;e++) { if(e%100==0) cout<<"Event: "<< e<< std::endl;double shift=rand.Uniform(-4 *taur, 4 *taur);QVector signal(N), signal2(N);QVector noise(N), noise2(N);signal.Initialize(0);signal2.Initialize(0);noise.Initialize(0);noise2.Initialize(0);for(int i=0;i< N;i++) { double t=double(i-t0) -shift;noise[i]+=rand.Gaus(0, sigma);noise2[i]+=rand.Gaus(0, sigma);if(t< 0) continue;signal[i]+=(-exp(-t/taur)+exp(-t/taud));signal2[i]+=(-exp(-t/taur/taur_dev)+exp(-t/taud/taud_dev));} signal *=amp/signal.GetMax();signal2 *=amp/signal2.GetMax()/1.15;signal+=noise;signal2+=noise2;QError err;err=of.Filter(signal);if(err !=QERR_SUCCESS) continue;err=of.SetJitter(QOptimumFilter::J_LOCMAX);if(err !=QERR_SUCCESS) continue;double jitter, chi2, amplitude, integral, left, right;err=of.GetInterpolated(jitter, chi2, amplitude, integral, left, right);if(err !=QERR_SUCCESS) continue;ahisto-> | Fill (amplitude) |
| lhisto | Fill (left) |
| rhisto | Fill (right) |
| chisto | Fill (chi2) |
| jhisto | Fill (jitter-shift) |
| if (err !=QERR_SUCCESS) | |
| shisto | Fill (diff/cgain) |
| shisto2 | Fill (diff2/cgain) |
| if (success2==1) | |
| std::cout<<"Successfull filtering : "<< double(success)/Ne *100<<" %"<< std::endl;std::cout<<"Successfull filtering 2: "<< double(success2)/Ne *100<<" %"<< std::endl;TCanvas *c1=new TCanvas("checkof","checkof", 1200, 800);c1-> | Divide (3, 2) |
| c1 | cd (1) |
| ahisto2 | SetLineColor (kRed) |
| ahisto2 | Draw () |
| ahisto | Draw ("SAME") |
| c1 | cd (2) |
| c1 | cd (3) |
| c1 | cd (4) |
| c1 | cd (5) |
| c1 | cd (6) |
| shisto | Fit (fg) |
| std::cout<<"DP: "<< dp<< std::endl;c1-> | SaveAs ("checkof.pdf") |
Variables | |
| TF1 | a |
| QVector | b |
| double | fs = 1 |
| int | N = 2048*fs |
| int | Ne = 1e3 |
| double | t0 = 200*fs |
| double | taur = 10*fs |
| double | taud = 200*fs |
| double | taur_dev = 1 |
| double | taud_dev = 1 |
| double | sigma = 1*sqrt(fs) |
| double | amp = 10 |
| int | apmaxindex = ap.GetMaxIndex() |
| double | max = ap.GetMax()-ap[0] |
| ap =max | |
| QOptimumFilter | of (ap, an,-1, false) |
| QOptimumShapeFilter | of2 (ap, an,-1, false, 2) |
| QVector | ap1filtered2 = of2.GetOriginalAveragePulseFilteredShifted() |
| double | cbase = ap1filtered2.GetMean(t0*3./4) |
| double | cgain = ap1filtered2.GetMax()-ap1filtered2.GetMin() |
| double | ofbase = ap1filtered2.GetMean(3./4*t0) |
| int | maxpos = ap1filtered2.GetMaxIndex() |
| int | deltat50 = maxpos |
| int | deltat80 = maxpos |
| int | deltat20 = maxpos |
| err = of.Filter(signal2) | |
| double | diff = of2.GetFilteredShifted()[maxpos+jitter-deltat80]-of2.GetFilteredShifted()[maxpos+jitter-deltat20] |
| double | diff2 = of2.GetFilteredShifted()[maxpos+jitter2-deltat80]-of2.GetFilteredShifted()[maxpos+jitter2-deltat20] |
| success2 | |
| TF1 * | fg = new TF1("fg","gaus") |
| double | m1 = fg->GetParameter(1) |
| double | s1 = fg->GetParameter(2) |
| double | m2 = fg->GetParameter(1) |
| double | s2 = fg->GetParameter(2) |
| double | dp = (m1-m2)/sqrt(s1*s1+s2*s2) |
| c1 cd | ( | 1 | ) |
| c1 cd | ( | 2 | ) |
| c1 cd | ( | 3 | ) |
| c1 cd | ( | 4 | ) |
| c1 cd | ( | 5 | ) |
| c1 cd | ( | 6 | ) |
| std::cout<<"Successfull filtering : "<<double(success)/Ne*100<<" %"<<std::endl; std::cout<<"Successfull filtering 2: "<<double(success2)/Ne*100<<" %"<<std::endl; TCanvas* c1 = new TCanvas("checkof","checkof",1200,800); c1-> Divide | ( | 3 | , |
| 2 | |||
| ) |
| ahisto Draw | ( | "SAME" | ) |
| ahisto2 Draw | ( | ) |
| std::cout<<deltat20<<" "<<deltat50<<" "<<deltat80<<std::endl; double sigma_of = of.GetFilteredNoiseRMS(); double sigma_of2 = of2.GetFilteredNoiseRMS(); std::cout<<"Simga OF: "<<sigma_of<<" amp: "<<amp<<std::endl; TH1D* ahisto = new TH1D("ahisto","ahisto",sqrt(Ne),amp*0.2,amp*1.5); TH1D* lhisto = new TH1D("lhisto","lhisto",sqrt(Ne),0,50); TH1D* rhisto = new TH1D("rhisto","rhisto",sqrt(Ne),0,50); TH1D* chisto = new TH1D("chisto","chisto",sqrt(Ne),0,2); TH1D* jhisto = new TH1D("jhisto","jhisto",240,-30,30); TH1D* shisto = new TH1D("shisto","shisto",sqrt(Ne),0,amp); TH1D* ahisto2 = new TH1D("ahisto2","ahisto2",sqrt(Ne),amp*0.2,amp*1.5); TH1D* lhisto2 = new TH1D("lhisto2","lhisto2",sqrt(Ne),0,50); TH1D* rhisto2 = new TH1D("rhisto2","rhisto2",sqrt(Ne),0,50); TH1D* chisto2 = new TH1D("chisto2","chisto2",sqrt(Ne),0,2); TH1D* jhisto2 = new TH1D("jhisto2","jhisto2",50*taur,-5*taur,5*taur); TH1D* shisto2 = new TH1D("shisto2","shisto2",sqrt(Ne),0,amp); TRandom rand; rand.SetSeed(0); int success = 0, success2 = 0; for(int e = 0; e < Ne; e++) { if(e%100 == 0) cout<<"Event: "<<e<<std::endl; double shift=rand.Uniform(-4*taur,4*taur); QVector signal(N),signal2(N); QVector noise(N),noise2(N); signal.Initialize(0); signal2.Initialize(0); noise.Initialize(0); noise2.Initialize(0); for(int i = 0; i < N; i++) { double t = double(i-t0)-shift; noise[i] += rand.Gaus(0,sigma); noise2[i] += rand.Gaus(0,sigma); if(t < 0) continue; signal[i] += (-exp(-t/taur) + exp(-t/taud)); signal2[i] +=(-exp(-t/taur/taur_dev) + exp(-t/taud/taud_dev)); } signal *= amp/signal.GetMax(); signal2 *= amp/signal2.GetMax()/1.15; signal += noise; signal2 += noise2; QError err; err = of.Filter(signal); if(err != QERR_SUCCESS) continue; err = of.SetJitter(QOptimumFilter::J_LOCMAX); if(err != QERR_SUCCESS) continue; double jitter,chi2,amplitude,integral,left,right; err = of.GetInterpolated(jitter,chi2,amplitude,integral,left,right); if(err != QERR_SUCCESS) continue; ahisto-> Fill | ( | amplitude | ) |
| chisto Fill | ( | chi2 | ) |
| shisto Fill | ( | diff/ | cgain | ) |
References QOptimumFilter::GetFilteredShifted(), and of2.
| shisto2 Fill | ( | diff2/ | cgain | ) |
| jhisto Fill | ( | jitter- | shift | ) |
| lhisto Fill | ( | left | ) |
| rhisto Fill | ( | right | ) |
| shisto2 Fit | ( | fg | ) |
| for | ( | int | i = maxpos; i, |
| 0;i-- | |||
| ) |
Definition at line 63 of file CheckOFShape.C.
References ap1filtered2, deltat20, deltat50, deltat80, and maxpos.
| if | ( | err ! | = QERR_SUCCESS | ) |
Definition at line 149 of file CheckOFShape.C.
References QOptimumFilter::GetFilteredShifted(), and of2.
| if | ( | success2 | = = 1 | ) |
Definition at line 191 of file CheckOFShape.C.
References amp, ap, cgain, QOptimumFilter::GetFilteredShifted(), QOptimumFilter::GetFilterTD(), max, of2, ofbase, and t0.
| ap Initialize | ( | 0 | ) |
| gSystem Load | ( | "libbase" | ) |
| gSystem Load | ( | "libcalderdata" | ) |
| gSystem Load | ( | "libcaldertools" | ) |
| gSystem Load | ( | "libcoretools" | ) |
| gSystem Load | ( | "libdbbase" | ) |
| gSystem Load | ( | "libdianadata" | ) |
| gSystem Load | ( | "libglobalrw" | ) |
| gSystem Load | ( | "liboptimumfilter" | ) |
| gSystem Load | ( | "libpq" | ) |
| gSystem Load | ( | "libqroot" | ) |
| gSystem Load | ( | "libqstyle" | ) |
| gSystem Load | ( | "libqstyleloader" | ) |
| gSystem Load | ( | "librundatadb" | ) |
| gSystem Load | ( | "libthreadwrapper" | ) |
| std::cout<<"DP: "<<dp<<std::endl; c1-> SaveAs | ( | "checkof.pdf" | ) |
| ahisto2 SetLineColor | ( | kRed | ) |
| TF1 a |
Definition at line 21 of file CheckOFShape.C.
| double amp = 10 |
Definition at line 33 of file CheckOFShape.C.
Referenced by if().
| ap =max |
Definition at line 47 of file CheckOFShape.C.
Referenced by QOptimumFilter::BuildFilter(), MDecorrelator::Do(), MTutorialAveragePulse::Done(), DrawAveragePulse(), for(), if(), main(), MRootNtpDumper::Open(), and QRootFileWriterBase::Open().
| ap1filtered2 = of2.GetOriginalAveragePulseFilteredShifted() |
Definition at line 52 of file CheckOFShape.C.
Referenced by for().
| int apmaxindex = ap.GetMaxIndex() |
Definition at line 45 of file CheckOFShape.C.
| QVector b |
Definition at line 21 of file CheckOFShape.C.
| double cbase = ap1filtered2.GetMean(t0*3./4) |
Definition at line 53 of file CheckOFShape.C.
| double cgain = ap1filtered2.GetMax()-ap1filtered2.GetMin() |
Definition at line 54 of file CheckOFShape.C.
Referenced by if().
| int deltat20 = maxpos |
Definition at line 62 of file CheckOFShape.C.
Referenced by for().
| int deltat50 = maxpos |
Definition at line 60 of file CheckOFShape.C.
Referenced by for().
| int deltat80 = maxpos |
Definition at line 61 of file CheckOFShape.C.
Referenced by for().
| double diff = of2.GetFilteredShifted()[maxpos+jitter-deltat80]-of2.GetFilteredShifted()[maxpos+jitter-deltat20] |
Definition at line 173 of file CheckOFShape.C.
Referenced by MTestNeighbours::Do(), QOptimumFilter::Filter(), and QTimeNeighbour::GetNeighbourInfo().
| double diff2 = of2.GetFilteredShifted()[maxpos+jitter2-deltat80]-of2.GetFilteredShifted()[maxpos+jitter2-deltat20] |
Definition at line 186 of file CheckOFShape.C.
| err = of.Filter(signal2) |
Definition at line 148 of file CheckOFShape.C.
| TF1* fg = new TF1("fg","gaus") |
Definition at line 246 of file CheckOFShape.C.
| double fs = 1 |
Definition at line 24 of file CheckOFShape.C.
| m1 = fg->GetParameter(1) |
Definition at line 248 of file CheckOFShape.C.
| m2 = fg->GetParameter(1) |
Definition at line 248 of file CheckOFShape.C.
| max = ap.GetMax()-ap[0] |
Definition at line 46 of file CheckOFShape.C.
Referenced by if().
| int maxpos = ap1filtered2.GetMaxIndex() |
Definition at line 59 of file CheckOFShape.C.
Referenced by QPulseTimeConstants::Compute(), MDecorrelator::Do(), for(), QMathFunction::GetMaximum(), and QMultiChannelDecorrelatorOF::Init().
| int N = 2048*fs |
Definition at line 25 of file CheckOFShape.C.
| int Ne = 1e3 |
Definition at line 26 of file CheckOFShape.C.
| QOptimumFilter of(ap, an,-1, false) | ( | ap | , |
| an | , | ||
| - | 1, | ||
| false | |||
| ) |
| QOptimumShapeFilter of2(ap, an,-1, false, 2) | ( | ap | , |
| an | , | ||
| - | 1, | ||
| false | , | ||
| 2 | |||
| ) |
| double ofbase = ap1filtered2.GetMean(3./4*t0) |
Definition at line 56 of file CheckOFShape.C.
Referenced by if().
| s1 = fg->GetParameter(2) |
Definition at line 248 of file CheckOFShape.C.
Referenced by QDianaProcessStatus::QDianaProcessStatus().
| s2 = fg->GetParameter(2) |
Definition at line 248 of file CheckOFShape.C.
| double sigma = 1*sqrt(fs) |
Definition at line 32 of file CheckOFShape.C.
| success2 |
Definition at line 189 of file CheckOFShape.C.
| double t0 = 200*fs |
Definition at line 27 of file CheckOFShape.C.
| double taud = 200*fs |
Definition at line 29 of file CheckOFShape.C.
Referenced by for().
| double taud_dev = 1 |
Definition at line 31 of file CheckOFShape.C.
| double taur = 10*fs |
Definition at line 28 of file CheckOFShape.C.
Referenced by for().
| double taur_dev = 1 |
Definition at line 30 of file CheckOFShape.C.