Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 calo_towers()
0002 {
0003   gStyle->SetOptStat(0);
0004 
0005   unsigned col1 = kOrange+7;
0006   unsigned col2 = kBlue+2;
0007 
0008   /* open inout files and merge trees */
0009   TChain chain_tower("ntp_tower");
0010   chain_tower.Add("data_3pions/p250_e20_0events_file1093_LeptoAna_r05.root");
0011   chain_tower.Add("data_3pions/p250_e20_0events_file1096_LeptoAna_r05.root");
0012   chain_tower.Add("data_3pions/p250_e20_0events_file1101_LeptoAna_r05.root");
0013   chain_tower.Add("data_3pions/p250_e20_0events_file1115_LeptoAna_r05.root");
0014   chain_tower.Add("data_3pions/p250_e20_0events_file1122_LeptoAna_r05.root");
0015   chain_tower.Add("data_3pions/p250_e20_0events_file1127_LeptoAna_r05.root");
0016   chain_tower.Add("data_3pions/p250_e20_0events_file1131_LeptoAna_r05.root");
0017   chain_tower.Add("data_3pions/p250_e20_0events_file1164_LeptoAna_r05.root");
0018 
0019   TCut select_tower_tau("tower_e * (is_tau==1 && abs(jet_eta) < 1.0 && jet_etotal>5 && sqrt( (tau_eta-jet_eta)*(tau_eta-jet_eta) + (tau_phi-jet_phi)*(tau_phi-jet_phi) ) < 0.1)");
0020 
0021   TCut select_tower_uds("tower_e * (is_tau==0 && abs(jet_eta) < 1.0 && jet_etotal>5)");
0022 
0023   /* EMCal segmentation eta-phi: 0.025 x 0.025, cover 1.1 in eta, 96 x 256 towers
0024    * HCAL  segmentation eta-phi: 0.1 x 0.1 */
0025   int nbins = 10;
0026   float maxmin = 0.5;
0027 
0028   TH2F* h2_calo_tau = new TH2F("h2_calo_tau", ";#Delta#phi;#Delta#eta;E/#SigmaE", nbins, -maxmin, maxmin, nbins, -maxmin, maxmin );
0029   h2_calo_tau->SetLineColor( col2 );
0030   h2_calo_tau->GetXaxis()->SetNdivisions(505);
0031   h2_calo_tau->GetYaxis()->SetNdivisions(505);
0032   h2_calo_tau->GetZaxis()->SetNdivisions(505);
0033   h2_calo_tau->GetZaxis()->SetTitleOffset(1.35);
0034   chain_tower.Draw("( tower_eta - jet_eta ) : ( tower_phi - jet_phi ) >> h2_calo_tau",select_tower_tau);
0035   h2_calo_tau->Scale( 1. / h2_calo_tau->Integral() );
0036   //h2_calo_tau->GetZaxis()->SetRangeUser(0,0.04);
0037 
0038   TH2F* h2_calo_uds = new TH2F("h2_calo_uds", ";#Delta#phi;#Delta#eta;E/#SigmaE", nbins, -maxmin, maxmin, nbins, -maxmin, maxmin );
0039   h2_calo_uds->SetLineColor( col1 );
0040   h2_calo_uds->GetXaxis()->SetNdivisions(505);
0041   h2_calo_uds->GetYaxis()->SetNdivisions(505);
0042   h2_calo_uds->GetZaxis()->SetNdivisions(505);
0043   h2_calo_uds->GetZaxis()->SetTitleOffset(1.35);
0044   chain_tower.Draw("( tower_eta - jet_eta ) : ( tower_phi - jet_phi ) >> h2_calo_uds",select_tower_uds);
0045   h2_calo_uds->Scale( 1. / h2_calo_uds->Integral() );
0046   //h2_calo_uds->GetZaxis()->SetRangeUser(0,0.04);
0047 
0048   /* plot histograms */
0049   TCanvas *c1 = new TCanvas();
0050   //c1->SetRightMargin(1.5);
0051   h2_calo_tau->Draw("lego");
0052   c1->Print("plots/calo_towers_2d_tau.eps");
0053   c1->Print("plots/calo_towers_2d_tau.png");
0054 
0055   TCanvas *c2 = new TCanvas();
0056   //c2->SetRightMargin(1.5);
0057   h2_calo_uds->Draw("lego");
0058   c2->Print("plots/calo_towers_2d_uds.eps");
0059   c2->Print("plots/calo_towers_2d_uds.png");
0060 
0061   //TCanvas *c3 = new TCanvas();
0062   //chain_tower.Draw("sqrt( ( tower_eta - jet_eta ) * ( tower_eta - jet_eta ) + ( tower_phi - jet_phi ) * ( tower_phi - jet_phi ) ) >> htest_uds", select_tower_uds);
0063 }