diff --git a/.gitignore b/.gitignore index bdc7423..d0fb214 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ data/ data_proton/ Sudarshan/ wires2d/ +myenv/ Analyzer_C_ACLiC_dict0713aaa966_dictContent.h .gitignore Analyzer_C_ACLiC_dict5411fecd5c_dictUmbrella.h diff --git a/Armory/SX3Geom.h b/Armory/SX3Geom.h index 1b72241..dc7a632 100755 --- a/Armory/SX3Geom.h +++ b/Armory/SX3Geom.h @@ -72,6 +72,7 @@ public: void sx3::fillevent(const std::string& positionstring, const int subchannel, const float value) { assert(subchannel>=0 && subchannel<4); + foundevent=1; if(positionstring=="FRONT_L") { frontL[subchannel].push_back(value); unmatched_front_chans.insert(subchannel); @@ -127,7 +128,7 @@ void sx3::validate() { for(auto thing: frontL[chan]) std::cout << thing << " " << std::flush; std::cout << "\nR:" << std::endl; for(auto thing: frontR[chan]) std::cout << thing << " " << std::flush;*/ - if(frontL[chan].at(0) + frontR[chan].at(0)> maxFE) { + if(frontL[chan].at(0) + frontR[chan].at(0)>= maxFE) { maxFE = frontL[chan].at(0) + frontR[chan].at(0); //zpos = (frontL[chan].at(0)-frontR[chan].at(0))/maxFE; fchan = chan; @@ -144,7 +145,7 @@ void sx3::validate() { printf("foo\n"); //continue; } - if(back[chan].at(0) > maxBE) { + if(back[chan].at(0) >= maxBE) { maxBE = back[chan].at(0); bchan = chan; } @@ -156,6 +157,12 @@ void sx3::validate() { - Total F and B energies (frontE, backE) *are*. Sudarsan B, 31 Oct 2024 */ + + if(fchan==-1 || bchan==-1) { + std::cout << "how" << std::endl; + std::cout << "fc " << std::flush; for(auto fc : valid_front_chans) std::cout << fc << " (" << frontL[fc].at(0) << "," << frontR[fc].at(0)<< ") "; std::cout << std::endl; + std::cout << "bc " << std::flush; for(auto bc : valid_back_chans) std::cout << bc << " " << back[bc].at(0) << std::flush; std::cout << std::endl; + } float Eleft = frontL[fchan].at(0); float Eright = frontR[fchan].at(0); frontEL = Eleft; diff --git a/MakeVertex.C b/MakeVertex.C index c69cea1..20ca930 100755 --- a/MakeVertex.C +++ b/MakeVertex.C @@ -1084,6 +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"); } } // ============================================================================== @@ -1140,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, -10, 10, min_delta_phi, "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"); @@ -1282,6 +1283,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) @@ -1304,6 +1306,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; @@ -1313,16 +1341,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"); + } } } @@ -1353,6 +1385,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; @@ -1363,17 +1422,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"); + } } } } @@ -1544,7 +1607,6 @@ Bool_t MakeVertex::Process(Long64_t entry) // B. Compare the Vertex Z-coordinate plotter->Fill1D("Benchmark_VertexZ_Difference", 400, -100, 100, vertex_recon_twisted - r_rhoMin_fix.Z(), "1wire"); - plotter->Fill1D("Benchmark_VertexZ_Difference", 400, -100, 100, vertex_recon_twisted - r_rhoMin_fix.Z(), "1wire"); plotter->Fill2D("Benchmark_VertexZ_Twisted_vs_Cathode", 400, -200, 200, 400, -200, 200, r_rhoMin_fix.Z(), vertex_recon_twisted, "1wire"); // C. Diagnostic: Where on the wire did it hit? diff --git a/MakeVertex.h b/MakeVertex.h index 776ec5a..dd14d32 100644 --- a/MakeVertex.h +++ b/MakeVertex.h @@ -117,6 +117,7 @@ void MakeVertex::Init(TTree *tree){ fChain->SetBranchAddress("miscCh", &misc.ch, &b_miscCh); fChain->SetBranchAddress("miscE", &misc.e, &b_miscE); fChain->SetBranchAddress("miscT", &misc.t, &b_miscT); + fChain->SetBranchAddress("miscf", &misc.tf, &b_miscTf); } Bool_t MakeVertex::Notify(){ 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 e298c58..4206b38 100755 --- a/run_sx3.sh +++ b/run_sx3.sh @@ -20,7 +20,7 @@ fi export DATASET="27Al" export flip180="0" #root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_009_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run09.root; -if [[ 1 -eq 1 ]]; then +if [[ 1 -eq 0 ]]; then #export timecut_low=230.0; export timecut_low=400.0; #export timecut_high=400.0; @@ -37,14 +37,14 @@ fi #protons+gas, 27Al #export flip180="1" #export flip180="0" -if [[ 1 -eq 0 ]] ; 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 -root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root; -exit -root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root; +exit +root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root; +root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_020_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run20.root; root -q -b -x ../ANASEN_analysis/data/27Al_Data/Run_021_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run21.root; diff --git a/sx3cal/27Al/backgains.dat b/sx3cal/27Al/backgains.dat index d1af840..278ae78 100755 --- a/sx3cal/27Al/backgains.dat +++ b/sx3cal/27Al/backgains.dat @@ -1,28 +1,56 @@ -1 front 0 back 2 4.03168 -1 front 1 back 2 4.03168 -1 front 2 back 2 4.11533 -1 front 3 back 2 4.17315 -7 front 0 back 2 4.26886 -7 front 0 back 1 3.44529 -7 front 1 back 2 4.26886 -7 front 1 back 1 3.44529 -7 front 2 back 2 4.26886 -7 front 2 back 1 3.46759 -7 front 3 back 2 4.26886 -7 front 3 back 1 3.44529 -9 front 0 back 2 3.63215 -9 front 0 back 1 3.42327 -9 front 1 back 2 3.63215 -9 front 1 back 1 3.42327 -9 front 2 back 2 3.65694 -9 front 2 back 1 3.46759 -9 front 3 back 2 3.68208 -9 front 3 back 1 3.42327 -3 front 0 back 2 3. -3 front 0 back 1 3. -3 front 1 back 2 3.65694 -3 front 1 back 1 3.68208 -3 front 2 back 2 3.70756 -3 front 2 back 1 3.78616 -3 front 3 back 2 3.7334 -3 front 3 back 1 3.68208 +1 front 0 back 2 3.63215 +1 front 0 back 3 3.23711 +1 front 0 back 0 3.44529 +1 front 1 back 2 3.63215 +1 front 1 back 3 3.38008 +1 front 1 back 0 3.46759 +1 front 2 back 2 3.70756 +1 front 2 back 3 3.21767 +1 front 2 back 0 3.46759 +1 front 3 back 2 3.75959 +1 front 3 back 3 3.21767 +1 front 3 back 0 3.44529 +7 front 0 back 2 3.78616 +7 front 0 back 1 3.07016 +7 front 0 back 3 3.68208 +7 front 0 back 0 3.14218 +7 front 1 back 2 3.81311 +7 front 1 back 1 3.12386 +7 front 1 back 3 3.65694 +7 front 1 back 0 3.14218 +7 front 2 back 2 3.84045 +7 front 2 back 1 3.14218 +7 front 2 back 3 3.60769 +7 front 2 back 0 3.14218 +7 front 3 back 2 3.86817 +7 front 3 back 1 3.12386 +7 front 3 back 3 3.68208 +7 front 3 back 0 3.14218 +9 front 0 back 2 3.29688 +9 front 0 back 1 3.12386 +9 front 0 back 3 3.12386 +9 front 0 back 0 3.03537 +9 front 1 back 2 3.29688 +9 front 1 back 1 3.12386 +9 front 1 back 3 3.14218 +9 front 1 back 0 3.05266 +9 front 2 back 2 3.29688 +9 front 2 back 1 3.14218 +9 front 2 back 3 3.12386 +9 front 2 back 0 3.05266 +9 front 3 back 2 3.29688 +9 front 3 back 1 3.12386 +9 front 3 back 3 3.08785 +9 front 3 back 0 3.03537 +3 front 1 back 2 3.31729 +3 front 1 back 1 3.38008 +3 front 1 back 3 3.65694 +3 front 1 back 0 3.53625 +3 front 2 back 2 3.38008 +3 front 2 back 1 3.44529 +3 front 2 back 3 3.46759 +3 front 2 back 0 3.51306 +3 front 3 back 2 3.38008 +3 front 3 back 1 3.33796 +3 front 3 back 3 3.46759 +3 front 3 back 0 3.46759 diff --git a/sx3cal/27Al/backgains.dat.Apr2026 b/sx3cal/27Al/backgains.dat.Apr2026 new file mode 100644 index 0000000..b111f4d --- /dev/null +++ b/sx3cal/27Al/backgains.dat.Apr2026 @@ -0,0 +1,41 @@ +#1 front 0 back 2 4.03168 +#1 front 1 back 2 4.03168 +#1 front 2 back 2 4.11533 +#1 front 3 back 2 4.17315 +1 front 0 back 2 3.63215 +1 front 0 back 3 3.23711 +1 front 0 back 0 3.44529 +1 front 1 back 2 3.63215 +1 front 1 back 3 3.38008 +1 front 1 back 0 3.46759 +1 front 2 back 2 3.70756 +1 front 2 back 3 3.21767 +1 front 2 back 0 3.46759 +1 front 3 back 2 3.75959 +1 front 3 back 3 3.21767 +1 front 3 back 0 3.44529 +# +7 front 0 back 2 4.26886 +7 front 0 back 1 3.44529 +7 front 1 back 2 4.26886 +7 front 1 back 1 3.44529 +7 front 2 back 2 4.26886 +7 front 2 back 1 3.46759 +7 front 3 back 2 4.26886 +7 front 3 back 1 3.44529 +9 front 0 back 2 3.63215 +9 front 0 back 1 3.42327 +9 front 1 back 2 3.63215 +9 front 1 back 1 3.42327 +9 front 2 back 2 3.65694 +9 front 2 back 1 3.46759 +9 front 3 back 2 3.68208 +9 front 3 back 1 3.42327 +3 front 0 back 2 3. +3 front 0 back 1 3. +3 front 1 back 2 3.65694 +3 front 1 back 1 3.68208 +3 front 2 back 2 3.70756 +3 front 2 back 1 3.78616 +3 front 3 back 2 3.7334 +3 front 3 back 1 3.68208 diff --git a/sx3cal/27Al/frontgains.dat.unity b/sx3cal/27Al/frontgains.dat.unity index 7f21ff5..a6df93c 100755 --- a/sx3cal/27Al/frontgains.dat.unity +++ b/sx3cal/27Al/frontgains.dat.unity @@ -18,3 +18,7 @@ 0 temp temp 1 0. 1. 0 temp temp 2 0. 1. 0 temp temp 3 0. 1. +3 temp temp 0 0. 1. +3 temp temp 1 0. 1. +3 temp temp 2 0. 1. +3 temp temp 3 0. 1.