2066 this->SetName(Form(
"Rt_%s",
folder.c_str()));
2069 cout <<
"in RtGraphs. Infile: " << string(
infile) << endl;
2071 TDirectory *trt =
nullptr;
2073 map<string, string> titlemap;
2077 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2078 titlemap[
"WholeBarrel_1"] =
"whole barrel";
2079 titlemap[
"Detector_-1"] =
"barrel C";
2080 titlemap[
"Detector_1"] =
"barrel A";
2081 titlemap[
"Detector_-2"] =
"end-cap C";
2082 titlemap[
"Detector_2"] =
"end-cap A";
2084 cout <<
" Xenon. Found TRT_all " << endl;
2086 cout <<
" Xenon. Did not find TRT_all " << endl;
2092 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2093 titlemap[
"WholeBarrel_Ar_1"] =
"whole Ar barrel";
2094 titlemap[
"Detector_Ar_-1"] =
"barrel Ar C";
2095 titlemap[
"Detector_Ar_1"] =
"barrel Ar A";
2096 titlemap[
"Detector_Ar_-2"] =
"end-cap Ar C";
2097 titlemap[
"Detector_Ar_2"] =
"end-cap Ar A";
2099 cout <<
" Argon. Found TRT_Ar_all " << endl;
2101 cout <<
" Argon. Did not find TRT_Ar_all " << endl;
2104 if (trt and (not
folder.empty()))
2106 cout <<
" PLOT FOR " <<
folder << endl;
2107 TDirectory *
det = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
2108 if (
det->FindKey(
"rt-relation"))
2110 cout <<
" found rt-relation " << endl;
2113 rthist->GetXaxis()->SetRangeUser(0, 40);
2115 sprintf(
name,
"rt (%s)", titlemap[
folder].c_str());
2117 if (
det->FindKey(
"rtgraph"))
2119 rtgraph = (TGraphErrors *)
det->FindKey(
"rtgraph")->ReadObj();
2120 cout <<
" found also rtgraph " << endl;
2125 cout <<
" did not found rtgraph " << endl;
2127 if (
det->FindKey(
"trgraph"))
2129 trgraph = (TGraphErrors *)
det->FindKey(
"trgraph")->ReadObj();
2130 cout <<
" found also trgraph " << endl;
2135 cout <<
" did not found trgraph " << endl;
2137 if (
det->FindKey(
"oldrtfunc"))
2139 oldrtfunc = (TF1 *)
det->FindKey(
"oldrtfunc")->ReadObj();
2140 cout <<
" found also oldrtfunc " << endl;
2145 cout <<
" did not find oldrtfunc " << endl;
2150 throw string(
" NO RT OBJECTS FOUND");
2153 else if (trt and trt->FindKey(
"rt-relation"))
2155 cout <<
" No folder. Found rt-relation. PLOT FOR TRT" << endl;
2156 rthist = (
TH2F *)trt->FindKey(
"rt-relation")->ReadObj();
2158 rthist->GetXaxis()->SetRangeUser(0, 40);
2159 rthist->SetTitle(
"r(t) for whole TRT");
2160 if (trt->FindKey(
"rtgraph"))
2162 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
2163 cout <<
" found also rtgraph " << endl;
2168 cout <<
" did not find rtgraph " << endl;
2170 if (trt->FindKey(
"trgraph"))
2172 trgraph = (TGraphErrors *)trt->FindKey(
"trgraph")->ReadObj();
2173 cout <<
" found also trgraph " << endl;
2178 cout <<
" did not find trgraph " << endl;
2180 if (trt->FindKey(
"oldrtfunc"))
2182 oldrtfunc = (TF1 *)trt->FindKey(
"oldrtfunc")->ReadObj();
2183 cout <<
" found also oldtrtfunc " << endl;
2188 cout <<
" did not find oldtrtfunc " << endl;
2193 cout <<
" No folder. No rt-relation." << endl;
2200 this->Divide(2, 1, 0.01, 0.01);
2203 TPad *c1_3 =
new TPad(
"c1_3",
"newpad", 0.01, 0.33, 0.99, 0.99);
2206 c1_3->SetTopMargin(0.1);
2207 c1_3->SetBottomMargin(0.01);
2208 c1_3->SetRightMargin(0.1);
2209 c1_3->SetFillStyle(0);
2216 cout <<
" found rtgraph for entire TRT " << endl;
2217 rtgraph->SetTitle(
"r(t) fit (whole TRT)");
2221 cout <<
" found rtgraph for folder: " <<
folder << endl;
2224 cout <<
" set rtgraph X title t-T0/ns and Y title |r|_{track}/mm" << endl;
2226 rtgraph->GetXaxis()->SetTitle(
"t-T0/ns");
2227 rtgraph->GetYaxis()->SetTitle(
"|r|_{track}/mm");
2229 rtgraph->GetXaxis()->SetTitleSize(0.06);
2230 rtgraph->GetXaxis()->SetLabelSize(0.06);
2235 rtgraph->GetYaxis()->SetRangeUser(-0.05, 2.6);
2236 cout <<
" Draw rtgraph " << endl;
2239 if (
rtgraph->GetFunction(
"rtfunc"))
2240 newRT =
rtgraph->GetFunction(
"rtfunc");
2242 newRT =
rtgraph->GetFunction(
"rtfunc2");
2245 cout <<
" Draw new fit " << endl;
2246 newRT->SetLineWidth(1);
2247 newRT->Draw(
"same");
2254 cout <<
" Draw old fit " << endl;
2259 TLegend *
leg =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
2261 leg->AddEntry(newRT,
"Fit",
"l");
2263 leg->SetTextSize(0.03);
2271 TPad *c1_4 =
new TPad(
"c1_4",
"newpad", 0.01, 0, 0.99, 0.32);
2274 c1_4->SetTopMargin(0.01);
2275 c1_4->SetBottomMargin(0.3);
2276 c1_4->SetRightMargin(0.1);
2277 c1_4->SetFillStyle(0);
2280 Double_t Xmax =
rtgraph->GetXaxis()->GetXmax();
2283 const Int_t
n = 300;
2287 Double_t Ymax = -10;
2290 for (Int_t
i = 0;
i <
n;
i++)
2300 TGraph *
gr1 =
new TGraph(
n,
x,
y);
2303 gr1->GetXaxis()->SetTitle(
"t-T0/ns");
2304 gr1->GetXaxis()->SetRangeUser(
Xmin, Xmax);
2305 gr1->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2306 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2308 gr1->GetYaxis()->SetNdivisions(5);
2309 gr1->GetXaxis()->SetTitleSize(0.06);
2310 gr1->GetXaxis()->SetLabelSize(0.06);
2311 gr1->GetYaxis()->SetLabelSize(0.08);
2312 gr1->GetYaxis()->SetTitleOffset(0.8);
2313 gr1->GetYaxis()->SetTitleSize(0.06);
2314 gr1->SetLineStyle(2);
2322 for (Int_t
i = 0;
i <
n1;
i++)
2328 y1.at(
i) =
Y - newRT->Eval(
X);
2331 if (
y1.at(
i) > Ymax)
2335 if (
y1.at(
i) < Ymin)
2341 TGraphErrors *
gr2 =
new TGraphErrors(
n1, &
x1.at(0), &
y1.at(0), &
ex1.at(0), &ey1.at(0));
2342 gr2->SetMarkerColor(2);
2343 gr2->SetMarkerStyle(20);
2345 gr2->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2347 gr2->GetYaxis()->SetRangeUser(-0.2, 0.2);
2348 gr2->GetXaxis()->SetRangeUser(-5, 50);
2349 cout <<
" Draw difference " << endl;
2353 TLine *line0 =
new TLine(
Xmin, 0, Xmax, 0);
2354 line0->SetLineColor(4);
2360 cout <<
" nullptr rtgraph " << endl;
2368 trgraph->SetTitle(
"t(r) fit (whole TRT)");
2372 sprintf(
name,
"t(r) fit (%s)", titlemap[
string(std::move(
folder))].c_str());
2376 trgraph->GetYaxis()->SetTitle(
"t-T0/ns");
2377 trgraph->GetXaxis()->SetTitle(
"|r|_{track}/mm");
2381 cout <<
" Draw trgraph " << endl;
2386 cout <<
" nullptr trgraph " << endl;
2389 gStyle->SetOptStat(1);