File indexing completed on 2025-01-30 09:15:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <tuple>
0017 #include "TFile.h"
0018 #include "TH2F.h"
0019 #include "TIterator.h"
0020 #include "TROOT.h"
0021 #include "TTree.h"
0022
0023
0024
0025
0026
0027
0028
0029
0030 void
0031 compareAssignedRealPos(std::string inFile,
0032 std::string infile_geoRZ = "",
0033 std::string histName_geoRZ = "",
0034 std::string infile_geoXY = "",
0035 std::string histName_geoXY = "")
0036 {
0037 std::cout << "Opening file: " << inFile << std::endl;
0038 TFile inputFile(inFile.c_str());
0039 TList* layers = inputFile.GetListOfKeys();
0040 std::cout << "Layers to print: " << std::endl;
0041 layers->Print();
0042 TIter next(layers);
0043 TObject* obj = 0;
0044
0045 int entry = 2;
0046 TCanvas* canvas1 = new TCanvas();
0047 TCanvas* canvas2 = new TCanvas();
0048
0049 while ((obj = next())) {
0050 inputFile.cd();
0051 TDirectory* dir = inputFile.GetDirectory(obj->GetName());
0052 TH2F* r_z = (TH2F*)dir->Get("r_z");
0053 TH2F* r_z_assigned = (TH2F*)dir->Get("r_z_assigned");
0054 TH2F* x_y = (TH2F*)dir->Get("x_y");
0055 TH2F* x_y_assigned = (TH2F*)dir->Get("x_y_assigned");
0056 if (entry == 17) entry = 20;
0057 if (entry == 10 || entry == 50) entry++;
0058 if (r_z && r_z_assigned) {
0059 canvas1->cd();
0060 r_z->SetStats(0);
0061 r_z->SetMarkerColor(TColor::GetColorDark(entry));
0062 r_z->SetMarkerStyle(6);
0063 r_z->GetXaxis()->SetTitle("z");
0064 r_z->GetYaxis()->SetTitle("r");
0065 r_z->Draw("same");
0066
0067 r_z_assigned->SetStats(0);
0068 r_z_assigned->SetMarkerColor(TColor::GetColorBright(entry));
0069 r_z_assigned->SetMarkerStyle(6);
0070 r_z_assigned->GetXaxis()->SetTitle("z");
0071 r_z_assigned->GetYaxis()->SetTitle("r");
0072 r_z_assigned->Draw("same");
0073
0074 r_z->SetDirectory(0);
0075 r_z_assigned->SetDirectory(0);
0076 }
0077 if (x_y && x_y_assigned) {
0078 canvas2->cd();
0079 x_y->SetStats(0);
0080 x_y->SetMarkerColor(TColor::GetColorDark(entry));
0081 x_y->SetMarkerStyle(6);
0082 x_y->GetXaxis()->SetTitle("x");
0083 x_y->GetYaxis()->SetTitle("y");
0084 x_y->Draw("same");
0085
0086 x_y_assigned->SetStats(0);
0087 x_y_assigned->SetMarkerColor(TColor::GetColorBright(entry));
0088 x_y_assigned->SetMarkerStyle(6);
0089 x_y_assigned->GetXaxis()->SetTitle("x");
0090 x_y_assigned->GetYaxis()->SetTitle("y");
0091 x_y_assigned->Draw("same");
0092
0093 x_y->SetDirectory(0);
0094 x_y_assigned->SetDirectory(0);
0095 }
0096 entry++;
0097 }
0098
0099 inputFile.Close();
0100
0101 std::cout << "Opening file: " << infile_geoRZ << std::endl;
0102 TFile inputFileRZ(infile_geoRZ.c_str());
0103
0104 TH2F* geo_rz = (TH2F*)inputFileRZ.Get(histName_geoRZ.c_str());
0105 canvas1->cd();
0106 if (geo_rz)
0107 geo_rz->Draw("same");
0108 else
0109 std::cout << "Can not access histogram with name: " << histName_geoRZ
0110 << std::endl;
0111 geo_rz->SetDirectory(0);
0112
0113 inputFileRZ.Close();
0114
0115 std::cout << "Opening file: " << infile_geoXY << std::endl;
0116 TFile inputFileXY(infile_geoXY.c_str());
0117
0118 TH2F* geo_xy = (TH2F*)inputFileXY.Get(histName_geoXY.c_str());
0119 canvas2->cd();
0120 if (geo_xy)
0121 geo_xy->Draw("same");
0122 else
0123 std::cout << "Can not access histogram with name: " << histName_geoXY
0124 << std::endl;
0125 geo_xy->SetDirectory(0);
0126
0127 inputFileXY.Close();
0128 }