Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistMacro_TOFReconstruction_p1.C
Go to the documentation of this file.
1 // hnamepath: /Independent/Hist_Reconstruction/TOFPointYVsX
2 // hnamepath: /Independent/Hist_Reconstruction/TOFPointEnergy
3 // hnamepath: /Independent/Hist_DetectorPID/TOF/dEdXVsP_q-
4 // hnamepath: /Independent/Hist_DetectorPID/TOF/dEdXVsP_q+
5 // hnamepath: /Independent/Hist_DetectorPID/TOF/BetaVsP_q-
6 // hnamepath: /Independent/Hist_DetectorPID/TOF/BetaVsP_q+
7 
8 {
9  //Goto Path
10  TDirectory *locDirectory = (TDirectory*)gDirectory->FindObjectAny("Hist_Reconstruction");
11  if(!locDirectory)
12  return;
13  locDirectory->cd();
14 
15  //Get Histograms
16  TH2I* locHist_TOFPointYVsX = (TH2I*)gDirectory->Get("TOFPointYVsX");
17  TH1I* locHist_TOFPointEnergy = (TH1I*)gDirectory->Get("TOFPointEnergy");
18 
19  gDirectory->cd("../Hist_DetectorPID/TOF");
20  TH2I* locHist_TOFdEdXVsP_QMinus = (TH2I*)gDirectory->Get("dEdXVsP_q-"); //q-
21  TH2I* locHist_BetaVsP_QMinus = (TH2I*)gDirectory->Get("BetaVsP_q-"); //q-
22  TH2I* locHist_TOFdEdXVsP_QPlus = (TH2I*)gDirectory->Get("dEdXVsP_q+"); //q+
23  TH2I* locHist_BetaVsP_QPlus = (TH2I*)gDirectory->Get("BetaVsP_q+"); //q+
24 
25  //Beta-vs-p functions
26  TF1* locBetaVsPFunc_Proton = new TF1("BetaVsPFunc_Proton", "x/sqrt(x*x + [0]*[0])", 0.0, 12.0);
27  locBetaVsPFunc_Proton->SetParameter(0, 0.938272046);
28  locBetaVsPFunc_Proton->SetLineWidth(2);
29  locBetaVsPFunc_Proton->SetLineColor(kBlack);
30  locBetaVsPFunc_Proton->SetNpx(1000);
31 
32  TF1* locBetaVsPFunc_Kaon = new TF1("BetaVsPFunc_Kaon", "x/sqrt(x*x + [0]*[0])", 0.0, 12.0);
33  locBetaVsPFunc_Kaon->SetParameter(0, 0.493677);
34  locBetaVsPFunc_Kaon->SetLineWidth(2);
35  locBetaVsPFunc_Kaon->SetLineColor(kBlack);
36  locBetaVsPFunc_Kaon->SetNpx(1000);
37 
38  TF1* locBetaVsPFunc_Pion = new TF1("BetaVsPFunc_Pion", "x/sqrt(x*x + [0]*[0])", 0.0, 12.0);
39  locBetaVsPFunc_Pion->SetParameter(0, 0.13957018);
40  locBetaVsPFunc_Pion->SetLineWidth(2);
41  locBetaVsPFunc_Pion->SetLineColor(kBlack);
42  locBetaVsPFunc_Pion->SetNpx(1000);
43 
44  //Get/Make Canvas
45  TCanvas *locCanvas = NULL;
46  if(TVirtualPad::Pad() == NULL)
47  locCanvas = new TCanvas("TOFReconstruction_p1", "TOFReconstruction_p1", 1200, 800); //for testing
48  else
49  locCanvas = gPad->GetCanvas();
50  locCanvas->Divide(3, 2);
51 
52  //Draw
53  locCanvas->cd(1);
54  gPad->SetTicks();
55  gPad->SetGrid();
56  if(locHist_TOFPointYVsX != NULL)
57  {
58  locHist_TOFPointYVsX->GetXaxis()->SetTitleSize(0.05);
59  locHist_TOFPointYVsX->GetYaxis()->SetTitleSize(0.05);
60  locHist_TOFPointYVsX->GetXaxis()->SetLabelSize(0.05);
61  locHist_TOFPointYVsX->GetYaxis()->SetLabelSize(0.05);
62  locHist_TOFPointYVsX->Draw("COLZ");
63  gPad->SetLogz();
64  }
65 
66  locCanvas->cd(4);
67  gPad->SetTicks();
68  gPad->SetGrid();
69  if(locHist_TOFPointEnergy != NULL)
70  {
71  locHist_TOFPointEnergy->GetXaxis()->SetTitleSize(0.05);
72  locHist_TOFPointEnergy->GetXaxis()->SetLabelSize(0.05);
73  locHist_TOFPointEnergy->GetYaxis()->SetLabelSize(0.05);
74  locHist_TOFPointEnergy->Draw();
75  }
76 
77  locCanvas->cd(2);
78  gPad->SetTicks();
79  gPad->SetGrid();
80  if(locHist_TOFdEdXVsP_QPlus != NULL)
81  {
82  locHist_TOFdEdXVsP_QPlus->GetXaxis()->SetRangeUser(0.0, 6.0);
83  locHist_TOFdEdXVsP_QPlus->GetXaxis()->SetTitleSize(0.05);
84  locHist_TOFdEdXVsP_QPlus->GetYaxis()->SetTitleSize(0.05);
85  locHist_TOFdEdXVsP_QPlus->GetXaxis()->SetLabelSize(0.05);
86  locHist_TOFdEdXVsP_QPlus->GetYaxis()->SetLabelSize(0.05);
87  locHist_TOFdEdXVsP_QPlus->Draw("COLZ");
88  }
89 
90  locCanvas->cd(5);
91  gPad->SetTicks();
92  gPad->SetGrid();
93  if(locHist_TOFdEdXVsP_QMinus != NULL)
94  {
95  locHist_TOFdEdXVsP_QMinus->GetXaxis()->SetRangeUser(0.0, 6.0);
96  locHist_TOFdEdXVsP_QMinus->GetXaxis()->SetTitleSize(0.05);
97  locHist_TOFdEdXVsP_QMinus->GetYaxis()->SetTitleSize(0.05);
98  locHist_TOFdEdXVsP_QMinus->GetXaxis()->SetLabelSize(0.05);
99  locHist_TOFdEdXVsP_QMinus->GetYaxis()->SetLabelSize(0.05);
100  locHist_TOFdEdXVsP_QMinus->Draw("COLZ");
101  }
102 
103  locCanvas->cd(3);
104  gPad->SetTicks();
105  gPad->SetGrid();
106  if(locHist_BetaVsP_QPlus != NULL)
107  {
108  locHist_BetaVsP_QPlus->GetXaxis()->SetRangeUser(0.0, 6.0);
109  locHist_BetaVsP_QPlus->GetXaxis()->SetTitleSize(0.05);
110  locHist_BetaVsP_QPlus->GetYaxis()->SetTitleSize(0.05);
111  locHist_BetaVsP_QPlus->GetXaxis()->SetLabelSize(0.05);
112  locHist_BetaVsP_QPlus->GetYaxis()->SetLabelSize(0.05);
113  locHist_BetaVsP_QPlus->GetListOfFunctions()->Add(locBetaVsPFunc_Proton);
114  locHist_BetaVsP_QPlus->GetListOfFunctions()->Add(locBetaVsPFunc_Kaon);
115  locHist_BetaVsP_QPlus->GetListOfFunctions()->Add(locBetaVsPFunc_Pion);
116  locHist_BetaVsP_QPlus->Draw("COLZ");
117  gPad->SetLogz();
118  }
119 
120  locCanvas->cd(6);
121  gPad->SetTicks();
122  gPad->SetGrid();
123  if(locHist_BetaVsP_QMinus != NULL)
124  {
125  locHist_BetaVsP_QMinus->GetXaxis()->SetRangeUser(0.0, 6.0);
126  locHist_BetaVsP_QMinus->GetXaxis()->SetTitleSize(0.05);
127  locHist_BetaVsP_QMinus->GetYaxis()->SetTitleSize(0.05);
128  locHist_BetaVsP_QMinus->GetXaxis()->SetLabelSize(0.05);
129  locHist_BetaVsP_QMinus->GetYaxis()->SetLabelSize(0.05);
130  locHist_BetaVsP_QMinus->GetListOfFunctions()->Add(locBetaVsPFunc_Pion);
131  locHist_BetaVsP_QMinus->GetListOfFunctions()->Add(locBetaVsPFunc_Kaon);
132  locHist_BetaVsP_QMinus->Draw("COLZ");
133  gPad->SetLogz();
134  }
135 }
136 
TH2I * locHist_BetaVsP_QPlus
TH2I * locHist_TOFdEdXVsP_QPlus
TF1 * locBetaVsPFunc_Kaon
TDirectory * locDirectory
TH2I * locHist_TOFdEdXVsP_QMinus
TH1I * locHist_TOFPointEnergy
TH2I * locHist_BetaVsP_QMinus
TH2I * locHist_TOFPointYVsX
TF1 * locBetaVsPFunc_Proton
TCanvas * locCanvas
TF1 * locBetaVsPFunc_Pion