ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dRICH.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file dRICH.C
1 #include "dualRICH.h"
2 
3 int particleAngle = 15; // [deg]
4 bool thresholdMode = false;
5 double nsigma = 3.;
6 
7 void
9 {
10 
11  std::vector<PID *> pidDetectors;
12  std::vector<int> fillStyle;
13 
15  auto aerogel = new dualRICH_aerogel();
16  aerogel->setThresholdMode(thresholdMode);
17  pidDetectors.push_back(aerogel);
18  fillStyle.push_back(3004);
19 
21  auto gas = new dualRICH_C2F6();
22  gas->setThresholdMode(thresholdMode);
23  pidDetectors.push_back(gas);
24  fillStyle.push_back(3004);
25 
28  auto hNSigmaKpi_aerogel = new TH1F("hNSigmaKpi_aerogel", ";p (GeV/c);", 2000, 0., 200.);
29  hNSigmaKpi_aerogel->SetLineColor(kAzure-3);
30  hNSigmaKpi_aerogel->SetLineStyle(kSolid);
31  hNSigmaKpi_aerogel->SetLineWidth(2);
32 
33  auto hNSigmaKpi_gas = new TH1F("hNSigmaKpi_gas", ";p (GeV/c);", 2000, 0., 200.);
34  hNSigmaKpi_gas->SetLineColor(kAzure-3);
35  hNSigmaKpi_gas->SetLineStyle(kDashed);
36  hNSigmaKpi_gas->SetLineWidth(2);
37 
38  auto hNSigmaKp_aerogel = new TH1F("hNSigmaKp_aerogel", ";p (GeV/c);", 2000, 0., 200.);
39  hNSigmaKp_aerogel->SetLineColor(kRed+1);
40  hNSigmaKp_aerogel->SetLineStyle(kSolid);
41  hNSigmaKp_aerogel->SetLineWidth(2);
42 
43  auto hNSigmaKp_gas = new TH1F("hNSigmaKp_gas", ";p (GeV/c);", 2000, 0., 200.);
44  hNSigmaKp_gas->SetLineColor(kRed+1);
45  hNSigmaKp_gas->SetLineStyle(kDashed);
46  hNSigmaKp_gas->SetLineWidth(2);
47 
48  auto particleEta = -log(tan(particleAngle * 0.017453293 * 0.5));
49  for (int i = 0; i < hNSigmaKpi_aerogel->GetNbinsX(); ++i) {
50  auto p = hNSigmaKpi_aerogel->GetBinCenter(i + 1);
51  hNSigmaKpi_aerogel->SetBinContent(i + 1, aerogel->numSigma(particleEta, p, PID::pi_k));
52  hNSigmaKpi_gas->SetBinContent(i + 1, gas->numSigma(particleEta, p, PID::pi_k));
53  hNSigmaKp_aerogel->SetBinContent(i + 1, aerogel->numSigma(particleEta, p, PID::k_p));
54  hNSigmaKp_gas->SetBinContent(i + 1, gas->numSigma(particleEta, p, PID::k_p));
55  }
56 
57  TLine line;
58  line.SetLineColor(kBlack);
59  line.SetLineWidth(1);
60  line.SetLineStyle(7);
61 
62  TLatex latex;
63  latex.SetNDC(kTRUE);
64  latex.SetTextSize(0.05);
65  latex.SetTextAlign(31);
66 
67  auto s = new TCanvas("s", "s", 1600, 800);
68  s->cd(1)->Divide(2, 1);
69 
70  s->cd(1)->DrawFrame(0., 0.2, 100., 200., ";#it{p} (GeV/#it{c});n#sigma_{K#pi}");
71  line.DrawLine(0.0, 3., 100., 3.);
72  s->cd(1)->SetLogy();
73  hNSigmaKpi_aerogel->Draw("same,l");
74  hNSigmaKpi_gas->Draw("same,l");
75  latex.DrawLatex(0.88, 0.85, Form("#vartheta_{track} = %d#circ", particleAngle));
76 
77  s->cd(2)->DrawFrame(0., 0.2, 100., 200., ";#it{p} (GeV/#it{c});n#sigma_{pK}");
78  line.DrawLine(0.0, 3., 100., 3.);
79  s->cd(2)->SetLogy();
80  hNSigmaKp_aerogel->Draw("same,l");
81  hNSigmaKp_gas->Draw("same,l");
82  latex.DrawLatex(0.88, 0.85, Form("#vartheta_{track} = %d#circ", particleAngle));
83 
84  s->SaveAs(Form("dRICH.separation.%ddeg.png", particleAngle));
85 
88  std::vector<double> etaf, etab;
89  for (double eta = -6.; eta <= 6.; eta += 0.1)
90  etaf.push_back(eta);
91  etab = etaf;
92  std::reverse(std::begin(etab), std::end(etab));
93 
94  auto c = new TCanvas("c", "c", 1600, 800);
95  c->Divide(2, 1);
96 
97  c->cd(1)->DrawFrame(-2.0, 0.1, 5.0, 150.0, ";#eta;#it{p} (GeV/#it{c})");
98  c->cd(1)->SetLogy();
99  auto kapi_legend = new TLegend(0.2, 0.2, 0.5, 0.4);
100  kapi_legend->SetBorderSize(0);
101  for (int idet = 0; idet < pidDetectors.size(); ++idet) {
102 
103  auto poly = new TPolyLine();
104  poly->SetLineColor(kAzure-3);
105  poly->SetLineStyle(kSolid);
106  poly->SetLineWidth(1);
107  poly->SetFillColor(kAzure-3);
108  poly->SetFillStyle(fillStyle[idet]);
109 
110  for (auto eta : etaf) {
111  if (!pidDetectors[idet]->valid(eta, 1.e6)) continue;
112  poly->SetNextPoint(eta, pidDetectors[idet]->minP(eta, nsigma, PID::pi_k));
113  }
114  for (auto eta : etab) {
115  if (!pidDetectors[idet]->valid(eta, 1.e6)) continue;
116  poly->SetNextPoint(eta, pidDetectors[idet]->maxP(eta, nsigma, PID::pi_k));
117  }
118  poly->SetNextPoint(poly->GetX()[0], poly->GetY()[0]);
119  c->cd(1);
120  poly->Draw();
121  poly->Draw("f");
122 
123  kapi_legend->AddEntry(poly, pidDetectors[idet]->name().c_str(), "f");
124  }
125  kapi_legend->SetHeader(Form("K/#pi %.0f#sigma separation", nsigma));
126  kapi_legend->Draw("same");
127 
128 
129  c->cd(2)->DrawFrame(-2.0, 0.1, 5.0, 150.0, ";#eta;#it{p} (GeV/#it{c})");
130  c->cd(2)->SetLogy();
131  auto prka_legend = new TLegend(0.2, 0.2, 0.5, 0.4);
132  prka_legend->SetBorderSize(0);
133  for (int idet = 0; idet < pidDetectors.size(); ++idet) {
134 
135  auto poly = new TPolyLine();
136  poly->SetLineColor(kRed+1);
137  poly->SetLineStyle(kSolid);
138  poly->SetLineWidth(1);
139  poly->SetFillColor(kRed+1);
140  poly->SetFillStyle(fillStyle[idet]);
141 
142  for (auto eta : etaf) {
143  if (!pidDetectors[idet]->valid(eta, 1.e6)) continue;
144  poly->SetNextPoint(eta, pidDetectors[idet]->minP(eta, nsigma, PID::k_p));
145  }
146  for (auto eta : etab) {
147  if (!pidDetectors[idet]->valid(eta, 1.e6)) continue;
148  poly->SetNextPoint(eta, pidDetectors[idet]->maxP(eta, nsigma, PID::k_p));
149  }
150  poly->SetNextPoint(poly->GetX()[0], poly->GetY()[0]);
151  c->cd(2);
152  poly->Draw();
153  poly->Draw("f");
154 
155  prka_legend->AddEntry(poly, pidDetectors[idet]->name().c_str(), "f");
156  }
157  prka_legend->SetHeader(Form("p/K %.0f#sigma separation", nsigma));
158  prka_legend->Draw("same");
159 
160  c->SaveAs("dRICH.png");
161 
162 }