Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:51

0001 /* em_cluster_caloid values:
0002    1 = CEMC
0003    4 = EEMC
0004    5 = FEMC
0005 */
0006 
0007 int
0008 makePlot_reco_electron_id()
0009 {
0010   gStyle->SetOptStat(0);
0011 
0012   TFile *fin = new TFile("../../data/Sample_DISReco_ep.root", "OPEN");
0013   //TFile *fin = new TFile("../../data/DISReco_Pythia6_DIS_20x250_1k.root", "OPEN");
0014 
0015   TTree *t_reco = (TTree*)fin->Get("event_cluster");
0016 
0017   /* define cuts */
0018   TCut cut_pid_e("em_evtgen_pid == 11");
0019   TCut cut_pid_pion("abs(em_evtgen_pid) == 211");
0020   TCut cut_eta( "1" );
0021 
0022   TCanvas *ctemp = new TCanvas();
0023 
0024   /* E over p ratio */
0025   ctemp->cd();
0026 
0027   TH1F* h_e_over_p_electron = new TH1F("h_e_over_p_electron", ";E / p", 100, 0, 2);
0028   TH1F* h_e_over_p_pion = (TH1F*)h_e_over_p_electron->Clone("h_e_over_p_pion");
0029 
0030   h_e_over_p_electron->SetLineColor( kBlue );
0031   h_e_over_p_pion->SetLineColor( kRed );
0032 
0033   t_reco->Draw( "em_cluster_e / em_track_ptotal >> h_e_over_p_electron", cut_pid_e && cut_eta );
0034   t_reco->Draw( "em_cluster_e / em_track_ptotal >> h_e_over_p_pion", cut_pid_pion && cut_eta );
0035 
0036   TCanvas *c1 = new TCanvas();
0037   c1->SetLogy(1);
0038   h_e_over_p_electron->Draw("");
0039   h_e_over_p_pion->Draw("sames");
0040 
0041   c1->Print("plots/electron_id_c1.eps");
0042   c1->Print("plots/electron_id_c1.png");
0043 
0044 
0045   /* Cluster shape */
0046   ctemp->cd();
0047 
0048   TH1F* h_em_prob_electron = new TH1F("h_em_prob_electron", ";electron shape probability", 100, 0, 1.0);
0049   TH1F* h_em_prob_pion = (TH1F*)h_em_prob_electron->Clone("h_em_prob_pion");
0050 
0051   h_em_prob_electron->SetLineColor( kBlue );
0052   h_em_prob_pion->SetLineColor( kRed );
0053 
0054   t_reco->Draw( "em_cluster_prob >> h_em_prob_electron", cut_pid_e && cut_eta );
0055   t_reco->Draw( "em_cluster_prob >> h_em_prob_pion", cut_pid_pion && cut_eta );
0056 
0057   TCanvas *c2 = new TCanvas();
0058   c2->SetLogy(1);
0059   h_em_prob_pion->Draw("");
0060   h_em_prob_electron->Draw("sames");
0061 
0062   c2->Print("plots/electron_id_c2.eps");
0063   c2->Print("plots/electron_id_c2.png");
0064 
0065 
0066   /* Cluster pseudorapidity */
0067   ctemp->cd();
0068 
0069   TH1F* h_em_eta_electron = new TH1F("h_em_eta_electron", ";#eta", 101, -5.05, 5.05);
0070   TH1F* h_em_eta_pion = (TH1F*)h_em_eta_electron->Clone("h_em_eta_pion");
0071 
0072   h_em_eta_electron->SetLineColor( kBlue );
0073   h_em_eta_pion->SetLineColor( kRed );
0074 
0075   //t_reco->Draw( "-1*log(tan(em_cluster_theta/2.0)) >> h_em_eta_electron", cut_pid_e );
0076   //t_reco->Draw( "-1*log(tan(em_cluster_theta/2.0)) >> h_em_eta_pion", cut_pid_pion );
0077 
0078   t_reco->Draw( "em_cluster_eta >> h_em_eta_electron", cut_pid_e );
0079   t_reco->Draw( "em_cluster_eta >> h_em_eta_pion", cut_pid_pion );
0080 
0081   TCanvas *c3 = new TCanvas();
0082   c3->SetLogy(1);
0083   h_em_eta_pion->Draw("");
0084   h_em_eta_electron->Draw("sames");
0085 
0086   c3->Print("plots/electron_id_c3.eps");
0087   c3->Print("plots/electron_id_c3.png");
0088 
0089 
0090   return 1;
0091 }