ATLAS Offline Software
Loading...
Searching...
No Matches
RtColor Class Reference
Inheritance diagram for RtColor:
Collaboration diagram for RtColor:

Public Member Functions

 RtColor (char *, const string &, bool)

Public Attributes

TH2F * hist {}
TGraphErrors * rtgraph {}
TF1 * oldrtfunc {}
TF1 * newRT {}

Detailed Description

Definition at line 2707 of file TRTCalib_makeplots.cxx.

Constructor & Destructor Documentation

◆ RtColor()

RtColor::RtColor ( char * infile,
const string & folder,
bool isAr = false )

Definition at line 2717 of file TRTCalib_makeplots.cxx.

2718{
2719
2720 map<string, string> titlemap;
2721 titlemap["WholeBarrel_1"] = "whole barrel";
2722 titlemap["Detector_-1"] = "barrel C";
2723 titlemap["Detector_1"] = "barrel A";
2724 titlemap["Detector_-2"] = "end-cap C";
2725 titlemap["Detector_2"] = "end-cap A";
2726
2727 titlemap["WholeBarrel_Ar_1"] = "whole barrel";
2728 titlemap["Detector_Ar_-1"] = "barrel C";
2729 titlemap["Detector_Ar_1"] = "barrel A";
2730 titlemap["Detector_Ar_-2"] = "end-cap C";
2731 titlemap["Detector_Ar-2"] = "end-cap A";
2732
2733 TFile *file = new TFile(infile);
2734 // cout << infile << endl;
2735
2736 TPad *c1_3 = new TPad("c1_3", "newpad", 0.01, 0.33, 0.99, 0.99);
2737 c1_3->Draw();
2738 c1_3->cd();
2739 c1_3->SetTopMargin(0.1);
2740 c1_3->SetBottomMargin(0.01);
2741 c1_3->SetRightMargin(0.1);
2742 c1_3->SetFillStyle(0);
2743 c1_3->SetGrid();
2744
2745 file->cd();
2746
2747 TDirectory *trt = nullptr;
2748 if (!isAr)
2749 trt = (TDirectory *)file->FindKey("TRT_all")->ReadObj();
2750 else
2751 trt = (TDirectory *)file->FindKey("TRT_Ar_all")->ReadObj();
2752
2753 if (folder != "")
2754 {
2755 TDirectory *det = (TDirectory *)trt->FindKey(folder.c_str())->ReadObj();
2756 cout << " RtColor plot for folder" << folder << endl;
2757 if (det->FindKey("rt-relation"))
2758 {
2759 hist = (TH2F *)det->FindKey("rt-relation")->ReadObj();
2760 // this->cd();
2761 if (hist)
2762 {
2763 cout << " found rt-relation " << endl;
2764 hist->GetXaxis()->SetRangeUser(0, 40);
2765 hist->GetYaxis()->SetRangeUser(0, 2.4);
2766 char name[500];
2767 sprintf(name, "r(t) for %s", folder.c_str());
2768 if (isAr)
2769 sprintf(name, "Argon r(t) for %s", folder.c_str());
2770 hist->SetTitle(name);
2771 hist->GetXaxis()->SetRangeUser(0, 50);
2772 hist->Draw("colz");
2773
2774 if (det->FindKey("rtgraph"))
2775 {
2776 cout << " found rtgraph " << endl;
2777 rtgraph = (TGraphErrors *)det->FindKey("rtgraph")->ReadObj();
2778 rtgraph->SetMarkerStyle(20);
2779 rtgraph->SetMarkerColor(1);
2780 rtgraph->SetLineColor(1);
2781 rtgraph->GetYaxis()->SetRangeUser(0, 2.4);
2782 rtgraph->Draw("p");
2783 if (rtgraph->GetFunction("rtfunc"))
2784 newRT = rtgraph->GetFunction("rtfunc");
2785 else
2786 newRT = rtgraph->GetFunction("rtfunc2");
2787 }
2788 if (det->FindKey("oldrtfunc"))
2789 {
2790 cout << " found oldrtfunc " << endl;
2791 oldrtfunc = (TF1 *)det->FindKey("oldrtfunc")->ReadObj();
2792 oldrtfunc->SetRange(0, 50);
2793 oldrtfunc->Draw("same");
2794 }
2795 }
2796 }
2797 else
2798 {
2799 throw string(" NO RT OBJECTS FOUND");
2800 }
2801 }
2802 else if (trt->FindKey("rt-relation"))
2803 {
2804 cout << " RtColor Plot entire TRT" << endl;
2805 hist = (TH2F *)trt->FindKey("rt-relation")->ReadObj();
2806 // this->cd();
2807 hist->GetXaxis()->SetRangeUser(0, 40);
2808 hist->SetTitle("r(t) for whole TRT");
2809 if (isAr)
2810 hist->SetTitle("Argon r(t) for whole TRT");
2811 hist->GetYaxis()->SetRangeUser(0, 2.4);
2812 hist->GetXaxis()->SetRangeUser(0, 50);
2813 hist->Draw("colz");
2814 if (trt->FindKey("rtgraph"))
2815 {
2816 rtgraph = (TGraphErrors *)trt->FindKey("rtgraph")->ReadObj();
2817 rtgraph->SetMarkerStyle(20);
2818 rtgraph->SetLineColor(1);
2819 rtgraph->SetMarkerColor(1);
2820 rtgraph->GetYaxis()->SetRangeUser(0, 2.4);
2821 if (rtgraph->GetFunction("rtfunc"))
2822 newRT = rtgraph->GetFunction("rtfunc");
2823 else
2824 newRT = rtgraph->GetFunction("rtfunc2");
2825 rtgraph->Draw("p");
2826 }
2827 if (trt->FindKey("oldrtfunc"))
2828 {
2829 oldrtfunc = (TF1 *)trt->FindKey("oldrtfunc")->ReadObj();
2830 oldrtfunc->SetRange(0, 50);
2831 oldrtfunc->Draw("same");
2832 }
2833 }
2834 else
2835 hist = nullptr;
2836
2837 // Draw the ratio plots just below:
2838
2839 // Plot the difference between old and new rt:
2840 if (oldrtfunc)
2841 {
2842 this->cd();
2843 this->cd(1);
2844 TPad *c1_4 = new TPad("c1_4", "newpad", 0.01, 0, 0.99, 0.32);
2845 c1_4->Draw();
2846 c1_4->cd();
2847 c1_4->SetTopMargin(0.01);
2848 c1_4->SetBottomMargin(0.3);
2849 c1_4->SetRightMargin(0.1);
2850 c1_4->SetFillStyle(0);
2851 c1_4->SetGrid();
2852
2853 Double_t Xmax = rtgraph->GetXaxis()->GetXmax();
2854 Double_t Xmin = rtgraph->GetXaxis()->GetXmin();
2855
2856 const Int_t n = 300;
2857 Double_t x[n], y[n], dx;
2858 dx = (Xmax - Xmin) / n;
2859
2860 Double_t Ymax = -10;
2861 Double_t Ymin = 10;
2862
2863 newRT->SetRange(-10., 60.);
2864 oldrtfunc->SetRange(-10., 60.);
2865
2866 for (Int_t i = 0; i < n; i++)
2867 {
2868 x[i] = Xmin + i * dx;
2869 y[i] = (oldrtfunc->Eval(x[i]) - newRT->Eval(x[i]));
2870 if (y[i] > Ymax)
2871 Ymax = y[i];
2872 if (y[i] < Ymin)
2873 Ymin = y[i];
2874 }
2875
2876 TGraph *gr1 = new TGraph(n, x, y);
2877
2878 // gStyle->SetOptTitle(0);
2879 gr1->SetTitle("");
2880 gr1->GetXaxis()->SetTitle("t-T0/ns");
2881 gr1->GetXaxis()->SetRangeUser(Xmin, Xmax);
2882 gr1->GetYaxis()->SetTitle("Old r(t) - New r(t) /mm");
2883 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2884 // gr1->GetYaxis()->SetRangeUser(1.1*Ymin,1.1*Ymax);
2885 gr1->GetYaxis()->SetNdivisions(5);
2886 gr1->GetXaxis()->SetTitleSize(0.06);
2887 gr1->GetXaxis()->SetLabelSize(0.06);
2888 gr1->GetYaxis()->SetLabelSize(0.08);
2889 gr1->GetYaxis()->SetTitleOffset(0.8);
2890 gr1->GetYaxis()->SetTitleSize(0.06);
2891 gr1->SetLineStyle(2);
2892
2893 // Also add the difference between the fit and the points of the fit
2894
2895 Int_t n1 = rtgraph->GetN();
2896 std::vector<Double_t> x1(n1,0), y1(n1,0), ex1(n1,0), ey1(n1,0);
2897 Double_t X, Y;
2898
2899 for (Int_t i = 0; i < n1; i++)
2900 {
2901 X = 0;
2902 Y = 0;
2903 rtgraph->GetPoint(i, X, Y);
2904 x1.at(i) = X;
2905 y1.at(i) = Y - newRT->Eval(X);
2906 ex1.at(i) = 0;
2907 ey1.at(i) = rtgraph->GetErrorY(i);
2908 if (y1.at(i) > Ymax)
2909 Ymax = y1.at(i);
2910 if (y1.at(i) < Ymin)
2911 Ymin = y1.at(i);
2912 }
2913 // gr1->Draw("APL");
2914
2915 TGraphErrors *gr2 = new TGraphErrors(n1, &x1.at(0), &y1.at(0), &ex1.at(0), &ey1.at(0));
2916 gr2->SetMarkerColor(kBlack);
2917 gr2->SetMarkerStyle(20);
2918 gr2->SetTitle("");
2919 gr2->GetYaxis()->SetTitle("Old r(t) - New r(t) /mm");
2920
2921 // gr2->GetYaxis()->SetRangeUser(1.1*Ymin,1.1*Ymax);
2922 gr2->GetYaxis()->SetRangeUser(-0.1, 0.1);
2923 gr2->GetXaxis()->SetRangeUser(0, 50);
2924
2925 gr2->Draw("ap");
2926 gr1->Draw("l");
2927
2928 TLine *line0 = new TLine(0, 0, 50, 0);
2929 line0->SetLineColor(4);
2930 line0->Draw();
2931 }
2932}
#define y
#define x
TGraphErrors * rtgraph
const float Xmin
Definition VertexShift.h:25
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
TFile * file

Member Data Documentation

◆ hist

TH2F* RtColor::hist {}

Definition at line 2711 of file TRTCalib_makeplots.cxx.

2711{};

◆ newRT

TF1* RtColor::newRT {}

Definition at line 2714 of file TRTCalib_makeplots.cxx.

2714{};

◆ oldrtfunc

TF1* RtColor::oldrtfunc {}

Definition at line 2713 of file TRTCalib_makeplots.cxx.

2713{};

◆ rtgraph

TGraphErrors* RtColor::rtgraph {}

Definition at line 2712 of file TRTCalib_makeplots.cxx.

2712{};

The documentation for this class was generated from the following file: