2067 this->SetName(Form(
"Rt_%s",
folder.c_str()));
2070 cout <<
"in RtGraphs. Infile: " << string(
infile) << endl;
2072 TDirectory *trt =
nullptr;
2074 map<string, string> titlemap;
2078 trt = (TDirectory *)
file->FindKey(
"TRT_all")->ReadObj();
2079 titlemap[
"WholeBarrel_1"] =
"whole barrel";
2080 titlemap[
"Detector_-1"] =
"barrel C";
2081 titlemap[
"Detector_1"] =
"barrel A";
2082 titlemap[
"Detector_-2"] =
"end-cap C";
2083 titlemap[
"Detector_2"] =
"end-cap A";
2085 cout <<
" Xenon. Found TRT_all " << endl;
2087 cout <<
" Xenon. Did not find TRT_all " << endl;
2093 trt = (TDirectory *)
file->FindKey(
"TRT_Ar_all")->ReadObj();
2094 titlemap[
"WholeBarrel_Ar_1"] =
"whole Ar barrel";
2095 titlemap[
"Detector_Ar_-1"] =
"barrel Ar C";
2096 titlemap[
"Detector_Ar_1"] =
"barrel Ar A";
2097 titlemap[
"Detector_Ar_-2"] =
"end-cap Ar C";
2098 titlemap[
"Detector_Ar_2"] =
"end-cap Ar A";
2100 cout <<
" Argon. Found TRT_Ar_all " << endl;
2102 cout <<
" Argon. Did not find TRT_Ar_all " << endl;
2105 if (trt and (not
folder.empty()))
2107 cout <<
" PLOT FOR " <<
folder << endl;
2108 TDirectory *
det = (TDirectory *)trt->FindKey(
folder.c_str())->ReadObj();
2109 if (
det->FindKey(
"rt-relation"))
2111 cout <<
" found rt-relation " << endl;
2114 rthist->GetXaxis()->SetRangeUser(0, 40);
2116 sprintf(
name,
"rt (%s)", titlemap[
folder].c_str());
2118 if (
det->FindKey(
"rtgraph"))
2120 rtgraph = (TGraphErrors *)
det->FindKey(
"rtgraph")->ReadObj();
2121 cout <<
" found also rtgraph " << endl;
2126 cout <<
" did not found rtgraph " << endl;
2128 if (
det->FindKey(
"trgraph"))
2130 trgraph = (TGraphErrors *)
det->FindKey(
"trgraph")->ReadObj();
2131 cout <<
" found also trgraph " << endl;
2136 cout <<
" did not found trgraph " << endl;
2138 if (
det->FindKey(
"oldrtfunc"))
2140 oldrtfunc = (TF1 *)
det->FindKey(
"oldrtfunc")->ReadObj();
2141 cout <<
" found also oldrtfunc " << endl;
2146 cout <<
" did not find oldrtfunc " << endl;
2151 throw string(
" NO RT OBJECTS FOUND");
2154 else if (trt and trt->FindKey(
"rt-relation"))
2156 cout <<
" No folder. Found rt-relation. PLOT FOR TRT" << endl;
2157 rthist = (
TH2F *)trt->FindKey(
"rt-relation")->ReadObj();
2159 rthist->GetXaxis()->SetRangeUser(0, 40);
2160 rthist->SetTitle(
"r(t) for whole TRT");
2161 if (trt->FindKey(
"rtgraph"))
2163 rtgraph = (TGraphErrors *)trt->FindKey(
"rtgraph")->ReadObj();
2164 cout <<
" found also rtgraph " << endl;
2169 cout <<
" did not find rtgraph " << endl;
2171 if (trt->FindKey(
"trgraph"))
2173 trgraph = (TGraphErrors *)trt->FindKey(
"trgraph")->ReadObj();
2174 cout <<
" found also trgraph " << endl;
2179 cout <<
" did not find trgraph " << endl;
2181 if (trt->FindKey(
"oldrtfunc"))
2183 oldrtfunc = (TF1 *)trt->FindKey(
"oldrtfunc")->ReadObj();
2184 cout <<
" found also oldtrtfunc " << endl;
2189 cout <<
" did not find oldtrtfunc " << endl;
2194 cout <<
" No folder. No rt-relation." << endl;
2201 this->Divide(2, 1, 0.01, 0.01);
2204 TPad *c1_3 =
new TPad(
"c1_3",
"newpad", 0.01, 0.33, 0.99, 0.99);
2207 c1_3->SetTopMargin(0.1);
2208 c1_3->SetBottomMargin(0.01);
2209 c1_3->SetRightMargin(0.1);
2210 c1_3->SetFillStyle(0);
2217 cout <<
" found rtgraph for entire TRT " << endl;
2218 rtgraph->SetTitle(
"r(t) fit (whole TRT)");
2222 cout <<
" found rtgraph for folder: " <<
folder << endl;
2225 cout <<
" set rtgraph X title t-T0/ns and Y title |r|_{track}/mm" << endl;
2227 rtgraph->GetXaxis()->SetTitle(
"t-T0/ns");
2228 rtgraph->GetYaxis()->SetTitle(
"|r|_{track}/mm");
2230 rtgraph->GetXaxis()->SetTitleSize(0.06);
2231 rtgraph->GetXaxis()->SetLabelSize(0.06);
2236 rtgraph->GetYaxis()->SetRangeUser(-0.05, 2.6);
2237 cout <<
" Draw rtgraph " << endl;
2240 if (
rtgraph->GetFunction(
"rtfunc"))
2241 newRT =
rtgraph->GetFunction(
"rtfunc");
2243 newRT =
rtgraph->GetFunction(
"rtfunc2");
2246 cout <<
" Draw new fit " << endl;
2247 newRT->SetLineWidth(1);
2248 newRT->Draw(
"same");
2255 cout <<
" Draw old fit " << endl;
2260 TLegend *
leg =
new TLegend(0.7155172, 0.1038136, 0.8965517, 0.2542373,
nullptr,
"brNDC");
2262 leg->AddEntry(newRT,
"Fit",
"l");
2264 leg->SetTextSize(0.03);
2272 TPad *c1_4 =
new TPad(
"c1_4",
"newpad", 0.01, 0, 0.99, 0.32);
2275 c1_4->SetTopMargin(0.01);
2276 c1_4->SetBottomMargin(0.3);
2277 c1_4->SetRightMargin(0.1);
2278 c1_4->SetFillStyle(0);
2281 Double_t Xmax =
rtgraph->GetXaxis()->GetXmax();
2284 const Int_t
n = 300;
2288 Double_t Ymax = -10;
2291 for (Int_t
i = 0;
i <
n;
i++)
2301 TGraph *
gr1 =
new TGraph(
n,
x,
y);
2304 gr1->GetXaxis()->SetTitle(
"t-T0/ns");
2305 gr1->GetXaxis()->SetRangeUser(
Xmin, Xmax);
2306 gr1->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2307 gr1->GetYaxis()->SetRangeUser(-0.1, 0.1);
2309 gr1->GetYaxis()->SetNdivisions(5);
2310 gr1->GetXaxis()->SetTitleSize(0.06);
2311 gr1->GetXaxis()->SetLabelSize(0.06);
2312 gr1->GetYaxis()->SetLabelSize(0.08);
2313 gr1->GetYaxis()->SetTitleOffset(0.8);
2314 gr1->GetYaxis()->SetTitleSize(0.06);
2315 gr1->SetLineStyle(2);
2323 for (Int_t
i = 0;
i <
n1;
i++)
2329 y1.at(
i) =
Y - newRT->Eval(
X);
2332 if (
y1.at(
i) > Ymax)
2336 if (
y1.at(
i) < Ymin)
2342 TGraphErrors *
gr2 =
new TGraphErrors(
n1, &
x1.at(0), &
y1.at(0), &
ex1.at(0), &ey1.at(0));
2343 gr2->SetMarkerColor(2);
2344 gr2->SetMarkerStyle(20);
2346 gr2->GetYaxis()->SetTitle(
"Old r(t) - New r(t) /mm");
2348 gr2->GetYaxis()->SetRangeUser(-0.2, 0.2);
2349 gr2->GetXaxis()->SetRangeUser(-5, 50);
2350 cout <<
" Draw difference " << endl;
2354 TLine *line0 =
new TLine(
Xmin, 0, Xmax, 0);
2355 line0->SetLineColor(4);
2361 cout <<
" nullptr rtgraph " << endl;
2369 trgraph->SetTitle(
"t(r) fit (whole TRT)");
2374 sprintf(
name,
"t(r) fit (%s)", titlemap[
string(
folder)].c_str());
2378 trgraph->GetYaxis()->SetTitle(
"t-T0/ns");
2379 trgraph->GetXaxis()->SetTitle(
"|r|_{track}/mm");
2383 cout <<
" Draw trgraph " << endl;
2388 cout <<
" nullptr trgraph " << endl;
2391 gStyle->SetOptStat(1);