StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFmsCalibMakerQa.cxx
1 #include "StFmsCalibMakerQa.h"
2 ClassImp(StFmsCalibMakerQa);
3 
4 #include <TBranch.h>
5 #include <TH1F.h>
6 #include <TH2F.h>
7 #include <TLeaf.h>
8 #include <TTree.h>
9 
10 using namespace std;
11 
12 //--------------------------------------------------------
13 void StFmsCalibMakerQa::CreateQaHist(int detId, int maxCh)
14 {
15  if (detId == 8) mH1_nEvents = new TH1F("nEvents", ";runNo", 16094000-16066000, 16066000-0.5, 16094000-0.5);
16 
17  mH2_massWide[detId-8] = new TH2F(Form("mass_d%i_wide", detId), ";ch;mass", maxCh,0.5,maxCh+0.5, 100,0.,1.0);
18  mH2_massWide[detId-8]->Sumw2();
19 
20  for (int i=0; i<7; i++)
21  {
22  mH2_massOpenA[detId-8][i] = new TH2F(Form("mass_d%i_openA%i",detId,i), "", 500,0.,0.05, 100,0.,1.);
23  mH2_massOpenA[detId-8][i]->SetTitle(Form("%2.1f < Zgg < %2.1f;openA;mass", 0.1*i, 0.1*(i+1)));
24  mH2_massOpenA[detId-8][i]->Sumw2();
25  }
26 
27  for (int i=0; i<7; i++)
28  {
29  mH2_massPairE[detId-8][i] = new TH2F(Form("mass_d%i_pairE%i",detId,i), "", 1000,0,100, 100,0.,1.);
30  mH2_massPairE[detId-8][i]->SetTitle(Form("%2.1f < Zgg < %2.1f;pairE;mass", 0.1*i, 0.1*(i+1)));
31  mH2_massPairE[detId-8][i]->Sumw2();
32  }
33 
34  for (int i=0; i<7; i++)
35  {
36  const char* Title = (i!=6)?Form("%2i < pair E < %2i", 20+10*i, 20+10*(i+1)):Form("%2i < pair E", 20+10*i);
37  mH2_massZgg[detId-8][i] = new TH2F(Form("mass_d%i_zgg%i",detId,i), "", 100,0,1, 100,0.,1.);
38  mH2_massZgg[detId-8][i]->SetTitle(Title);
39  mH2_massZgg[detId-8][i]->Sumw2();
40  }
41 
42  mH2_pointsEP[detId-8] = new TH2F(Form("pointsEP_d%i", detId), ";eta;phi", 72,2.5,4.3, 120,-M_PI,M_PI);
43  mH2_pointsEP[detId-8]->Sumw2();
44 
45  if (detId == 11)
46  {
47  for (int i=0; i<2; i++) //Point 0 or 1
48  for (int j=0; j<3; j++) //All, Large, and Small
49  {
50  const int tBin = (j<2)?210:110;
51  const float tEnd = (float)tBin/2;
52  mH2_pointsXY[i][j] = new TH2F(Form("point%iXY_%i", i, j), ";X;Y", tBin,-tEnd,tEnd, tBin,-tEnd,tEnd);
53  mH2_pointsXY[i][j]->SetTitle(Form("Point %i", i));
54  mH2_pointsXY[i][j]->Sumw2();
55  }
56  }
57 
58  return;
59 }//CreateQaHist
60 
61 //-----------------------------------------------------------------------
62 void StFmsCalibMakerQa::CreateQaHistAdc(int detId, int maxCh, int trigId)
63 {
64  if (detId == 8) mH1_trig = new TH1F("trig", ";TrigId", 1000, trigId-500, trigId+500);
65 
66  mH2_adc[detId-8] = new TH2F(Form("adc_d%i", detId), "", maxCh,0.5,maxCh+0.5, 250,0,250);
67  mH2_adc[detId-8]->SetTitle(Form("detId=%i, Triggered by %i;ch;adc", detId, trigId));
68  mH2_adc[detId-8]->Sumw2();
69 
70  mH2_adcWide[detId-8] = new TH2F(Form("adc_d%i_wide", detId), "", maxCh,0.5,maxCh+0.5, 5000,0,5000);
71  mH2_adcWide[detId-8]->SetTitle(Form("detId=%i, Triggered by %i, extended range;ch;adc", detId, trigId));
72  mH2_adcWide[detId-8]->Sumw2();
73 
74  return;
75 }//CreateQaHistAdc
76 
77 //--------------------------------------------
78 void StFmsCalibMakerQa::CreateQaHistZVtx(void)
79 {
80  mH1_bbcZ = new TH1F("bbcZ", "Bbc slewing corrected;bbcZ", 1000, -250, 250);
81  mH1_bbcZ->Sumw2();
82  mH1_diffMass = new TH1F("diff_mass", ";#DeltaMass (default - corr))", 800, -0.2, 0.2);
83  mH1_diffMass->Sumw2();
84  mH1_diffOpenA = new TH1F("diff_openA", ";#DeltaOpenA (default - corr)", 800, -0.04, 0.04);
85  mH1_diffOpenA->Sumw2();
86 
87  return;
88 }//CreateQaHistZVtx
89 
90 //----------------------------------------
91 void StFmsCalibMakerQa::CreateQaTree(void)
92 {
93  cout <<Form("\nCreating a tree for QA: large disk space will be used...") <<endl;
94 
95  int iLeaf = 0;
96  T = new TTree("T", "QA tree for StFmsCalibMaker");
97 
98  T->Branch("hits", 0, "nHit/s:detId[nHit]/s:ch[nHit]/s:pointB[nHit]/s:hitE[nHit]/F");
99  ((TLeaf*)T->GetBranch("hits")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mNhit); iLeaf++;
100  ((TLeaf*)T->GetBranch("hits")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mDetId); iLeaf++;
101  ((TLeaf*)T->GetBranch("hits")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mCh); iLeaf++;
102  ((TLeaf*)T->GetBranch("hits")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mPointB); iLeaf++;
103  ((TLeaf*)T->GetBranch("hits")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mHitE); iLeaf=0;
104 
105  T->Branch("clusters", 0, "cluTowers[2]/s:cluMax[2]/F:cluMin[2]/F:cluX[2]/F:cluY[2]/F");
106  ((TLeaf*)T->GetBranch("clusters")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mCluTowers); iLeaf++;
107  ((TLeaf*)T->GetBranch("clusters")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mCluMax); iLeaf++;
108  ((TLeaf*)T->GetBranch("clusters")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mCluMin); iLeaf++;
109  ((TLeaf*)T->GetBranch("clusters")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mCluX); iLeaf++;
110  ((TLeaf*)T->GetBranch("clusters")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mCluY); iLeaf=0;
111 
112  T->Branch("points", 0, "pointE[2]/F:pointX[2]/F:pointY[2]/F");
113  ((TLeaf*)T->GetBranch("points")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mPointE); iLeaf++;
114  ((TLeaf*)T->GetBranch("points")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mPointX); iLeaf++;
115  ((TLeaf*)T->GetBranch("points")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mPointY); iLeaf=0;
116 
117  T->Branch("pair", 0, "mass/F:openA/F:zgg/F");
118  ((TLeaf*)T->GetBranch("pair")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mMass); iLeaf++;
119  ((TLeaf*)T->GetBranch("pair")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mOpenA); iLeaf++;
120  ((TLeaf*)T->GetBranch("pair")->GetListOfLeaves()->At(iLeaf))->SetAddress(&mZgg); iLeaf=0;
121 
122  T->Branch("trig", &mTrigBit, "trig/I");
123 
124  ResetQaTree();
125  return;
126 }//CreateQaTree
127 
128 //---------------------------------------
129 void StFmsCalibMakerQa::ResetQaTree(void)
130 {
131  mNhit = 0;
132  for (int i=0; i<mNhitMax; i++)
133  {
134  mDetId[i] = -999;
135  mCh[i] = -999;
136  mPointB[i] = -999;
137  mHitE[i] = -999.;
138  }
139 
140  for (int i=0; i<2; i++)
141  {
142  mCluTowers[i] = -999;
143  mCluMax[i] = -999.;
144  mCluMin[i] = -999.;
145  mCluX[i] = -999.;
146  mCluY[i] = -999.;
147 
148  mPointE[i] = -999.;
149  mPointX[i] = -999.;
150  mPointY[i] = -999.;
151  }
152 
153  mMass = -999.;
154  mOpenA = -999.;
155  mZgg = -999.;
156 
157  mTrigBit = -999;
158 
159  return;
160 }//ResetQaTree