From 1081e4b690b1994c291a16dd42f18f4ff49aad0d Mon Sep 17 00:00:00 2001 From: vsitaraman Date: Mon, 11 May 2026 17:23:43 -0400 Subject: [PATCH] modified: MakeVertex.C modified: run_27Al.sh modified: run_sx3.sh --- MakeVertex.C | 97 ++++++++++++++++++++++++++++++++++++++++++---------- run_27Al.sh | 4 +-- run_sx3.sh | 2 +- 3 files changed, 82 insertions(+), 21 deletions(-) diff --git a/MakeVertex.C b/MakeVertex.C index a8cdb6d..658797f 100755 --- a/MakeVertex.C +++ b/MakeVertex.C @@ -1084,8 +1084,7 @@ Bool_t MakeVertex::Process(Long64_t entry) plotter->Fill2D("Benchmark_SX3_VertexZ_Twisted_vs_0Cathode_sx3" + std::to_string(sx3event.ch2), 400, -200, 200, 400, -200, 200, r_rhoMin_fix.Z(), vertex_recon, "1wire"); plotter->Fill2D("Benchmark_SX3_VertexZ_Twisted_vs_0Cathode_anode" + std::to_string(aWireID), 400, -200, 200, 400, -200, 200, r_rhoMin_fix.Z(), vertex_recon, "1wire"); plotter->Fill2D("Benchmark_SX3XY" + std::to_string(sx3event.ch2), 400, -100, 100, 400, -100, 100, vector_minimisedto_z.X(), vector_minimisedto_z.Y(), "1wire"); - plotter->Fill2D("Benchmark_SX3z_vs_VertexZ0C", 400, -200, 200, 400, -200, 200,sx3event.pos.Z(), vertex_recon , "1wire"); - + plotter->Fill2D("Benchmark_SX3z_vs_VertexZ0C", 400, -200, 200, 400, -200, 200, sx3event.pos.Z(), vertex_recon, "1wire"); } } // ============================================================================== @@ -1142,7 +1141,7 @@ Bool_t MakeVertex::Process(Long64_t entry) // ============================================================================== // Look at how close we actually got to the Si Phi. // If min_delta_phi > 0.1 radians, it means the track never truly matched the wire! - plotter->Fill1D("Benchmark_SX3_Min_DeltaPhi", 5000, -200, 200, min_delta_phi/TMath::Pi()*180, "1wire"); + plotter->Fill1D("Benchmark_SX3_Min_DeltaPhi", 5000, -200, 200, min_delta_phi / TMath::Pi() * 180, "1wire"); // Standard benchmarking comparisons against the A1C2 Cathode baseline plotter->Fill1D("Benchmark_SX3_PCZ_Diff_Scan", 800, -180, 180, pcz_minimized - pcevent.pos.Z(), "1wire"); @@ -1271,6 +1270,7 @@ Bool_t MakeVertex::Process(Long64_t entry) // Loop over SX3_Events directly for (auto sx3event : SX3_Events) { + if (sx3event.Time1 - aTime < -150) // Time cut for protons { // 1. Define the plane of the track (Z-axis to SX3 hit) @@ -1293,6 +1293,32 @@ Bool_t MakeVertex::Process(Long64_t entry) double deltaZ = sx3event.pos.Z() - pcz_intersect.Z(); double vertex_recon = sx3event.pos.Z() - sx3event.pos.Perp() * (deltaZ / deltaRho); + std::string vtx_gate = ""; + + if (vertex_recon >= -176.0 && vertex_recon < -100.0) + { + vtx_gate = "_Z[-176_to_-100]"; + } + else if (vertex_recon >= -100.0 && vertex_recon < -50.0) + { + vtx_gate = "_Z[-100_to_-50]"; + } + else if (vertex_recon >= -50.0 && vertex_recon < 0.0) + { + vtx_gate = "_Z[-50_to_0]"; + } + else if (vertex_recon >= 0.0 && vertex_recon < 50.0) + { + vtx_gate = "_Z[0_to_50]"; + } + else if (vertex_recon >= 50.0 && vertex_recon < 100.0) + { + vtx_gate = "_Z[50_to_100]"; + } + else if (vertex_recon >= 100.0 && vertex_recon < 176.0) + { + vtx_gate = "_Z[100_to_176]"; + } // 4. Energy Loss Correction in Silicon double path_length = (sx3event.pos - TVector3(0, 0, vertex_recon)).Mag() * 0.1; @@ -1302,16 +1328,20 @@ Bool_t MakeVertex::Process(Long64_t entry) double sinTheta = TMath::Sin(theta_recon); // 5. Fill Diagnostics - plotter->Fill1D("1A0C_twisted_pcz_recon_Phi_SX3" + std::to_string(PCSX3PhiCut), 600, -300, 300, pcz_intersect.Z(), "1A0C"); - plotter->Fill1D("1A0C_twisted_vertex_recon_Phi_SX3" + std::to_string(PCSX3PhiCut), 600, -300, 300, vertex_recon, "1A0C"); + plotter->Fill2D("1A0C_dE_Ecorr_Anode_SX3", 400, 0, 30, 800, 0, 40000, sx3Efix, aEnergy * sinTheta, "1A0C"); + if (vtx_gate != "") + { + plotter->Fill1D("1A0C_twisted_pcz_recon_SX3" + vtx_gate, 600, -300, 300, pcz_intersect.Z(), "1A0C"); + plotter->Fill1D("1A0C_twisted_vertex_recon_SX3" + vtx_gate, 600, -300, 300, vertex_recon, "1A0C"); - plotter->Fill2D("1A0C_sx3_E_vs_theta_raw_Phi_SX3" + std::to_string(PCSX3PhiCut), 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, sx3event.Energy1, "1A0C"); - plotter->Fill2D("1A0C_sx3_E_vs_theta_corr_Phi_SX3" + std::to_string(PCSX3PhiCut), 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, sx3Efix, "1A0C"); + plotter->Fill2D("1A0C_sx3_E_vs_theta_raw_SX3" + vtx_gate, 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, sx3event.Energy1, "1A0C"); + plotter->Fill2D("1A0C_sx3_E_vs_theta_corr_SX3" + vtx_gate, 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, sx3Efix, "1A0C"); - plotter->Fill2D("1A0C_dE_Ecorr_Anode_SX3_Phi" + std::to_string(PCSX3PhiCut), 400, 0, 30, 800, 0, 40000, sx3Efix, aEnergy * sinTheta, "1A0C"); + plotter->Fill2D("1A0C_dE_Ecorr_Anode_SX3" + vtx_gate, 400, 0, 30, 800, 0, 40000, sx3Efix, aEnergy * sinTheta, "1A0C"); - // Track where on the wire the hit occurred (0 to 1 is inside the physical PC) - plotter->Fill1D("1A0C_wire_t_parameter_Phi" + std::to_string(PCSX3PhiCut), 200, -0.5, 1.5, t_intersect, "1A0C"); + // Track where on the wire the hit occurred (0 to 1 is inside the physical PC) + plotter->Fill1D("1A0C_wire_t_parameter" + vtx_gate, 200, -0.5, 1.5, t_intersect, "1A0C"); + } } } @@ -1342,6 +1372,33 @@ Bool_t MakeVertex::Process(Long64_t entry) double vertex_recon = qqqevent.pos.Z() - qqqevent.pos.Perp() * (deltaZ / deltaRho); + std::string vtx_gate = ""; + + if (vertex_recon >= -176.0 && vertex_recon < -100.0) + { + vtx_gate = "_Z[-176_to_-100]"; + } + else if (vertex_recon >= -100.0 && vertex_recon < -50.0) + { + vtx_gate = "_Z[-100_to_-50]"; + } + else if (vertex_recon >= -50.0 && vertex_recon < 0.0) + { + vtx_gate = "_Z[-50_to_0]"; + } + else if (vertex_recon >= 0.0 && vertex_recon < 50.0) + { + vtx_gate = "_Z[0_to_50]"; + } + else if (vertex_recon >= 50.0 && vertex_recon < 100.0) + { + vtx_gate = "_Z[50_to_100]"; + } + else if (vertex_recon >= 100.0 && vertex_recon < 176.0) + { + vtx_gate = "_Z[100_to_176]"; + } + // 4. Energy Loss Correction in Silicon double path_length = (qqqevent.pos - TVector3(0, 0, vertex_recon)).Mag() * 0.1; @@ -1352,17 +1409,21 @@ Bool_t MakeVertex::Process(Long64_t entry) double sinTheta = TMath::Sin(theta_recon); // 5. Fill Diagnostics - plotter->Fill1D("1A0C_twisted_pcz_recon_Phi_QQQ" + std::to_string(PCSX3PhiCut), 600, -300, 300, pcz_intersect.Z(), "1A0C"); - plotter->Fill1D("1A0C_twisted_vertex_recon_Phi_QQQ" + std::to_string(PCSX3PhiCut), 600, -300, 300, vertex_recon, "1A0C"); + plotter->Fill2D("1A0C_dE_Ecorr_Anode_QQQ", 400, 0, 30, 800, 0, 40000, qqqEfix, aEnergy * sinTheta, "1A0C"); - // FIXED: Changed "sx3" to "qqq" in the histogram names to avoid overwriting your barrel data - plotter->Fill2D("1A0C_qqq_E_vs_theta_raw_Phi_" + std::to_string(PCSX3PhiCut), 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, qqqevent.Energy1, "1A0C"); - plotter->Fill2D("1A0C_qqq_E_vs_theta_corr_Phi_" + std::to_string(PCSX3PhiCut), 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, qqqEfix, "1A0C"); + if (vtx_gate != "") + { + plotter->Fill1D("1A0C_twisted_pcz_recon_QQQ" + vtx_gate, 600, -300, 300, pcz_intersect.Z(), "1A0C"); + plotter->Fill1D("1A0C_twisted_vertex_recon_QQQ" + vtx_gate, 600, -300, 300, vertex_recon, "1A0C"); - plotter->Fill2D("1A0C_dE_Ecorr_Anode_QQQ_Phi" + std::to_string(PCSX3PhiCut), 400, 0, 30, 800, 0, 40000, qqqEfix, aEnergy * sinTheta, "1A0C"); + plotter->Fill2D("1A0C_qqq_E_vs_theta_raw_QQQ" + vtx_gate, 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, qqqevent.Energy1, "1A0C"); + plotter->Fill2D("1A0C_qqq_E_vs_theta_corr_QQQ" + vtx_gate, 180, 0, 180, 400, 0, 30, theta_recon * 180. / M_PI, qqqEfix, "1A0C"); - // Track where on the wire the hit occurred (0 to 1 is inside the physical PC) - plotter->Fill1D("1A0C_wire_t_parameter_QQQ_Phi" + std::to_string(PCSX3PhiCut), 200, -0.5, 1.5, t_intersect_QQQ, "1A0C"); + plotter->Fill2D("1A0C_dE_Ecorr_Anode_QQQ" + vtx_gate, 400, 0, 30, 800, 0, 40000, qqqEfix, aEnergy * sinTheta, "1A0C"); + + // Track where on the wire the hit occurred (0 to 1 is inside the physical PC) + plotter->Fill1D("1A0C_wire_t_parameter_QQQ" + vtx_gate, 200, -0.5, 1.5, t_intersect_QQQ, "1A0C"); + } } } } diff --git a/run_27Al.sh b/run_27Al.sh index b2a5ba7..8b4f914 100644 --- a/run_27Al.sh +++ b/run_27Al.sh @@ -1,4 +1,4 @@ -#rm results_run*.root +rm results_run*.root export DATASET="27Al" export flip180="0" export flipa=0 @@ -11,7 +11,7 @@ export anode_offset=1 #done declare -i run=50 -while [[ $run -lt 59 ]]; do #runs 1 to 84 +while [[ $run -lt 55 ]]; do #runs 1 to 84 wrun=$(printf "%03d" $run) root -q -l -b -x ../ANASEN_analysis/data/27Al_Data/Run_"$wrun"_mapped.root -e 'tree->Process("MakeVertex.C+O","Analyzer_27Al.root")'; mv Analyzer_27Al.root 27Al_output/results_run$wrun.root; run=run+1 diff --git a/run_sx3.sh b/run_sx3.sh index 6424932..4206b38 100755 --- a/run_sx3.sh +++ b/run_sx3.sh @@ -37,7 +37,7 @@ fi #protons+gas, 27Al #export flip180="1" #export flip180="0" -if [[ 1 -eq 1 ]] ; then +if [[ 1 -eq 0 ]]; then export flipa=0 export anode_offset=0 export source_vertex=-200.0; #put the 'source' on the entrance window