Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
compare_observables.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file compare_observables.C
1 #include "emid_commons.h"
2 
9 {
10  gStyle->SetOptStat(0);
11 
12  unsigned col_ele = kBlue+2;
13  unsigned col_cpi = kOrange+7;
14 
15  /* open inout files and merge trees */
16  TChain chain("event");
17  chain.Add("eicana_disreco_nc_1k.root");
18 
19  /* Create temporary canvas */
20  TCanvas* ctemp = new TCanvas();
21 
22  vector< TString > observables;
23  vector< TString > observables_name;
24 
25  vector< float > plots_ymax;
26  vector< float > plots_xmin;
27  vector< float > plots_xmax;
28 
29  /* eta_true */
30  observables.push_back( "em_evtgen_eta" );
31  observables_name.push_back( "#eta_{true}" );
32  plots_ymax.push_back(0.3);
33  plots_xmin.push_back(-5.);
34  plots_xmax.push_back(5.);
35 
36  /* em_cluster_eta */
37  observables.push_back( "-1*log(tan(em_cluster_theta/2.0))" );
38  observables_name.push_back( "#eta_{cluster}" );
39  plots_ymax.push_back(0.3);
40  plots_xmin.push_back(-5.);
41  plots_xmax.push_back(5.);
42 
43  /* em_cluster_prob */
44  observables.push_back( "em_cluster_prob" );
45  observables_name.push_back( "em_cluster probablility" );
46  plots_ymax.push_back(0.3);
47  plots_xmin.push_back(0.0);
48  plots_xmax.push_back(1.0);
49 
50  /*E/p*/
51  observables.push_back( "em_cluster_e / em_track_ptotal" );
52  observables_name.push_back( "E/p" );
53  plots_ymax.push_back(0.3);
54  plots_xmin.push_back(0.0);
55  plots_xmax.push_back(100.0);
56 
57  /* Plot distributions */
58  TString name_ele_base("h_ele_");
59  TString name_cpi_base("h_cpi_");
60 
61  for ( unsigned i = 0; i < observables.size(); i++ )
62  {
63  cout << "Plotting " << observables.at(i) << endl;
64 
65  ctemp->cd();
66 
67  TString name_ele_i = name_ele_base;
68  name_ele_i.Append(i);
69 
70  TString name_cpi_i = name_cpi_base;
71  name_cpi_i.Append(i);
72 
73  TH1F* h_ele = new TH1F( name_ele_i, "", 100, plots_xmin.at(i), plots_xmax.at(i));
74  TH1F* h_cpi = new TH1F( name_cpi_i, "", 100, plots_xmin.at(i), plots_xmax.at(i));
75 
76  chain.Draw( observables.at(i) + " >> " + name_ele_i, emid_commons::select_true_ele && emid_commons::select_match, "");
77  h_ele->Scale(1./h_ele->Integral());
78  h_ele->GetXaxis()->SetTitle( observables_name.at(i) );
79  h_ele->GetYaxis()->SetRangeUser(0, plots_ymax.at(i) );
80  h_ele->SetLineColor(col_ele);
81  h_ele->SetFillColor(col_ele);
82  h_ele->SetFillStyle(0);
83 
84  chain.Draw( observables.at(i) + " >> " + name_cpi_i, emid_commons::select_true_cpi && emid_commons::select_match, "");
85  h_cpi->Scale(1./h_cpi->Integral());
86  h_cpi->SetLineColor(col_cpi);
87  h_cpi->SetFillColor(col_cpi);
88  h_cpi->SetFillStyle(1001);
89 
90  /* create Canvas and draw histograms */
91  TCanvas *c1 = new TCanvas();
92 
93  h_ele->DrawClone("");
94  h_cpi->DrawClone("sames");
95  h_ele->DrawClone("sames");
96 
97  gPad->RedrawAxis();
98 
99  c1->Print( Form( "plots/compare_observables_%d.eps", i ) );
100  c1->Print( Form( "plots/compare_observables_%d.png", i ) );
101  }
102 
103  return 0;
104 }