File indexing completed on 2025-08-05 08:15:11
0001
0002
0003
0004
0005
0006
0007 #include "FillRawHist.h"
0008 #include "TF1.h"
0009 #include "TH2D.h"
0010 #include "AZigzag.h"
0011
0012 #include "ATrace.h"
0013 #include "groot.h"
0014
0015 #include <iostream>
0016
0017 TH2D* RawHist=0;
0018 TH1D* RawDist[Nsrs];
0019
0020 using namespace std;
0021
0022 void FillRawHist()
0023 {
0024
0025 int nTime = AZigzag::Raw[0].size();
0026 double left = -0.5;
0027 double right = (double)nTime - 0.5;
0028
0029
0030
0031
0032
0033
0034 if (!RawHist)
0035 {
0036 RawHist = new TH2D("RawHist","RawHist",Nsrs,-0.5,((float)Nsrs-0.5),nTime,left,right);
0037 cout << "Making the Raw histogram" << endl;
0038
0039 char name[500];
0040 for (int i=0; i<Nsrs; i++)
0041 {
0042 sprintf(name,"RawDist%04d",i);
0043 RawDist[i] = new TH1D(name,name,2001,1999.5,4000.5);
0044 }
0045 }
0046
0047 RawHist->Reset();
0048
0049 for (int i=0; i<Nsrs; i++)
0050 {
0051 for (int j=0; j<AZigzag::Raw[i].size(); j++)
0052 {
0053 RawHist->SetBinContent(i+1,j+1,AZigzag::Raw[i][j]);
0054 RawDist[i]->Fill(AZigzag::Raw[i][j]);
0055 }
0056 }
0057
0058 }
0059
0060 void FitPedestals()
0061 {
0062 for (int i=0; i<Nsrs; i++)
0063 {
0064 RawDist[i]->Fit("gaus","Q");
0065 AZigzag::Pedestals[i] = RawDist[i]->GetFunction("gaus")->GetParameter(1);
0066 AZigzag::Sigmas[i] = RawDist[i]->GetFunction("gaus")->GetParameter(2);
0067 AZigzag::Gains[i] = 1.0;
0068 }
0069 }