source: fact/tools/rootmacros/FPedestal.c@ 13596

Last change on this file since 13596 was 12166, checked in by neise, 13 years ago
initial commit
File size: 1.5 KB
Line 
1#include <cstdio>
2int FPedestal(char *title_base, fits &datafile, vector<int16_t> &data, vector<int16_t> &data_offset, vector<float> &drs_basemean, vector<float> &drs_gainmean, vector<float> &drs_triggeroffsetmean, UInt_t data_roi, size_t pixelnr, float &pedestal_mean, float &pedestal_rms)
3{
4// TCanvas *canv_base = new TCanvas( "canv_base", "Determine the baseline", 100, 520, 700, 500 );
5 TH1F *baseline = new TH1F("baseline", title_base, 1000,-10,40);
6// canv_base->SetLogy();
7 baseline->GetXaxis()->SetTitle("Sample value (mV)");
8 baseline->GetYaxis()->SetTitle("Entries");
9
10//-------------------------------------------
11//Find the baseline
12//-------------------------------------------
13 for (size_t i=0; i<datafile.GetNumRows(); i++)
14 {
15 datafile.GetRow(i);
16
17 //Iterate over the slices
18 for (UInt_t k=0; k<data_roi; k++)
19 {
20 UInt_t drs_calib_offset = (k+data_offset[pixelnr])%data_roi;
21 float sample = (data[pixelnr*data_roi+k]*2000/4096.-drs_basemean[pixelnr*data_roi+drs_calib_offset]-drs_triggeroffsetmean[pixelnr*data_roi+k])/drs_gainmean[pixelnr*data_roi+drs_calib_offset]*1907.35;
22 baseline->Fill(sample);
23 }
24 }
25 pedestal_mean = baseline->GetXaxis()->GetBinCenter(baseline->GetMaximumBin());
26 pedestal_rms = baseline->GetRMS();
27 std::cout << "Value of maximal probability: " << pedestal_mean << " +- " << pedestal_rms << std::endl;
28
29// canv_base->cd();
30// baseline->Draw();
31// canv_base->Modified();
32// canv_base->Update();
33
34 return 0;
35}
Note: See TracBrowser for help on using the repository browser.