modified: TrackRecon.C
modified: run_17F.sh renamed: scratch/make_pretty.C -> scratch/make_prettyplots.C
This commit is contained in:
parent
1fb12d2f46
commit
6104c6f7a9
25
TrackRecon.C
25
TrackRecon.C
|
|
@ -822,33 +822,50 @@ Bool_t TrackRecon::Process(Long64_t entry)
|
||||||
ctr += 1;
|
ctr += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (auto sx3event : SX3_Events)
|
||||||
|
{
|
||||||
double ts_rf = -987654321;
|
double ts_rf = -987654321;
|
||||||
double ts_needle = -987654321;
|
double ts_needle = -987654321;
|
||||||
double ts_mcp = -987654321;
|
double ts_mcp = -987654321;
|
||||||
|
double ts_sx3 = static_cast<double>(sx3event.Time1) + (rnd.Uniform(16.0) - 8.0);
|
||||||
bool found_rf = false;
|
bool found_rf = false;
|
||||||
bool found_mcp = false;
|
bool found_mcp = false;
|
||||||
bool found_needle = false;
|
bool found_needle = false;
|
||||||
|
|
||||||
for (int j = 0; j < misc.multi; j++)
|
for (int j = 0; j < misc.multi; j++)
|
||||||
{
|
{
|
||||||
plotter->Fill1D("channels_misc", 20, 0, 20, misc.ch[j], "misc");
|
plotter->Fill1D("channels_misc_sx3", 20, 0, 20, misc.ch[j], "misc");
|
||||||
if (misc.ch[j] == 2)
|
if (misc.ch[j] == 2)
|
||||||
{ // Needle
|
{ // Needle
|
||||||
|
plotter->Fill2D("needle_vs_sx3E", 800, 0, 16384, 800, 0, 10, misc.e[j], sx3event.Energy1, "misc");
|
||||||
ts_needle = static_cast<double>(misc.t[j]) + static_cast<double>(misc.tf[j]);
|
ts_needle = static_cast<double>(misc.t[j]) + static_cast<double>(misc.tf[j]);
|
||||||
found_needle = 1;
|
found_needle = 1;
|
||||||
|
plotter->Fill1D("dt_sx3_needle", 800, -2000, 2000, ts_sx3 - ts_needle, "misc");
|
||||||
}
|
}
|
||||||
if (misc.ch[j] == 3)
|
if (misc.ch[j] == 3)
|
||||||
{ // RF
|
{ // RF
|
||||||
ts_rf = static_cast<double>(misc.t[j]) + static_cast<double>(misc.tf[j]);
|
ts_rf = static_cast<double>(misc.t[j]) + static_cast<double>(misc.tf[j]);
|
||||||
found_rf = 1;
|
found_rf = 1;
|
||||||
|
plotter->Fill1D("dt_sx3_rf", 800, -2000, 2000, ts_sx3 - ts_rf, "misc");
|
||||||
}
|
}
|
||||||
if (misc.ch[j] == 4)
|
if (misc.ch[j] == 4)
|
||||||
{ // mcp
|
{ // mcp
|
||||||
ts_mcp = static_cast<double>(misc.t[j]) + static_cast<double>(misc.tf[j]);
|
ts_mcp = static_cast<double>(misc.t[j]) + static_cast<double>(misc.tf[j]);
|
||||||
found_mcp = 1;
|
found_mcp = 1;
|
||||||
|
plotter->Fill1D("dt_sx3_mcp", 800, -2000, 2000, ts_sx3 - ts_mcp, "misc");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
plotter->Fill1D("dt_rf_mcp_qqq", 500, -1000, 1000, ts_rf - ts_mcp, "misc");
|
if (found_rf && found_mcp)
|
||||||
|
{
|
||||||
|
if (ctr == 0)
|
||||||
|
plotter->Fill1D("dt_rf_mcp_sx3", 500, -1000, 1000, ts_rf - ts_mcp, "misc");
|
||||||
|
double dt_rf_mcp = ts_rf - ts_mcp;
|
||||||
|
double dt_sx3_rf = ts_sx3 - ts_rf;
|
||||||
|
double dt_sx3_mcp = ts_sx3 - ts_mcp;
|
||||||
|
plotter->Fill2D("dt(sx3,rf)_vs_(rf,mcp)", 640, -2000, 2000, 640, -2000, 2000, dt_sx3_rf, dt_rf_mcp, "misc");
|
||||||
|
plotter->Fill2D("dt_(sx3,mcp)_vs_(sx3,rf)", 640, -1400, 2000, 640, -2000, 2000, dt_sx3_mcp, dt_sx3_rf, "misc");
|
||||||
|
plotter->Fill2D("dt_(sx3,mcp)_vs_(rf,mcp)", 640, -1400, -600, 640, -2000, 2000, dt_sx3_mcp, dt_rf_mcp, "misc");
|
||||||
|
}
|
||||||
|
ctr += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ function run_once() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export -f run_once
|
export -f run_once
|
||||||
run_once 351
|
run_once 52
|
||||||
# parallel -j 6 --ctag run_once {1} ::: {350..400}
|
# parallel -j 6 --ctag run_once {1} ::: {350..400}
|
||||||
rm output_17F.root
|
rm output_17F.root
|
||||||
hadd -j 4 -k output_17F.root 17F_output/results_run3*.root
|
hadd -j 4 -k output_17F.root 17F_output/results_run3*.root
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,7 @@ void SetStyle() {
|
||||||
gStyle->SetNumberContours(255);
|
gStyle->SetNumberContours(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
void make_prettyplots(const char* rootFile,
|
||||||
// make_pretty()
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
void make_pretty(const char* rootFile,
|
|
||||||
const char* histName,
|
const char* histName,
|
||||||
const char* xlabel = "",
|
const char* xlabel = "",
|
||||||
const char* ylabel = "") {
|
const char* ylabel = "") {
|
||||||
|
|
@ -86,11 +83,6 @@ void make_pretty(const char* rootFile,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Clone and detach BEFORE closing the file ---------------------------
|
|
||||||
// ROOT ties every histogram to the TDirectory of the file it came from.
|
|
||||||
// When f->Close() is called, ROOT deletes all objects in that directory —
|
|
||||||
// including the clone — unless SetDirectory(0) is called first to detach
|
|
||||||
// it. Drawing a deleted object causes the segfault you are seeing.
|
|
||||||
TObject* clone = obj->Clone(Form("%s_clone", histName));
|
TObject* clone = obj->Clone(Form("%s_clone", histName));
|
||||||
if (!clone) {
|
if (!clone) {
|
||||||
std::cerr << "ERROR: Clone failed for '" << histName << "'\n";
|
std::cerr << "ERROR: Clone failed for '" << histName << "'\n";
|
||||||
|
|
@ -114,42 +106,30 @@ void make_pretty(const char* rootFile,
|
||||||
// Widen right margin for the colz palette bar
|
// Widen right margin for the colz palette bar
|
||||||
if (is2D) gPad->SetRightMargin(0.13);
|
if (is2D) gPad->SetRightMargin(0.13);
|
||||||
|
|
||||||
// --- Draw ---------------------------------------------------------------
|
|
||||||
if (is2D) {
|
if (is2D) {
|
||||||
TH2* h = (TH2*)clone;
|
TH2* h = (TH2*)clone;
|
||||||
h->SetStats(0);
|
h->SetStats(0);
|
||||||
h->GetXaxis()->SetTitle("");
|
h->GetXaxis()->SetTitle(xlabel);
|
||||||
h->GetYaxis()->SetTitle("");
|
h->GetYaxis()->SetTitle(ylabel);
|
||||||
|
h->GetXaxis()->SetTitleOffset(0.9);
|
||||||
|
h->GetYaxis()->SetTitleOffset(1.4);
|
||||||
|
h->GetXaxis()->CenterTitle(true);
|
||||||
|
h->GetYaxis()->CenterTitle(true);
|
||||||
h->Draw("colz");
|
h->Draw("colz");
|
||||||
} else {
|
} else {
|
||||||
TH1* h = (TH1*)clone;
|
TH1* h = (TH1*)clone;
|
||||||
h->SetStats(0);
|
h->SetStats(0);
|
||||||
h->SetLineColor(kBlue+1);
|
h->SetLineColor(kAzure-5);
|
||||||
h->SetFillColorAlpha(kBlue+1, 0.25);
|
h->SetLineWidth(3);
|
||||||
h->SetFillStyle(1001);
|
h->GetXaxis()->SetTitle(xlabel);
|
||||||
h->GetXaxis()->SetTitle("");
|
h->GetYaxis()->SetTitle(ylabel);
|
||||||
h->GetYaxis()->SetTitle("");
|
h->GetXaxis()->SetTitleOffset(0.9);
|
||||||
|
h->GetYaxis()->SetTitleOffset(1.4);
|
||||||
|
h->GetXaxis()->CenterTitle(true);
|
||||||
|
h->GetYaxis()->CenterTitle(true);
|
||||||
h->Draw("hist");
|
h->Draw("hist");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Axis labels via TLatex (full typographic control) ------------------
|
|
||||||
TLatex tex;
|
|
||||||
tex.SetNDC();
|
|
||||||
tex.SetTextFont(42);
|
|
||||||
tex.SetTextSize(0.050);
|
|
||||||
|
|
||||||
// X: y=0.06 sits just below the tick numbers inside the bottom margin (0.13).
|
|
||||||
// Y: x=0.08 sits just left of the tick numbers inside the left margin (0.14).
|
|
||||||
// Increase either value to push the label further from the axis.
|
|
||||||
if (strlen(xlabel) > 0)
|
|
||||||
tex.DrawLatex(0.46, 0.05, xlabel);
|
|
||||||
|
|
||||||
if (strlen(ylabel) > 0) {
|
|
||||||
tex.SetTextAngle(90);
|
|
||||||
tex.DrawLatex(0.08, 0.40, ylabel);
|
|
||||||
tex.SetTextAngle(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Save ---------------------------------------------------------------
|
// --- Save ---------------------------------------------------------------
|
||||||
// Build output path: same directory as input file, named after the histogram
|
// Build output path: same directory as input file, named after the histogram
|
||||||
std::string inPath(rootFile);
|
std::string inPath(rootFile);
|
||||||
Loading…
Reference in New Issue
Block a user