File indexing completed on 2025-08-03 08:13:10
0001 #include <TH2D.h>
0002 #include <TFile.h>
0003 #include <TF1.h>
0004 #include <TF2.h>
0005 #include <TGraph.h>
0006 #include <TCanvas.h>
0007 #include <TROOT.h>
0008 #include <TStyle.h>
0009 #include <TLegend.h>
0010 #include <TLatex.h>
0011 #include <TLine.h>
0012 #include <TColor.h>
0013
0014 #include "sPhenixStyle.C"
0015
0016 void plot_comparisons_clusters()
0017 {
0018
0019 SetsPhenixStyle();
0020
0021
0022
0023
0024
0025
0026
0027
0028 static const int NCONFIGS = 2;
0029
0030 TFile *fin[NCONFIGS];
0031 int tpc_layer[NCONFIGS][4];
0032
0033 char label[NCONFIGS][500];
0034
0035 fin[0] = new TFile("root_files/pileup_fix_inner16_200khz_cluster_resolution_out.root");
0036 fin[1] = new TFile("root_files/pileup_fix_inner16_100khz_cluster_resolution_out.root");
0037
0038 sprintf(label[0], "NeCF4_400 16 inner layers 200 kHz");
0039 sprintf(label[1], "NeCF4_400 16 inner layers 100 kHz");
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 tpc_layer[0][0] = 7;
0051 tpc_layer[0][1] = 23;
0052 tpc_layer[0][2] = 39;
0053 tpc_layer[0][3] = 54;
0054
0055
0056 tpc_layer[1][0] = 7;
0057 tpc_layer[1][1] = 23;
0058 tpc_layer[1][2] = 39;
0059 tpc_layer[1][3] = 54;
0060
0061 double layer_radius[4] = {30.0, 40.0, 60.0, 79.0};
0062
0063 bool use_last_inner = true;
0064 if(use_last_inner)
0065 {
0066 tpc_layer[0][1] = 22;
0067 tpc_layer[1][1] = 22;
0068 layer_radius[1] = 39.0;
0069 }
0070
0071 TGraph *gzsize[4][NCONFIGS];
0072 TGraph *gocc[4][NCONFIGS];
0073
0074 int col[4] = {kRed, kBlue, kBlack, kViolet};
0075
0076 for(int i=0;i<NCONFIGS;i++)
0077 {
0078 if(!fin[i])
0079 {
0080 cout << "Did not find file " << i << " quit!" << endl;
0081 exit(1);
0082 }
0083
0084 for(int ilayer = 0;ilayer < 4; ilayer++)
0085 {
0086 int layer = tpc_layer[i][ilayer];
0087 char name1[500];
0088 sprintf(name1,"goccz%i",layer);
0089 cout << "Fetching object " << name1 << " for layer " << layer << " from file " << i << endl;
0090 fin[i]->GetObject(name1,gzsize[ilayer][i]);
0091 char name2[500];
0092 sprintf(name2,"gocc_clus%i",layer);
0093 cout << "Fetching object " << name2 << " for layer " << layer << " from file " << i << endl;
0094 fin[i]->GetObject(name2,gocc[ilayer][i]);
0095
0096 if(!gzsize[ilayer][i])
0097 {
0098 cout << "Failed to find gzsize named " << name1 << endl;
0099 exit(1);
0100 }
0101 if(!gocc[ilayer][i])
0102 {
0103 cout << "Failed to find gocc named " << name2 << endl;
0104 exit(1);
0105 }
0106 }
0107 }
0108
0109
0110
0111
0112 double hmaxz[4] = {3.5, 3.5, 3.5, 3.5};
0113
0114 TCanvas *cz = new TCanvas("cz","cz",50,50,1200,800);
0115 cz->Divide(2,2);
0116
0117 TH1F *hdz = new TH1F("hdz","hdz",100, -110.0, 110.0);
0118 hdz->SetMinimum(0.0);
0119 hdz->GetXaxis()->SetTitle("Z (cm)");
0120 hdz->GetXaxis()->SetTitleOffset(1.15);
0121 hdz->GetYaxis()->SetTitle("Cluster Z size");
0122 hdz->GetYaxis()->SetTitleOffset(1.3);
0123
0124 for(int ilayer = 0;ilayer<4;ilayer++)
0125 {
0126 cz->cd(ilayer+1);
0127
0128 hdz->SetMaximum(hmaxz[ilayer]);
0129 hdz->DrawCopy();
0130 for(int i=0;i<NCONFIGS;i++)
0131 {
0132 gzsize[ilayer][i]->SetMarkerColor(col[i]);
0133
0134 if(i==0)
0135 gzsize[ilayer][i]->Draw("p");
0136 else
0137 gzsize[ilayer][i]->Draw("same p");
0138 }
0139
0140 char label[500];
0141 sprintf(label,"radius = %.1f cm",layer_radius[ilayer]);
0142 TLatex *l3 = new TLatex(0.25,0.25,label);
0143 l3->SetNDC(1);
0144 l3->Draw();
0145 }
0146
0147
0148
0149
0150 double hmax[4] = {0.45, 0.35, 0.25, 0.18};
0151
0152 TCanvas *cocc = new TCanvas("cocc","cocc",50,50,1200,800);
0153 cocc->Divide(2,2);
0154
0155 TH1F *hd = new TH1F("hd","hd",100, -110.0, 110.0);
0156 hd->SetMinimum(0.0);
0157 hd->GetXaxis()->SetTitle("Z (cm)");
0158 hd->GetXaxis()->SetTitleOffset(1.15);
0159 hd->GetYaxis()->SetTitle("Cluster occupancy");
0160 hd->GetYaxis()->SetTitleOffset(1.3);
0161
0162 for(int ilayer = 0;ilayer<4;ilayer++)
0163 {
0164 cocc->cd(ilayer+1);
0165
0166 hd->SetMaximum(hmax[ilayer]);
0167 hd->DrawCopy();
0168 for(int i=0;i<NCONFIGS;i++)
0169 {
0170 gocc[ilayer][i]->SetMarkerColor(col[i]);
0171
0172 if(i==0)
0173 gocc[ilayer][i]->Draw("p");
0174 else
0175 gocc[ilayer][i]->Draw("same p");
0176 }
0177 char label[500];
0178 sprintf(label,"radius = %.1f cm",layer_radius[ilayer]);
0179 TLatex *l3 = new TLatex(0.25,0.25,label);
0180 l3->SetNDC(1);
0181 l3->Draw();
0182 }
0183
0184 TLegend *lpd = new TLegend(0.20, 0.70, 0.9, 0.90, "", "NDC");
0185 lpd->SetBorderSize(1);
0186 lpd->SetFillColor(0);
0187 lpd->SetFillStyle(0);
0188 for(int i=0;i<NCONFIGS;i++)
0189 {
0190 lpd->AddEntry(gocc[0][i],label[i], "p");
0191 }
0192 cocc->cd(4);
0193 lpd->Draw();
0194
0195 cz->cd(4);
0196 lpd->Draw();
0197
0198 cout << "Done" << endl;
0199 }
0200
0201