Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FillRawHist.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FillRawHist.C
1 
2 // FillRawHist.C //
4 
5 // This makes a histogram that can show the raw hits.
6 
7 #include "FillRawHist.h"
8 #include "TF1.h"
9 #include "TH2D.h"
10 #include "AZigzag.h"
11 
12 #include "ATrace.h"
13 #include "groot.h"
14 
15 #include <iostream>
16 
17 TH2D* RawHist=0;
18 TH1D* RawDist[Nsrs];
19 
20 using namespace std;
21 
23 {
24 
25  int nTime = AZigzag::Raw[0].size();
26  double left = -0.5;
27  double right = (double)nTime - 0.5;
28 
29 
30  // NOTE: Raw is the histogram into which we place the raw data.
31  // but AZigzag::Raw is the raw data itsChi.
32 
33 
34  if (!RawHist)
35  {
36  RawHist = new TH2D("RawHist","RawHist",Nsrs,-0.5,((float)Nsrs-0.5),nTime,left,right);
37  cout << "Making the Raw histogram" << endl;
38 
39  char name[500];
40  for (int i=0; i<Nsrs; i++)
41  {
42  sprintf(name,"RawDist%04d",i);
43  RawDist[i] = new TH1D(name,name,2001,1999.5,4000.5);
44  }
45  }
46 
47  RawHist->Reset();
48 
49  for (int i=0; i<Nsrs; i++)
50  {
51  for (int j=0; j<AZigzag::Raw[i].size(); j++)
52  {
53  RawHist->SetBinContent(i+1,j+1,AZigzag::Raw[i][j]);
54  RawDist[i]->Fill(AZigzag::Raw[i][j]);
55  }
56  }
57 
58 }
59 
61 {
62  for (int i=0; i<Nsrs; i++)
63  {
64  RawDist[i]->Fit("gaus","Q");
65  AZigzag::Pedestals[i] = RawDist[i]->GetFunction("gaus")->GetParameter(1);
66  AZigzag::Sigmas[i] = RawDist[i]->GetFunction("gaus")->GetParameter(2);
67  AZigzag::Gains[i] = 1.0;
68  }
69 }