Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
true_kinematics.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file true_kinematics.C
1 
8 {
9  gStyle->SetOptStat(0);
10 
11  unsigned col1 = kOrange+7;
12  unsigned col2 = kBlue+2;
13 
14  /* open inout files and merge trees */
15  TChain chain("ntp_event");
16  chain.Add("data_3pions/p250_e20_0events_file1093_LeptoAna_TruthEvent.root");
17  chain.Add("data_3pions/p250_e20_0events_file1096_LeptoAna_TruthEvent.root");
18  chain.Add("data_3pions/p250_e20_0events_file1101_LeptoAna_TruthEvent.root");
19  chain.Add("data_3pions/p250_e20_0events_file1115_LeptoAna_TruthEvent.root");
20  chain.Add("data_3pions/p250_e20_0events_file1122_LeptoAna_TruthEvent.root");
21  chain.Add("data_3pions/p250_e20_0events_file1127_LeptoAna_TruthEvent.root");
22  chain.Add("data_3pions/p250_e20_0events_file1131_LeptoAna_TruthEvent.root");
23  chain.Add("data_3pions/p250_e20_0events_file1164_LeptoAna_TruthEvent.root");
24 
25  TH2F* h2_tau = new TH2F( "h2_tau", "Tau;#eta;p (GeV)", 50, -3, 3, 50, 0, 100 );
26  TH2F* h2_uds = new TH2F( "h2_uds", "Tau;#eta;p (GeV)", 50, -3, 3, 50, 0, 100 );
27  TH2F* h2_cor_eta = new TH2F( "h2_cor_eta", ";#eta (tau);#eta (quark)", 50, -3, 3, 50, -3, 3 );
28  TH2F* h2_cor_phi = new TH2F( "h2_cor_phi", ";#phi (tau);#phi (quark)", 50, -3.14, 3.14, 50, -3.14, 3.14 );
29 
30  /* Fill histograms */
31  chain.Draw( "tau_p : tau_eta >> h2_tau" );
32  h2_tau->GetYaxis()->SetNdivisions(505);
33  h2_tau->GetZaxis()->SetNdivisions(505);
34  h2_tau->Scale(1./ h2_tau->GetEntries() );
35 
36  chain.Draw( "uds_p : uds_eta >> h2_uds" );
37  h2_uds->GetYaxis()->SetNdivisions(505);
38 
39  chain.Draw( "uds_eta : tau_eta >> h2_cor_eta" );
40  h2_cor_eta->GetYaxis()->SetNdivisions(505);
41 
42  chain.Draw( "uds_phi : tau_phi >> h2_cor_phi", "" );
43  // chain.Draw( "uds_phi : tau_phi >> h2_cor_phi", "(tau_phi - uds_phi) >= 0" );
44  // chain.Draw( "uds_phi+3.14 : tau_phi+3.14 >>+ h2_cor_phi", "(tau_phi - uds_phi) < 0" );
45  h2_cor_phi->GetYaxis()->SetNdivisions(505);
46 
47  /* Print some stats */
48  cout << "Total events in TChain: " << chain.GetEntries() << endl;
49  cout << "Total events in h2_tau: " << h2_tau->GetEntries() << endl;
50  cout << "Total events within |eta|<1.0: " << chain.GetEntries("abs(tau_eta)<1.0") << endl;
51 
52  /* create Canvas and draw histograms */
53  TCanvas *c1 = new TCanvas( "c1", h2_tau->GetTitle() );
54  c1->SetRightMargin(0.14);
55  h2_tau->Draw("colz");
56  gPad->RedrawAxis();
57  c1->Print("plots/true_kinematics_tau_eta.eps");
58  c1->Print("plots/true_kinematics_tau_eta.png");
59 
60  TCanvas *c2 = new TCanvas();
61  h2_uds->Draw("colz");
62  gPad->RedrawAxis();
63 
64  TCanvas *c3 = new TCanvas();
65  h2_cor_eta->Draw("colz");
66  gPad->RedrawAxis();
67 
68  TCanvas *c3 = new TCanvas();
69  h2_cor_phi->Draw("colz");
70  gPad->RedrawAxis();
71 
72  return 0;
73 }