ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
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 2705 of file TRTCalib_makeplots.cxx.

Constructor & Destructor Documentation

◆ RtColor()

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

Definition at line 2715 of file TRTCalib_makeplots.cxx.

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

Member Data Documentation

◆ hist

TH2F* RtColor::hist {}

Definition at line 2709 of file TRTCalib_makeplots.cxx.

◆ newRT

TF1* RtColor::newRT {}

Definition at line 2712 of file TRTCalib_makeplots.cxx.

◆ oldrtfunc

TF1* RtColor::oldrtfunc {}

Definition at line 2711 of file TRTCalib_makeplots.cxx.

◆ rtgraph

TGraphErrors* RtColor::rtgraph {}

Definition at line 2710 of file TRTCalib_makeplots.cxx.


The documentation for this class was generated from the following file:
plotBeamSpotCompare.ex1
ex1
Definition: plotBeamSpotCompare.py:217
plotBeamSpotCompare.gr1
gr1
Definition: plotBeamSpotCompare.py:391
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
run.infile
string infile
Definition: run.py:13
VertexShift::Xmin
const float Xmin
Definition: VertexShift.h:25
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
RtColor::hist
TH2F * hist
Definition: TRTCalib_makeplots.cxx:2709
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
x
#define x
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
Monitored::X
@ X
Definition: HistogramFillerUtils.h:24
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
RtColor::oldrtfunc
TF1 * oldrtfunc
Definition: TRTCalib_makeplots.cxx:2711
RtColor::newRT
TF1 * newRT
Definition: TRTCalib_makeplots.cxx:2712
file
TFile * file
Definition: tile_monitor.h:29
Monitored::Y
@ Y
Definition: HistogramFillerUtils.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
dqt_zlumi_display_z_rate.gr2
gr2
Definition: dqt_zlumi_display_z_rate.py:81
y
#define y
makeTRTBarrelCans.dx
tuple dx
Definition: makeTRTBarrelCans.py:20
CaloCondBlobAlgs_fillNoiseFromASCII.folder
folder
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:56
calibdata.cd
cd
Definition: calibdata.py:51
RtColor::rtgraph
TGraphErrors * rtgraph
Definition: TRTCalib_makeplots.cxx:2710