modified: TrackRecon.C added plots for dE_cal vs dT and Ex vs dT
modified: eloss_calculations/alpha_lookup_50MeV_250torr_3pc.dat for 0.89 dedx modified: eloss_calculations/aluminum_lookup_80MeV_250torr_3pc.dat modified: eloss_calculations/deutron_lookup_30MeV_250torr_3pc.dat modified: eloss_calculations/fluorine_lookup_70MeV_250torr_3pc.dat modified: eloss_calculations/oxygen_lookup_70MeV_250torr_3pc.dat modified: eloss_calculations/proton_lookup_30MeV_250torr_3pc.dat modified: run_27Al.sh collapsed the parallelization a bit modified: scratch/overlay_2d.C added minz, rebinning and box option
This commit is contained in:
parent
ffb1c1a960
commit
78add5432a
43
TrackRecon.C
43
TrackRecon.C
|
|
@ -4018,28 +4018,28 @@ static void reaction_ax_core(HistPlotter *plotter, const std::vector<Event> &Si_
|
|||
beam_energy_at_vertex, ebeam_kin_MeV, pmlabel);
|
||||
if (ejtag == "_p")
|
||||
{
|
||||
if (beam_energy_at_vertex < 4.0 && beam_energy_at_vertex > 0.1)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKinGS" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_GS, folderPrefix + "ETrackvsKin_assumed");
|
||||
else if (beam_energy_at_vertex <= 12.0)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin2235keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_2235keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
else if (beam_energy_at_vertex < 24.0)
|
||||
// if (beam_energy_at_vertex < 4.0 && beam_energy_at_vertex > 0.1)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKinGS" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_GS, folderPrefix + "ETrackvsKin_assumed");
|
||||
// else if (beam_energy_at_vertex <= 12.0)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin2235keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_2235keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
// else if (beam_energy_at_vertex < 24.0)
|
||||
{
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin3498keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_3498keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin3774keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_3774keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
}
|
||||
else if (beam_energy_at_vertex <= 36.00)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin4809keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_4809keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
else if (beam_energy_at_vertex < 42.0)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin5614keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_5614keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
else
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin6550keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_6550keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
// else if (beam_energy_at_vertex <= 36.00)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin4809keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_4809keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
// else if (beam_energy_at_vertex < 42.0)
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin5614keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_5614keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
// else
|
||||
plotter->Fill2D(rx + "_ETrack_vs_EKin6550keV" + ejtag + t + sfx, 400, 0, beamE0 * 1.5, 400, 0, beamE0 * 1.5,
|
||||
beam_energy_at_vertex, ebeam_kin_6550keV, folderPrefix + "ETrackvsKin_assumed");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -4056,6 +4056,17 @@ static void reaction_ax_core(HistPlotter *plotter, const std::vector<Event> &Si_
|
|||
plotter->Fill1D(rx + "_pczfix" + sfx, 600, -300, 300, pcz_fix, pmlabel);
|
||||
plotter->Fill2D(rx + "_Ef_vs_theta" + ejtag + sfx, 100, 0, 180, 800, 0, ef_max, theta * 180 / M_PI, Efix, pmlabel);
|
||||
plotter->Fill2D(rx + "_Ex_vs_phi" + ejtag + sfx, 180, -180, 180, 600, -10, 20, phi * 180 / M_PI, Ex, pmlabel);
|
||||
|
||||
for (const auto &pcevent : PC_Events)
|
||||
{
|
||||
if (!(pcevent.multi1 == 1 && (pcevent.multi2 == 1 || pcevent.multi2 == 2)))
|
||||
continue;
|
||||
if (TMath::Abs(sievent.pos.DeltaPhi(pcevent.pos)) > phi_win)
|
||||
continue;
|
||||
plotter->Fill2D(rx + "_Ex_vs_dT" + ejtag + sfx, 500, -2000, 2000, 600, -10, 20, (sievent.Time1 - pcevent.Time1), Ex, pmlabel);
|
||||
plotter->Fill2D(rx + "_dEgasCalib_vs_dT" + ejtag + sfx, 500, -2000, 2000, 800, 0, 0.6, (sievent.Time1 - pcevent.Time1), anodeE_MeV, pmlabel);
|
||||
}
|
||||
|
||||
if (dt_rf_mcp > -900000000)
|
||||
plotter->Fill2D(rx + "_Ex_vs_TOF_rf_mcp" + ejtag + sfx, 500, -1000, 1000, 800, -20, 20, dt_rf_mcp, Ex, pmlabel);
|
||||
plotter->Fill1D(rx + "_VertexReconZ" + sfx, 800, -400, 400, vertex_z, pmlabel);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -3,12 +3,13 @@
|
|||
export DATASET="27Al"
|
||||
export PREFIX="Run_"
|
||||
export OUT_DIR="Output_27Al"
|
||||
export OUT_DIR="Output_27Al"
|
||||
export reactiondata=1
|
||||
export CO2percent=3
|
||||
export pressure_in_torr=250
|
||||
export CATHODE_GAIN=3.0
|
||||
export source_vertex=-200.0
|
||||
export DEDX_SCALE=0.9
|
||||
export DEDX_SCALE=0.89
|
||||
export CUTLIST=cuts_list.txt
|
||||
export BEAM_AXIS_X=0
|
||||
export BEAM_AXIS_Y=0
|
||||
|
|
@ -48,6 +49,7 @@ export -f process_run
|
|||
# Define and create a clean directory name BEFORE running parallel tasks
|
||||
# CURRENT_OUT_DIR="Output_27Al_X${BEAM_AXIS_X}_Y${BEAM_AXIS_Y}"
|
||||
CURRENT_OUT_DIR="Output_27Al"
|
||||
# CURRENT_OUT_DIR="Output_27Al_run_48"
|
||||
mkdir -p "$CURRENT_OUT_DIR"
|
||||
|
||||
echo "Running Eloss.py with a scaling parameter of $DEDX_SCALE"
|
||||
|
|
@ -56,8 +58,8 @@ export -f process_run
|
|||
|
||||
echo "Starting parallel processing..."
|
||||
time parallel --bar -j 10 process_run ::: {24..41}
|
||||
time parallel --bar -j 3 process_run ::: 44 45 46
|
||||
time parallel --bar -j 8 process_run ::: {50..59}
|
||||
time parallel --bar -j 10 process_run ::: 44 45 46 {50..59}
|
||||
# time parallel --bar -j 10 process_run ::: 48 # pc without coincidence
|
||||
# time parallel --bar -j 4 process_run ::: 62 63 66 67 68
|
||||
# time parallel --bar -j 1 process_run ::: 73
|
||||
# time parallel --bar -j 1 process_run ::: 74
|
||||
|
|
|
|||
|
|
@ -1,39 +1,121 @@
|
|||
// overlay_2d.C
|
||||
//
|
||||
// Overlays several 2D histograms from one ROOT file onto a single canvas,
|
||||
// one fill colour per histogram, with a dashed y = x reference line and a
|
||||
// legend. Originally built around "scat"/marker-coloured points; now uses
|
||||
// "box" so each histogram's colour comes from SetFillColor (which "colz"
|
||||
// does not respect when several histograms are drawn on the same pad).
|
||||
//
|
||||
// Which histograms to draw is now HARDCODED at the top of overlay_2d(),
|
||||
// built from the selectors below rather than typed out as a full CSV
|
||||
// string each time. Histogram names follow TrackRecon.C's convention:
|
||||
//
|
||||
// <reaction>_ETrack_vs_EKin<state><ejtag>_<topology>_<detector>
|
||||
//
|
||||
// e.g. "m27Alax_ETrack_vs_EKin2235keV_p_a1c2fix_sx3". Edit reaction /
|
||||
// ejtag / topology / detector / states / labels below to change what's
|
||||
// plotted -- everything else in the file stays the same.
|
||||
//
|
||||
// Other notes:
|
||||
// - rebinX / rebinY: applied to every cloned histogram before drawing,
|
||||
// to smooth out the speckled look of narrow source binning.
|
||||
// - minz: floor applied via SetMinimum() so bins with only one or two
|
||||
// entries (noise at the edges of each locus) don't draw at all.
|
||||
// - xlo[] / xhi[]: hardcoded per-state display windows (MeV), same
|
||||
// order as states[]. Applied by zeroing each histogram's bins outside
|
||||
// its own [xlo[i], xhi[i)) window before drawing -- NOT via
|
||||
// SetRangeUser, because SetRangeUser on the first-drawn histogram
|
||||
// would also shrink the pad's FRAME to that histogram's own narrow
|
||||
// window (the first Draw() call is what sets the frame's axis
|
||||
// limits), clipping every other state out of the picture entirely
|
||||
// rather than just cropping its own content. Zeroing bins keeps the
|
||||
// frame at its full native range while still restricting each
|
||||
// histogram's drawn content to its own tier.
|
||||
// THIS IS CURRENTLY A NO-OP either way: TrackRecon.C still fills each
|
||||
// of the six histograms exclusively within its own tier at fill time
|
||||
// (the if/else chain at TrackRecon.C:4015-4041), so every bin outside
|
||||
// a given histogram's own window is already zero -- there's nothing
|
||||
// there to zero out. This starts doing real work only once
|
||||
// TrackRecon.C fills all six histograms unconditionally for every
|
||||
// event (dropping that if/else so every proton event contributes to
|
||||
// all six, each under its own Ex assumption); only then does this
|
||||
// become the thing separating the states, rather than a redundant
|
||||
// no-op.
|
||||
// - The diagonal line's range is read from the first histogram's own
|
||||
// axis limits (not hardcoded), with enough sample points (SetNpx) to
|
||||
// reach both corners cleanly.
|
||||
//
|
||||
// Call, now just: rootFile, axis labels, and the drawing knobs --
|
||||
//
|
||||
// root -l -b -q 'scratch/overlay_2d.C("Output_27Al/output_27Al.root", "Tracked Beam Energy (MeV)", "Kinematic Energy (MeV)", 2, 2, 2.0)'
|
||||
|
||||
#include "TFile.h"
|
||||
#include "TH2.h"
|
||||
#include "TCanvas.h"
|
||||
#include "TStyle.h"
|
||||
#include "TLegend.h"
|
||||
#include "TObjArray.h"
|
||||
#include "TObjString.h"
|
||||
#include "TF1.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
void overlay_2d(TString rootFile, TString histsCSV, TString labelsCSV, TString xAxisLabel, TString yAxisLabel)
|
||||
void overlay_2d(TString rootFile, TString xAxisLabel, TString yAxisLabel,
|
||||
int rebinX = 8, int rebinY = 8, double minz = 5.0)
|
||||
{
|
||||
gROOT->SetStyle("Plain");
|
||||
gStyle->SetOptStat(0);
|
||||
|
||||
TObjArray *histArr = histsCSV.Tokenize(",");
|
||||
TObjArray *labelArr = labelsCSV.Tokenize(",");
|
||||
// ---- Hardcoded selection: edit these to choose what to plot ----
|
||||
TString reaction = "m27Alax"; // reaction tag, e.g. "m27Alax", "m17Fax"
|
||||
TString ejtag = "p"; // ejectile: "p" (proton) or "a" (alpha)
|
||||
TString topology = "a2c0"; // e.g. "a1c0", "a1c1", "a1c2fix", "a2c0", "a1c1c2"
|
||||
TString detector = "sx3"; // "sx3" or "qqq"
|
||||
|
||||
// Excited states to overlay, in the same order as labels[]/xlo[]/xhi[]
|
||||
// below. Must match TrackRecon.C's EKin<state> suffixes exactly --
|
||||
// note 3498's tag is lowercase "kev" (TrackRecon.C:4028), unlike every
|
||||
// other state's "keV". 3774 keV is deliberately left out (too close
|
||||
// to 3498, spin-parity predicts it's weaker anyway).
|
||||
TString states[] = {"GS", "2235keV", "3498kev", "4809keV", "5614keV", "6550keV"};
|
||||
TString labels[] = {"Ground State", "2.235 MeV", "3.498 MeV",
|
||||
"4.809 MeV", "5.614 MeV", "6.550 MeV"};
|
||||
|
||||
// Per-state display window (MeV), same order as states[] above.
|
||||
// See the header comment for why these are currently a no-op.
|
||||
double xlo[] = {0, 4, 12, 24, 36, 42};
|
||||
double xhi[] = {4, 12, 24, 36, 42, 90};
|
||||
|
||||
const size_t nStates = sizeof(states) / sizeof(states[0]);
|
||||
if (sizeof(labels) / sizeof(labels[0]) != nStates ||
|
||||
sizeof(xlo) / sizeof(xlo[0]) != nStates ||
|
||||
sizeof(xhi) / sizeof(xhi[0]) != nStates)
|
||||
{
|
||||
std::cerr << "overlay_2d: states[]/labels[]/xlo[]/xhi[] must all be "
|
||||
"the same length -- check your edits.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Standard ANASEN color sequence
|
||||
int colors[] = {kBlack, kRed + 1, kAzure + 2, kGreen + 2, kMagenta + 1};
|
||||
std::vector<TH2 *> hists;
|
||||
std::vector<TString> usedLabels;
|
||||
|
||||
TFile *f = TFile::Open(rootFile, "READ");
|
||||
if (!f || f->IsZombie())
|
||||
return;
|
||||
|
||||
for (int i = 0; i < histArr->GetEntriesFast(); i++)
|
||||
{
|
||||
TString hName = ((TObjString *)histArr->At(i))->GetString();
|
||||
std::cerr << "overlay_2d: could not open " << rootFile << "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < nStates; i++)
|
||||
{
|
||||
TString hName = "ETrackvsKin_assumed/" + reaction + "_ETrack_vs_EKin" + states[i] + "_" + ejtag + "_" + topology + "_" + detector;
|
||||
TH2 *h = (TH2 *)f->Get(hName);
|
||||
if (h)
|
||||
{
|
||||
TH2 *clone = (TH2 *)h->Clone(Form("h_%d", i));
|
||||
TH2 *clone = (TH2 *)h->Clone(Form("h_%zu", i));
|
||||
clone->SetDirectory(0); // Detach from file
|
||||
hists.push_back(clone);
|
||||
usedLabels.push_back(labels[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -45,9 +127,26 @@ void overlay_2d(TString rootFile, TString histsCSV, TString labelsCSV, TString x
|
|||
if (hists.empty())
|
||||
return;
|
||||
|
||||
// Apply the per-state display gate by zeroing bins outside [xlo[i],
|
||||
// xhi[i]) directly, rather than SetRangeUser -- see header comment.
|
||||
for (size_t i = 0; i < hists.size(); i++)
|
||||
{
|
||||
TAxis *ax = hists[i]->GetXaxis();
|
||||
for (int bx = 1; bx <= hists[i]->GetNbinsX(); bx++)
|
||||
{
|
||||
double xc = ax->GetBinCenter(bx);
|
||||
if (xc < xlo[i] || xc >= xhi[i])
|
||||
for (int by = 1; by <= hists[i]->GetNbinsY(); by++)
|
||||
hists[i]->SetBinContent(bx, by, 0);
|
||||
}
|
||||
hists[i]->RebinX(rebinX);
|
||||
hists[i]->RebinY(rebinY);
|
||||
hists[i]->SetMinimum(minz);
|
||||
}
|
||||
|
||||
TCanvas *c = new TCanvas("c", "", 1800, 1800);
|
||||
c->SetLeftMargin(0.12);
|
||||
c->SetBottomMargin(0.12);
|
||||
c->SetLeftMargin(0.15);
|
||||
c->SetBottomMargin(0.15);
|
||||
|
||||
// Turn on the X and Y grid lines
|
||||
c->SetGridx(1);
|
||||
|
|
@ -61,33 +160,37 @@ void overlay_2d(TString rootFile, TString histsCSV, TString labelsCSV, TString x
|
|||
|
||||
for (size_t i = 0; i < hists.size(); i++)
|
||||
{
|
||||
hists[i]->SetMarkerColor(colors[i % 5]);
|
||||
hists[i]->SetMarkerStyle(6); // Small dot for scatter
|
||||
|
||||
hists[i]->SetFillColor(colors[i % 5]);
|
||||
if (i == 0)
|
||||
{
|
||||
hists[i]->SetTitle("");
|
||||
hists[i]->GetXaxis()->SetTitle(xAxisLabel);
|
||||
hists[i]->GetYaxis()->SetTitle(yAxisLabel);
|
||||
hists[i]->GetXaxis()->CenterTitle();
|
||||
hists[i]->GetYaxis()->CenterTitle();
|
||||
|
||||
hists[i]->Draw("colz");
|
||||
hists[i]->Draw("box");
|
||||
|
||||
// Draw the y = x diagonal dashed line across the plot's own
|
||||
// native range (read off the histogram, not hardcoded) with
|
||||
// enough sample points to reach both corners cleanly.
|
||||
double xMin = hists[i]->GetXaxis()->GetXmin();
|
||||
double xMax = hists[i]->GetXaxis()->GetXmax();
|
||||
TF1 *diag = new TF1("diag", "x", xMin, xMax);
|
||||
diag->SetNpx(1000);
|
||||
diag->SetLineStyle(2);
|
||||
diag->SetLineColor(kRed);
|
||||
diag->Draw("same");
|
||||
}
|
||||
else
|
||||
{
|
||||
hists[i]->Draw("colz same");
|
||||
hists[i]->Draw("box same");
|
||||
}
|
||||
|
||||
TString label = ((TObjString *)labelArr->At(i))->GetString();
|
||||
leg->AddEntry(hists[i], label.Data(), "p");
|
||||
leg->AddEntry(hists[i], usedLabels[i].Data(), "f"); // "f" -- box uses fill swatches
|
||||
}
|
||||
// Draw the y = x diagonal dashed line
|
||||
TF1 *diag = new TF1("diag", "x", -1000, 1000);
|
||||
diag->SetLineStyle(2);
|
||||
diag->SetLineColor(kGray + 2);
|
||||
diag->Draw("same");
|
||||
leg->Draw();
|
||||
|
||||
c->SaveAs("kinematic_states_overlay.png");
|
||||
std::cout << "Saved: kinematic_states_overlay.png\n";
|
||||
c->SaveAs("scratch/kinematic_states_overlay.png");
|
||||
std::cout << "Saved: scratch/kinematic_states_overlay.png\n";
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user