File indexing completed on 2025-12-19 09:18:44
0001
0002 #include <TCanvas.h>
0003 #include <TFile.h>
0004 #include <TFileCollection.h>
0005 #include <TFileInfo.h>
0006 #include <TH2.h>
0007 #include <TH3.h>
0008 #include <THashList.h>
0009 #include <TLatex.h>
0010 #include <TMath.h>
0011 #include <TPad.h>
0012 #include <TVector3.h>
0013 #include <TTree.h>
0014
0015 #include <cmath>
0016 #include <iostream>
0017 #include <format>
0018 #include <vector>
0019
0020 class Shifter {
0021 public:
0022 explicit Shifter(const TString& sourcefilename);
0023
0024 TFile *forward, *average;
0025 TH3F *hX, *hY, *hZ, *hR, *hPhi, *hXave, *hYave, *hZave, *hRave, *hPhiave;
0026
0027 };
0028
0029 Shifter::Shifter(const TString& sourcefilename){
0030
0031
0032 forward=TFile::Open(sourcefilename,"READ");
0033
0034 hX=(TH3F*)forward->Get("hIntDistortionPosX");
0035 hY=(TH3F*)forward->Get("hIntDistortionPosY");
0036 hZ=(TH3F*)forward->Get("hIntDistortionPosZ");
0037
0038 hR=(TH3F*)forward->Get("hIntDistortionPosR");
0039 hPhi=(TH3F*)forward->Get("hIntDistortionPosP");
0040
0041
0042 average=TFile::Open("/sphenix/user/rcorliss/distortion_maps/2021.04/apr07.average.real_B1.4_E-400.0.ross_phi1_sphenix_phislice_lookup_r26xp40xz40.distortion_map.hist.root","READ");
0043
0044 hXave=(TH3F*)average->Get("hIntDistortionPosX");
0045 hYave=(TH3F*)average->Get("hIntDistortionPosY");
0046 hZave=(TH3F*)average->Get("hIntDistortionPosZ");
0047
0048 hRave=(TH3F*)average->Get("hIntDistortionPosR");
0049 hPhiave=(TH3F*)average->Get("hIntDistortionPosP");
0050
0051
0052
0053 hX->Add(hXave,-1);
0054 hY->Add(hYave,-1);
0055 hZ->Add(hZave,-1);
0056
0057 hR->Add(hRave,-1);
0058 hPhi->Add(hPhiave,-1);
0059 }
0060
0061 int CMDistortionAnalysisPhiR(int nMaxEvents = -1) {
0062 Shifter *shifter;
0063 int nbins = 35;
0064
0065
0066
0067
0068 int nEvents;
0069
0070 TCanvas *canvas=new TCanvas("canvas","CMDistortionAnalysisPhiR",2000,3000);
0071
0072 int nsumbins = 20;
0073 int minsum = -10;
0074 int maxsum = 10;
0075
0076
0077 TH1F *hDifferenceMeanR = new TH1F("hDifferenceMeanR", "Average Difference between R Model and True of All Events (R > 30); #Delta R (#mum)", nsumbins, minsum, maxsum);
0078 TH1F *hDifferenceStdDevR = new TH1F("hDifferenceStdDevR", "Std Dev of Difference between R Model and True of All Events (R > 30); #Delta R (#mum)", nsumbins, minsum, maxsum);
0079
0080 TH1F *hTrueMeanR = new TH1F("hTrueMeanR", "Mean True R Distortion Model of All Events (R > 30); #Delta R (#mum)", nsumbins, minsum, maxsum);
0081 TH1F *hTrueStdDevR = new TH1F("hTrueStdDevR", "Std Dev of True R Distortion Model of All Events (R > 30); #Delta R (#mum)", nsumbins, minsum, maxsum);
0082
0083 TH1F *hDifferenceMeanPhi = new TH1F("hDifferenceMeanPhi", "Average Difference between Phi Model and True of All Events (R > 30); #Delta Phi (#mum)", nsumbins, minsum, maxsum);
0084 TH1F *hDifferenceStdDevPhi = new TH1F("hDifferenceStdDevPhi", "Std Dev of Difference between Phi Model and True of All Events (R > 30); #Delta Phi (#mum)", nsumbins, minsum, maxsum);
0085
0086 TH1F *hTrueMeanPhi = new TH1F("hTrueMeanPhi", "Mean True Phi Distortion Model of All Events (R > 30); #Delta Phi (#mum)", nsumbins, minsum, maxsum);
0087 TH1F *hTrueStdDevPhi = new TH1F("hTrueStdDevPhi", "Std Dev of True Phi Distortion Model of All Events (R > 30); #Delta Phi (#mum)", nsumbins, minsum, maxsum);
0088
0089 const char * inputpattern="/sphenix/user/rcorliss/distortion_maps/2021.04/*h_Charge_*.root";
0090
0091
0092 TFileCollection *filelist=new TFileCollection();
0093 filelist->Add(inputpattern);
0094 TString sourcefilename;
0095
0096
0097 if(nMaxEvents >= 0 && nMaxEvents<filelist->GetNFiles())
0098 {
0099 nEvents=nMaxEvents;
0100 }
0101 else
0102 {
0103 nEvents= filelist->GetNFiles();
0104 }
0105
0106 for (int ifile=0;ifile < nEvents;ifile++){
0107
0108 sourcefilename=((TFileInfo*)(filelist->GetList()->At(ifile)))->GetCurrentUrl()->GetFile();
0109
0110
0111 shifter = new Shifter(sourcefilename);
0112
0113 TFile *plots;
0114
0115 plots=TFile::Open(std::format("CMModelsPhiR_Event{}.root",ifile).c_str(),"READ");
0116
0117 TH3F *hCartCMModelPhiR[3];
0118 hCartCMModelPhiR[0]=(TH3F*)plots->Get("hCMModelX_PhiR");
0119 hCartCMModelPhiR[1]=(TH3F*)plots->Get("hCMModelY_PhiR");
0120 hCartCMModelPhiR[2]=(TH3F*)plots->Get("hCMModelZ_PhiR");
0121
0122 TH3F *hCylCMModelPhiR[2];
0123 hCylCMModelPhiR[0]=(TH3F*)plots->Get("hCMModelR_PhiR");
0124 hCylCMModelPhiR[1]=(TH3F*)plots->Get("hCMModelPhi_PhiR");
0125
0126
0127
0128
0129
0130 int nphi = 82;
0131 int nr = 54;
0132 int nz = 82;
0133
0134 double minphi = -0.078539819;
0135 double minr = 18.884615;
0136 double minz = -1.3187500;
0137
0138 double maxphi = 6.3617253;
0139 double maxr = 79.115387;
0140 double maxz = 106.81875;
0141
0142
0143
0144 int ndiff = 300;
0145 int mindiff = -20;
0146 int maxdiff = 20;
0147
0148 TH1F *hCartesianShiftDifferencePhiR[3];
0149 hCartesianShiftDifferencePhiR[0] = new TH1F("hShiftDifferenceX_PhiR", "Difference between CM Model X and True, Phi,R binning (R > 30); #Delta X (#mum)", ndiff, mindiff, maxdiff);
0150 hCartesianShiftDifferencePhiR[1] = new TH1F("hShiftDifferenceY_PhiR", "Difference between CM Model Y and True, Phi,R binning (R > 30); #Delta Y (#mum)", ndiff, mindiff, maxdiff);
0151 hCartesianShiftDifferencePhiR[2] = new TH1F("hShiftDifferenceZ_PhiR", "Difference between CM Model Z and True, Phi,R binning (R > 30); #Delta Z (#mum)", ndiff, mindiff, maxdiff);
0152
0153 TH1F *hCylindricalShiftDifferencePhiR[2];
0154 hCylindricalShiftDifferencePhiR[0] = new TH1F("hShiftDifferenceR_PhiR", "Difference between CM Model R and True, Phi,R binning (R > 30); #Delta R (#mum)", ndiff, mindiff, maxdiff);
0155 hCylindricalShiftDifferencePhiR[1] = new TH1F("hShiftDifferencePhi_PhiR", "Difference between CM Model Phi and True, Phi,R binning (R > 30); #Delta Phi (#mum)", ndiff, mindiff, maxdiff);
0156
0157 TH1F *hRShiftTrue = new TH1F("hRShiftTrue", "True R Distortion Model (R > 30); #Delta R (#mum)", ndiff, mindiff, maxdiff);
0158 TH1F *hPhiShiftTrue = new TH1F("hPhiShiftTrue", "True Phi Distortion Model (R > 30); #Delta Phi (#mum)", ndiff, mindiff, maxdiff);
0159
0160 TH2F *hCartesianDiffPhiR[6];
0161 hCartesianDiffPhiR[0] = new TH2F("hDiffXYX_PhiR", "Difference in PhiR for CM Model X, Phi,R binning; phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0162 hCartesianDiffPhiR[1] = new TH2F("hDiffRZX_PhiR", "Difference in RZ for CM Model X, Phi,R binning; z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0163 hCartesianDiffPhiR[2] = new TH2F("hDiffXYY_PhiR", "Difference in PhiR for CM Model Y, Phi,R binning; phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0164 hCartesianDiffPhiR[3] = new TH2F("hDiffRZY_PhiR", "Difference in RZ for CM Model Y, Phi,R binning; z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0165 hCartesianDiffPhiR[4] = new TH2F("hDiffXYZ_PhiR", "Difference in PhiR for CM Model Z, Phi,R binning; phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0166 hCartesianDiffPhiR[5] = new TH2F("hDiffRZZ_PhiR", "Difference in RZ for CM Model Z, Phi,R binning; z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0167
0168 TH2F *hCylindricalDiffPhiR[4];
0169 hCylindricalDiffPhiR[0] = new TH2F("hDiffXYR_PhiR", "Difference in PhiR for CM Model R, Phi,R binning; phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0170 hCylindricalDiffPhiR[1] = new TH2F("hDiffRZR_PhiR", "Difference in RZ for CM Model R, Phi,R binning; z (cm); r (cm)",nz,minz,maxz,nr,minr,maxr);
0171 hCylindricalDiffPhiR[2] = new TH2F("hDiffXYPhi_PhiR", "Difference in PhiR for CM Model Phi, Phi,R binning; phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0172 hCylindricalDiffPhiR[3] = new TH2F("hDiffRZPhi_PhiR", "Difference in RZ for CM Model Phi, Phi,R binning; z (cm); r (cm)",nz,minz,maxz,nr,minr,maxr);
0173
0174 TH2F *hCartesianAveDiffPhiR[6];
0175 hCartesianAveDiffPhiR[0] = new TH2F("hAveDiffXYX_PhiR", "X Model - Truth Averaged Over z, Phi,R binning (#mum); phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0176 hCartesianAveDiffPhiR[1] = new TH2F("hAveDiffRZX_PhiR", "X Model - Truth Averaged Over phi, Phi,R binning (#mum); z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0177 hCartesianAveDiffPhiR[2] = new TH2F("hAveDiffXYY_PhiR", "Y Model - Truth Averaged Over z, Phi,R binning (#mum); phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0178 hCartesianAveDiffPhiR[3] = new TH2F("hAveDiffRZY_PhiR", "Y Model - Truth Averaged Over phi, Phi,R binning (#mum); z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0179 hCartesianAveDiffPhiR[4] = new TH2F("hAveDiffXYZ_PhiR", "Z Model - Truth Averaged Over z, Phi,R binning (#mum); phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0180 hCartesianAveDiffPhiR[5] = new TH2F("hAveDiffRZZ_PhiR", "Z Model - Truth Averaged Over phi, Phi,R binning (#mum); z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0181
0182 TH2F *hCylindricalAveDiffPhiR[4];
0183 hCylindricalAveDiffPhiR[0] = new TH2F("hAveDiffXYR_PhiR", "R Model - Truth Averaged Over z, Phi,R binning (#mum); phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0184 hCylindricalAveDiffPhiR[1] = new TH2F("hAveDiffRZR_PhiR", "R Model - Truth Averaged Over phi, Phi,R binning (#mum); z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0185 hCylindricalAveDiffPhiR[2] = new TH2F("hAveDiffXYPhi_PhiR", "Phi Model - Truth Averaged Over z, Phi,R binning (#mum); phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0186 hCylindricalAveDiffPhiR[3] = new TH2F("hAveDiffRZPhi_PhiR", "Phi Model - Truth Averaged Over phi, Phi,R binning (#mum); z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0187
0188 TH2F *hSamplePerBinRZ = new TH2F("hSamplePerBinRZ", "Filling each rz bin; z (cm); r (cm)", nz,minz,maxz,nr,minr,maxr);
0189
0190 TH2F *hSamplePerBinPhiR = new TH2F("hSamplePerBinPhiR", "Filling each PhiR bin; phi (rad); r (cm)",nphi,minphi,maxphi,nr,minr,maxr);
0191
0192 TH2F *hCompareRTrue_PhiR = new TH2F("hCompareRTrue_PhiR", "Compare Difference from R Model and True, Phi,R binning (R > 30, 10 < z < 90); reco shift (#mum); true shift (#mum)",nbins,-550,550,nbins,-550,550);
0193 TH2F *hComparePhiTrue_PhiR = new TH2F("hComparePhiTrue_PhiR", "Compare Difference from Phi Model and True, Phi,R binning (R > 30, 10 < z < 90); reco shift (#mum); true shift (#mum)",nbins,-550,550,nbins,-550,550);
0194
0195 TH2F *hRDiffvR_PhiR = new TH2F("hRDiffvR_PhiR", "Difference between R Model and True vs. r, Phi,R binning (R > 30, 10 < z < 90); r (cm); shift difference (#mum)",nr,minr,maxr,ndiff,mindiff,maxdiff);
0196 TH2F *hRDiffvZ_PhiR = new TH2F("hRDiffvZ_PhiR", "Difference between R Model and True vs. z, Phi,R binning (R > 30); z (cm); shift difference (#mum)",nz,minz,maxz,ndiff,mindiff,maxdiff);
0197 TH2F *hRDiffvPhi_PhiR = new TH2F("hRDiffvPhi_PhiR", "Difference between R Model and True vs. phi, Phi,R binning (R > 30, 10 < z < 90); phi (rad); shift difference (#mum)",nphi,minphi,maxphi,ndiff,mindiff,maxdiff);
0198
0199 TH2F *hPhiDiffvR_PhiR = new TH2F("hPhiDiffvR_PhiR", "Difference between Phi Model and True vs. r, Phi,R binning (R > 30, 10 < z < 90); r (cm); shift difference (#mum)",nr,minr,maxr,ndiff,mindiff,maxdiff);
0200 TH2F *hPhiDiffvZ_PhiR = new TH2F("hPhiDiffvZ_PhiR", "Difference between Phi Model and True vs. z, Phi,R binning (R > 30); z (cm); shift difference (#mum)",nz,minz,maxz,ndiff,mindiff,maxdiff);
0201 TH2F *hPhiDiffvPhi_PhiR = new TH2F("hPhiDiffvPhi_PhiR", "Difference between Phi Model and True vs. phi, Phi,R binning (R > 30, 10 < z < 90); phi (rad); shift difference (#mum)",nphi,minphi,maxphi,ndiff,mindiff,maxdiff);
0202
0203 for(int i = 1; i < nphi - 1; i++){
0204 double phi = minphi + ((maxphi - minphi)/(1.0*nphi))*(i+0.5);
0205 for(int j = 1; j < nr - 1; j++){
0206 double r = minr + ((maxr - minr)/(1.0*nr))*(j+0.5);
0207 for(int k = 1; k < nz - 1; k++){
0208 double z = minz + ((maxz - minz)/(1.0*nz))*(k+0.5);
0209
0210 double shifttrueCart[3];
0211 double shifttrueCyl[2];
0212
0213 double shiftrecoCartPhiR[3];
0214 double differenceCartPhiR[3];
0215
0216 double shiftrecoCylPhiR[2];
0217 double differenceCylPhiR[2];
0218
0219
0220
0221 int binPhiR = hCartCMModelPhiR[0]->FindBin(phi,r,z);
0222
0223 if((r > 30.0) && (r < 76.0)){
0224
0225 shifttrueCart[0] = (shifter->hX->Interpolate(phi,r,z))*(1e4);
0226 shifttrueCart[1] = (shifter->hY->Interpolate(phi,r,z))*(1e4);
0227 shifttrueCart[2] = (shifter->hZ->Interpolate(phi,r,z))*(1e4);
0228
0229 shifttrueCyl[0] = (shifter->hR->Interpolate(phi,r,z))*(1e4);
0230 shifttrueCyl[1] = (shifter->hPhi->Interpolate(phi,r,z))*(1e4);
0231 hRShiftTrue->Fill(shifttrueCyl[0]);
0232 hPhiShiftTrue->Fill(shifttrueCyl[1]);
0233
0234 for(int l = 0; l < 3; l ++){
0235 shiftrecoCartPhiR[l] = (hCartCMModelPhiR[l]->GetBinContent(binPhiR))*(1e4);
0236
0237 differenceCartPhiR[l] = shiftrecoCartPhiR[l] - shifttrueCart[l];
0238
0239 hCartesianShiftDifferencePhiR[l]->Fill(differenceCartPhiR[l]);
0240 }
0241
0242
0243 shiftrecoCylPhiR[0] = (hCylCMModelPhiR[0]->GetBinContent(binPhiR))*(1e4);
0244 differenceCylPhiR[0] = shiftrecoCylPhiR[0] - shifttrueCyl[0];
0245 hCylindricalShiftDifferencePhiR[0]->Fill(differenceCylPhiR[0]);
0246
0247
0248 shiftrecoCylPhiR[1] = r*(1e4)*(hCylCMModelPhiR[1]->GetBinContent(binPhiR));
0249 differenceCylPhiR[1] = (shiftrecoCylPhiR[1] - shifttrueCyl[1]);
0250 hCylindricalShiftDifferencePhiR[1]->Fill(differenceCylPhiR[1]);
0251
0252
0253 hCartesianDiffPhiR[0]->Fill(phi,r, differenceCartPhiR[0]);
0254 hCartesianDiffPhiR[1]->Fill(z,r, differenceCartPhiR[0]);
0255
0256 hCartesianDiffPhiR[2]->Fill(phi,r, differenceCartPhiR[1]);
0257 hCartesianDiffPhiR[3]->Fill(z,r, differenceCartPhiR[1]);
0258
0259 hCartesianDiffPhiR[4]->Fill(phi,r, differenceCartPhiR[2]);
0260 hCartesianDiffPhiR[5]->Fill(z,r, differenceCartPhiR[2]);
0261
0262
0263 hCylindricalDiffPhiR[0]->Fill(phi,r, differenceCylPhiR[0]);
0264 hCylindricalDiffPhiR[1]->Fill(z,r, differenceCylPhiR[0]);
0265
0266 hCompareRTrue_PhiR->Fill(shiftrecoCylPhiR[0],shifttrueCyl[0]);
0267
0268 hRDiffvR_PhiR->Fill(r,differenceCylPhiR[0],1);
0269 hRDiffvPhi_PhiR->Fill(phi,differenceCylPhiR[0],1);
0270 hRDiffvZ_PhiR->Fill(z,differenceCylPhiR[0],1);
0271
0272
0273 hCylindricalDiffPhiR[2]->Fill(phi,r, differenceCylPhiR[1]);
0274 hCylindricalDiffPhiR[3]->Fill(z,r, differenceCylPhiR[1]);
0275
0276 hComparePhiTrue_PhiR->Fill(shiftrecoCylPhiR[1],shifttrueCyl[1]);
0277
0278 hPhiDiffvR_PhiR->Fill(r,differenceCylPhiR[1],1);
0279 hPhiDiffvPhi_PhiR->Fill(phi,differenceCylPhiR[1],1);
0280 hPhiDiffvZ_PhiR->Fill(z,differenceCylPhiR[1],1);
0281
0282 hSamplePerBinRZ->Fill(z,r,1);
0283 hSamplePerBinPhiR->Fill(phi,r,1);
0284 }
0285 }
0286 }
0287 }
0288
0289
0290 for (int m = 0; m < 6; m = m+2){
0291 hCartesianAveDiffPhiR[m]->Divide(hCartesianDiffPhiR[m],hSamplePerBinPhiR);
0292 }
0293 for (int m = 0; m < 4; m = m+2){
0294 hCylindricalAveDiffPhiR[m]->Divide(hCylindricalDiffPhiR[m],hSamplePerBinPhiR);
0295 }
0296
0297
0298 for (int m = 1; m < 6; m = m+2){
0299 hCartesianAveDiffPhiR[m]->Divide(hCartesianDiffPhiR[m],hSamplePerBinRZ);
0300 }
0301 for (int m = 1; m < 4; m = m+2){
0302 hCylindricalAveDiffPhiR[m]->Divide(hCylindricalDiffPhiR[m],hSamplePerBinRZ);
0303 }
0304
0305
0306 hDifferenceMeanR->Fill(hCylindricalShiftDifferencePhiR[0]->GetMean(1));
0307 hDifferenceStdDevR->Fill(hCylindricalShiftDifferencePhiR[0]->GetStdDev(1));
0308
0309 hTrueMeanR->Fill(hRShiftTrue->GetMean(1));
0310 hTrueStdDevR->Fill(hRShiftTrue->GetStdDev(1));
0311
0312 hDifferenceMeanPhi->Fill(hCylindricalShiftDifferencePhiR[1]->GetMean(1));
0313 hDifferenceStdDevPhi->Fill(hCylindricalShiftDifferencePhiR[1]->GetStdDev(1));
0314
0315 hTrueMeanPhi->Fill(hPhiShiftTrue->GetMean(1));
0316 hTrueStdDevPhi->Fill(hPhiShiftTrue->GetStdDev(1));
0317
0318 for (auto & m : hCartesianAveDiffPhiR){
0319 m->SetStats(false);
0320 }
0321 for (auto & m : hCylindricalAveDiffPhiR){
0322 m->SetStats(false);
0323 }
0324
0325
0326 hCompareRTrue_PhiR->SetStats(false);
0327 hComparePhiTrue_PhiR->SetStats(false);
0328
0329 hRDiffvR_PhiR->SetStats(false);
0330 hRDiffvZ_PhiR->SetStats(false);
0331 hRDiffvPhi_PhiR->SetStats(false);
0332
0333 hPhiDiffvR_PhiR->SetStats(false);
0334 hPhiDiffvZ_PhiR->SetStats(false);
0335 hPhiDiffvPhi_PhiR->SetStats(false);
0336
0337 TPad *c1=new TPad("c1","",0.0,0.8,1.0,0.93);
0338 TPad *c2=new TPad("c2","",0.0,0.64,1.0,0.77);
0339 TPad *c3=new TPad("c3","",0.0,0.48,1.0,0.61);
0340 TPad *c4=new TPad("c4","",0.0,0.32,1.0,0.45);
0341 TPad *c5=new TPad("c5","",0.0,0.16,1.0,0.29);
0342 TPad *c6=new TPad("c6","",0.0,0.0,1.0,0.13);
0343
0344 TPad *titlepad=new TPad("titlepad","",0.0,0.96,1.0,1.0);
0345
0346 TPad *stitlepad1=new TPad("stitlepad1","",0.0,0.93,1.0,0.96);
0347 TPad *stitlepad2=new TPad("stitlepad2","",0.0,0.77,1.0,0.8);
0348 TPad *stitlepad3=new TPad("stitlepad3","",0.0,0.61,1.0,0.64);
0349 TPad *stitlepad4=new TPad("stitlepad4","",0.0,0.45,1.0,0.48);
0350 TPad *stitlepad5=new TPad("stitlepad5","",0.0,0.29,1.0,0.32);
0351 TPad *stitlepad6=new TPad("stitlepad6","",0.0,0.13,1.0,0.16);
0352
0353 TLatex * title = new TLatex(0.0,0.0,"");
0354
0355 TLatex * stitle1 = new TLatex(0.0,0.0,"");
0356 TLatex * stitle2 = new TLatex(0.0,0.0,"");
0357 TLatex * stitle3 = new TLatex(0.0,0.0,"");
0358 TLatex * stitle4 = new TLatex(0.0,0.0,"");
0359 TLatex * stitle5 = new TLatex(0.0,0.0,"");
0360 TLatex * stitle6 = new TLatex(0.0,0.0,"");
0361
0362 title->SetNDC();
0363 stitle1->SetNDC();
0364 stitle2->SetNDC();
0365 stitle3->SetNDC();
0366 stitle4->SetNDC();
0367 stitle5->SetNDC();
0368 stitle6->SetNDC();
0369
0370 title->SetTextSize(0.32);
0371 stitle1->SetTextSize(0.35);
0372 stitle2->SetTextSize(0.35);
0373 stitle3->SetTextSize(0.35);
0374 stitle4->SetTextSize(0.35);
0375 stitle5->SetTextSize(0.35);
0376 stitle6->SetTextSize(0.35);
0377
0378 canvas->cd();
0379 c1->Draw();
0380 stitlepad1->Draw();
0381 c2->Draw();
0382 stitlepad2->Draw();
0383 c3->Draw();
0384 stitlepad3->Draw();
0385 c4->Draw();
0386 stitlepad4->Draw();
0387 c5->Draw();
0388 stitlepad5->Draw();
0389 c6->Draw();
0390 stitlepad6->Draw();
0391 titlepad->Draw();
0392
0393
0394 c1->Divide(4,1);
0395 c1->cd(1);
0396 hCartesianAveDiffPhiR[0]->Draw("colz");
0397 c1->cd(2);
0398 hCartesianAveDiffPhiR[1]->Draw("colz");
0399 c1->cd(3);
0400 hCartesianShiftDifferencePhiR[0]->Draw();
0401
0402 c1->cd(4);
0403
0404 hSamplePerBinRZ->Draw("colz");
0405
0406
0407 c2->Divide(4,1);
0408 c2->cd(1);
0409 hCartesianAveDiffPhiR[2]->Draw("colz");
0410 c2->cd(2);
0411 hCartesianAveDiffPhiR[3]->Draw("colz");
0412 c2->cd(3);
0413 hCartesianShiftDifferencePhiR[1]->Draw();
0414
0415 c2->cd(4);
0416
0417 hSamplePerBinPhiR->Draw("colz");
0418
0419
0420 c3->Divide(4,1);
0421 c3->cd(1);
0422 hCylindricalAveDiffPhiR[0]->Draw("colz");
0423 c3->cd(2);
0424 hCylindricalAveDiffPhiR[1]->Draw("colz");
0425 c3->cd(3);
0426 hCylindricalShiftDifferencePhiR[0]->Draw();
0427 c3->cd(4);
0428 hRShiftTrue->Draw();
0429
0430
0431 c4->Divide(4,1);
0432 c4->cd(1);
0433 hCylindricalAveDiffPhiR[2]->Draw("colz");
0434 c4->cd(2);
0435 hCylindricalAveDiffPhiR[3]->Draw("colz");
0436 c4->cd(3);
0437 hCylindricalShiftDifferencePhiR[1]->Draw();
0438 c4->cd(4);
0439 hPhiShiftTrue->Draw();
0440
0441
0442 c5->Divide(4,1);
0443 c5->cd(1);
0444 hCompareRTrue_PhiR->Draw("colz");
0445 c5->cd(2);
0446 hRDiffvR_PhiR->Draw("colz");
0447 c5->cd(3);
0448 hRDiffvZ_PhiR->Draw("colz");
0449 c5->cd(4);
0450 hRDiffvPhi_PhiR->Draw("colz");
0451
0452
0453 c6->Divide(4,1);
0454 c6->cd(1);
0455 hComparePhiTrue_PhiR->Draw("colz");
0456 c6->cd(2);
0457 hPhiDiffvR_PhiR->Draw("colz");
0458 c6->cd(3);
0459 hPhiDiffvZ_PhiR->Draw("colz");
0460 c6->cd(4);
0461 hPhiDiffvPhi_PhiR->Draw("colz");
0462
0463 titlepad->cd();
0464 titlepad->Clear();
0465 title->DrawLatex(0.01,0.4,std::format("Event {}; {}", ifile, sourcefilename.Data()).c_str());
0466 title->Draw();
0467
0468 stitlepad1->cd();
0469 stitlepad1->Clear();
0470 stitle1->DrawLatex(0.45,0.2,"X Model");
0471 stitle1->Draw();
0472
0473 stitlepad2->cd();
0474 stitlepad2->Clear();
0475 stitle2->DrawLatex(0.45,0.2,"Y Model");
0476 stitle2->Draw();
0477
0478 stitlepad3->cd();
0479 stitlepad3->Clear();
0480 stitle3->DrawLatex(0.45,0.2,"R Model");
0481 stitle3->Draw();
0482
0483 stitlepad4->cd();
0484 stitlepad4->Clear();
0485 stitle4->DrawLatex(0.45,0.2,"Phi Model");
0486 stitle4->Draw();
0487
0488 stitlepad5->cd();
0489 stitlepad5->Clear();
0490 stitle5->DrawLatex(0.4,0.2,"Comparing R Model to True");
0491 stitle5->Draw();
0492
0493 stitlepad6->cd();
0494 stitlepad6->Clear();
0495 stitle6->DrawLatex(0.4,0.2,"Comparing Phi Model to True");
0496 stitle6->Draw();
0497
0498 if(ifile == 0){
0499
0500 canvas->Print("CMDistortionAnalysisPhiR.pdf(","pdf");
0501 } else if((ifile == 1) || (ifile == nEvents - 1)){
0502 canvas->Print("CMDistortionAnalysisPhiR.pdf","pdf");
0503 }
0504 }
0505
0506 TCanvas *summary = new TCanvas("summary","ShiftPlotsSummary",2000,3000);
0507
0508 TPad *sumtitlepad = new TPad("sumtitlepad","",0.0,0.96,1.0,1.0);
0509 TPad *sumplots = new TPad("sumplotspad","",0.0,0.0,1.0,0.96);
0510
0511 TLatex *sumtitle = new TLatex(0.0,0.0,"");
0512
0513 sumtitle->SetNDC();
0514 sumtitle->SetTextSize(0.4);
0515
0516 summary->cd();
0517 sumplots->Draw();
0518 sumtitlepad->Draw();
0519
0520 sumplots->Divide(4,6);
0521 sumplots->cd(1);
0522 hDifferenceMeanR->Draw();
0523 sumplots->cd(2);
0524 hDifferenceStdDevR->Draw();
0525 sumplots->cd(3);
0526 hTrueMeanR->Draw();
0527 sumplots->cd(4);
0528 hTrueStdDevR->Draw();
0529 sumplots->cd(5);
0530 hDifferenceMeanPhi->Draw();
0531 sumplots->cd(6);
0532 hDifferenceStdDevPhi->Draw();
0533 sumplots->cd(7);
0534 hTrueMeanPhi->Draw();
0535 sumplots->cd(8);
0536 hTrueStdDevPhi->Draw();
0537 sumplots->cd(9);
0538 sumplots->cd(10)->Clear();
0539 sumplots->cd(11)->Clear();
0540 sumplots->cd(12)->Clear();
0541 sumplots->cd(13)->Clear();
0542 sumplots->cd(14)->Clear();
0543 sumplots->cd(15)->Clear();
0544 sumplots->cd(16)->Clear();
0545 sumplots->cd(17)->Clear();
0546 sumplots->cd(18)->Clear();
0547 sumplots->cd(19)->Clear();
0548 sumplots->cd(20)->Clear();
0549 sumplots->cd(21)->Clear();
0550 sumplots->cd(22)->Clear();
0551 sumplots->cd(23)->Clear();
0552 sumplots->cd(24)->Clear();
0553
0554 sumtitlepad->cd();
0555 sumtitlepad->Clear();
0556 sumtitle->DrawLatex(0.4,0.4,"Summary of Events");
0557 summary->Print("CMDistortionAnalysisPhiR.pdf)","pdf");
0558
0559 return 0;
0560 }