Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
eicsmear_dvmp_plot2.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file eicsmear_dvmp_plot2.C
1 #include <vector>
3 {
4 
5  /* PRELIMINARY ROOT STUFF */
6  /*gSystem->Load("libeicsmear");
7  gROOT->LoadMacro("/sphenix/user/gregtom3/SBU/research/macros/macros/sPHENIXStyle/sPhenixStyle.C");
8  SetsPhenixStyle();*/
9 
10 
11  /* Open TFile */
12  TFile *input = new TFile("/sphenix/user/gregtom3/data/Fall2018/JPsi_reco_studies/theEvents.root","READ");
13 
14  /* Open TTree in TFile */
15  TTree *t = (TTree*)input->Get("Tree");
16  TH1F *h1_p_1 = new TH1F("h1_p_1","h1_p_1",100,-4,4);
17  TH1F *h1_p_2 = new TH1F("h1_p_2","h1_p_2",100,0,50);
18  TH1F *h1_p_3 = new TH1F("h1_p_3","h1_p_3",100,0,50);
19  TH1F *h1_p_4 = new TH1F("h1_p_4","h1_p_4",100,0,50);
20  TH2F* h2_p = new TH2F("h2_p","h2_p",200,-6,6,200,0,2);
21  //BinLogX(h2_p);
22  BinLogY(h2_p);
23 
24  // t->Draw("2*18*se_p_truth*(1-cos(3.14159265-2*atan(exp(-se_eta_truth)))):2*275*sp_p_truth*(1-cos(2*atan(exp(-sp_eta_truth))))>>h2_p","jpsi_eta_truth>4","colz");
25  // t->Draw("sqrt(jpsi_px_reco*jpsi_px_reco+jpsi_py_reco*jpsi_py_reco+jpsi_pz_reco*jpsi_pz_reco):jpsi_eta_reco>>h2_p","","colz");
26 
27  // t->Draw("se_eta_truth>>h1_p_1","(se_eta_reco!=0&&de_eta_reco!=0&&dp_eta_reco!=0)");
28 
29  // X - Q2 PLOT //
30  //t->Draw("2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco)))):2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco))))/(4*18*275*(1-(se_p_reco/18)+(2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco))))/(4*18*18))))>>h2_p","","colz");
31  // gPad->SetLogx();
32  //gPad->SetLogy();
33  t->Draw("2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco)))):jpsi_eta_reco>>h2_p","sp_p_truth>274","colz");
34  h2_p->SetTitle("x vs. Q2 (18x275 Sartre DVMP Reco)");
35  h2_p->GetXaxis()->SetTitle("Reco x");
36  h2_p->GetYaxis()->SetTitle("Reco Q2");
37 
38 }
39 
40 void BinLogY(TH2F*h)
41 {
42 
43  TAxis *axis = h->GetYaxis();
44  int bins = axis->GetNbins();
45 
46  Axis_t from = axis->GetXmin();
47  Axis_t to = axis->GetXmax();
48  Axis_t width = (to - from) / bins;
49  Axis_t *new_bins = new Axis_t[bins + 1];
50 
51  for (int i = 0; i <= bins; i++) {
52  new_bins[i] = TMath::Power(10, from + i * width);
53  }
54  axis->Set(bins, new_bins);
55  delete new_bins;
56 }
57 
58 void BinLogX(TH2F*h)
59 {
60 
61  TAxis *axis = h->GetXaxis();
62  int bins = axis->GetNbins();
63 
64  Axis_t from = axis->GetXmin();
65  Axis_t to = axis->GetXmax();
66  Axis_t width = (to - from) / bins;
67  Axis_t *new_bins = new Axis_t[bins + 1];
68 
69  for (int i = 0; i <= bins; i++) {
70  new_bins[i] = TMath::Power(10, from + i * width);
71  }
72  axis->Set(bins, new_bins);
73  delete new_bins;
74 }