ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scan_mom.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file scan_mom.C
1 #include "prttools.C"
2 #include "DrcPidFast.cxx"
3 
4 void scan_mom(int pdg = 211, double mom = 6) {
5 
6  DrcPidFast pid(0);
7 
8 
9  TH1F *hPi = new TH1F("hPi", ";#Delta Ln;entries", 200, -50, 50);
10  TH1F *hK = new TH1F("hK", ";#Delta Ln;entries", 200, -50, 50);
11  TGraphAsymmErrors *gmom = new TGraphAsymmErrors();
12 
14 
15  int id = 0;
16  for (double m = 0.5; m <= 3.1; m += 0.1) {
17  TVector3 momentum(0, 0, m);
18  momentum.RotateX(30 / 180. * TMath::Pi());
19 
20  for (int i = 0; i < 1000; i++) {
21  info = pid.GetInfo(pdg, momentum, 0.5);
22  hPi->Fill(info.sigma[2]);
23  hK->Fill(info.sigma[0]);
24  }
25 
26  auto r1 = hPi->Fit("gaus", "SQ0");
27  double m1 = r1->Parameter(1);
28  double s1 = r1->Parameter(2);
29  double dm1 = r1->ParError(1);
30  double ds1 = r1->ParError(2);
31 
32  auto r2 = hK->Fit("gaus", "SQ0");
33  double m2 = r2->Parameter(1);
34  double s2 = r2->Parameter(2);
35  double dm2 = r2->ParError(1);
36  double ds2 = r2->ParError(2);
37 
38  double sep = (fabs(m1 - m2)) / (0.5 * (s1 + s2));
39  double e1, e2, e3, e4;
40  e1 = 2 / (s1 + s2) * dm1;
41  e2 = -2 / (s1 + s2) * dm2;
42  e3 = -2 * (m1 - m2) / ((s1 + s2) * (s1 + s2)) * ds1;
43  e4 = -2 * (m1 - m2) / ((s1 + s2) * (s1 + s2)) * ds2;
44  double esep = sqrt(e1 * e1 + e2 * e2 + e3 * e3 + e4 * e4) + 0.1;
45 
46  gmom->SetPoint(id, m, sep);
47  gmom->SetPointEYhigh(id, esep);
48  gmom->SetPointEYlow(id, esep);
49  id++;
50 
51  std::cout << "separation " << sep << " +/- " << esep << std::endl;
52  hPi->Reset();
53  hK->Reset();
54  }
55 
56  prt_canvasAdd("mom", 800, 500);
57  gmom->SetMarkerStyle(20);
58  gmom->SetMarkerSize(0.75);
59  gmom->GetXaxis()->SetTitle("momentum [GeV/c]");
60  gmom->GetYaxis()->SetTitle("separation [s.d.]");
61  gmom->GetXaxis()->SetLimits(0.3, 3.2);
62  gmom->GetXaxis()->SetRangeUser(0.3, 3.2);
63  gmom->GetYaxis()->SetRangeUser(0, 14);
64 
65  gmom->Draw("APL");
66 
67  prt_savepath = "data/scan_mom";
68  prt_canvasSave(2);
69 }