From c3ef72ca061807ef1c54f90638edccbf07f348aa Mon Sep 17 00:00:00 2001
From: Saverio Mariani <samarian@cern.ch>
Date: Wed, 2 Apr 2025 12:20:30 +0200
Subject: [PATCH 1/2] Allow to display the full PV range

---
 .../primary_vertex_reconstruction.py          |  4 +---
 .../include/pv_beamline_cleanup.cuh           | 11 +---------
 .../PV/beamlinePV/src/pv_beamline_cleanup.cu  | 21 +++++--------------
 3 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/configuration/python/AllenConf/primary_vertex_reconstruction.py b/configuration/python/AllenConf/primary_vertex_reconstruction.py
index 74dfa55e239..c976a27f41b 100644
--- a/configuration/python/AllenConf/primary_vertex_reconstruction.py
+++ b/configuration/python/AllenConf/primary_vertex_reconstruction.py
@@ -123,9 +123,7 @@ def make_pvs(velo_tracks,
         dev_multi_fit_vertices_t=pv_beamline_multi_fitter.
         dev_multi_fit_vertices_t,
         dev_number_of_multi_fit_vertices_t=pv_beamline_multi_fitter.
-        dev_number_of_multi_fit_vertices_t,
-        min_histo_smogpvz=zmin - 20.,
-        max_histo_smogpvz=SMOG2_pp_separation + 20.)
+        dev_number_of_multi_fit_vertices_t )
 
     return {
         "dev_number_of_zpeaks":
diff --git a/device/PV/beamlinePV/include/pv_beamline_cleanup.cuh b/device/PV/beamlinePV/include/pv_beamline_cleanup.cuh
index 0ae5803540a..6f58f633b35 100644
--- a/device/PV/beamlinePV/include/pv_beamline_cleanup.cuh
+++ b/device/PV/beamlinePV/include/pv_beamline_cleanup.cuh
@@ -42,11 +42,9 @@ namespace pv_beamline_cleanup {
     Allen::Monitoring::Histogram<>::DeviceType,
     Allen::Monitoring::Histogram<>::DeviceType,
     Allen::Monitoring::Histogram<>::DeviceType,
-    Allen::Monitoring::Histogram<>::DeviceType,
     Allen::Monitoring::Histogram<>::DeviceType);
 
   struct pv_beamline_cleanup_t : public DeviceAlgorithm, Parameters {
-    void init();
     void set_arguments_size(ArgumentReferences<Parameters> arguments, const RuntimeOptions&, const Constants&) const;
 
     void operator()(
@@ -61,19 +59,12 @@ namespace pv_beamline_cleanup {
                                           "minChi2Dist",
                                           BeamlinePVConstants::CleanUp::minChi2Dist,
                                           "minimum chi2 distance"};
-    Allen::Property<unsigned> m_nbins_histo_smogpvz {this,
-                                                     "nbins_histo_smogpvz",
-                                                     100,
-                                                     "Number of bins for SMOGPVz histogram"};
-    Allen::Property<float> m_min_histo_smogpvz {this, "min_histo_smogpvz", -600.f, "Minimum of SMOGPVz histogram"};
-    Allen::Property<float> m_max_histo_smogpvz {this, "max_histo_smogpvz", -200.f, "Maximum of SMOGPVz histogram"};
 
     Allen::Monitoring::AveragingCounter<> m_pvs {this, "n_PVs"};
     Allen::Monitoring::Histogram<> m_histogram_n_pvs {this, "n_pvs_event", "n_pvs_event", {21u, -0.5f, 20.5f}};
     Allen::Monitoring::Histogram<> m_histogram_pv_x {this, "pv_x", "pv_x", {1000u, -2.f, 2.f}};
     Allen::Monitoring::Histogram<> m_histogram_pv_y {this, "pv_y", "pv_y", {1000u, -2.f, 2.f}};
-    Allen::Monitoring::Histogram<> m_histogram_pv_z {this, "pv_z", "pv_z", {1000u, -200.f, 200.f}};
+    Allen::Monitoring::Histogram<> m_histogram_pv_z {this, "pv_z", "pv_z", {2000u, -600.f, 200.f}};
     Allen::Monitoring::Histogram<> m_histogram_n_smogpvs {this, "n_smog2_PVs", "n_smog2_PVs", {10, -0.5f, 9.5f}};
-    Allen::Monitoring::Histogram<> m_histogram_smogpv_z {this, "smogpv_z", "smogpv_z", {100u, -600.f, -200.f}};
   };
 } // namespace pv_beamline_cleanup
diff --git a/device/PV/beamlinePV/src/pv_beamline_cleanup.cu b/device/PV/beamlinePV/src/pv_beamline_cleanup.cu
index e6d955c0c5e..4a729abfc0a 100644
--- a/device/PV/beamlinePV/src/pv_beamline_cleanup.cu
+++ b/device/PV/beamlinePV/src/pv_beamline_cleanup.cu
@@ -12,13 +12,6 @@
 
 INSTANTIATE_ALGORITHM(pv_beamline_cleanup::pv_beamline_cleanup_t)
 
-void pv_beamline_cleanup::pv_beamline_cleanup_t::init()
-{
-  m_histogram_smogpv_z.x_axis().nBins = m_nbins_histo_smogpvz;
-  m_histogram_smogpv_z.x_axis().minValue = m_min_histo_smogpvz;
-  m_histogram_smogpv_z.x_axis().maxValue = m_max_histo_smogpvz;
-}
-
 void pv_beamline_cleanup::pv_beamline_cleanup_t::set_arguments_size(
   ArgumentReferences<Parameters> arguments,
   const RuntimeOptions&,
@@ -44,8 +37,7 @@ void pv_beamline_cleanup::pv_beamline_cleanup_t::operator()(
     m_histogram_n_smogpvs.data(context),
     m_histogram_pv_x.data(context),
     m_histogram_pv_y.data(context),
-    m_histogram_pv_z.data(context),
-    m_histogram_smogpv_z.data(context));
+    m_histogram_pv_z.data(context) );
 }
 
 __device__ void pv_beamline_cleanup::sort_pvs_by_z(PV::Vertex* final_vertices, unsigned n_vertices)
@@ -88,8 +80,7 @@ __global__ void pv_beamline_cleanup::pv_beamline_cleanup(
   Allen::Monitoring::Histogram<>::DeviceType dev_n_smogpvs_histo,
   Allen::Monitoring::Histogram<>::DeviceType dev_pv_x_histo,
   Allen::Monitoring::Histogram<>::DeviceType dev_pv_y_histo,
-  Allen::Monitoring::Histogram<>::DeviceType dev_pv_z_histo,
-  Allen::Monitoring::Histogram<>::DeviceType dev_smogpv_z_histo)
+  Allen::Monitoring::Histogram<>::DeviceType dev_pv_z_histo)
 {
 
   __shared__ unsigned tmp_number_vertices[1];
@@ -126,16 +117,14 @@ __global__ void pv_beamline_cleanup::pv_beamline_cleanup(
       final_vertices[vtx_index] = vertex1;
 
       // monitoring
+      dev_pv_z_histo.increment(vertex1.position.z);
       if (-200 < vertex1.position.z && vertex1.position.z < 200) {
         dev_pv_x_histo.increment(vertex1.position.x);
         dev_pv_y_histo.increment(vertex1.position.y);
-        dev_pv_z_histo.increment(vertex1.position.z);
       }
 
-      if (dev_smogpv_z_histo.inAcceptance(vertex1.position.z)) {
-        dev_smogpv_z_histo.increment(vertex1.position.z);
-        atomicAdd(tmp_number_SMOG_vertices, 1);
-      }
+      if (vertex1.position.z < BeamlinePVConstants::Common::SMOG2_pp_separation) 
+        atomicAdd(tmp_number_SMOG_vertices, 1);      
     }
   }
   __syncthreads();
-- 
GitLab


From c14973e587547facdf9dd7e585b5bb46e5a92802 Mon Sep 17 00:00:00 2001
From: Gitlab CI <noreply@cern.ch>
Date: Wed, 2 Apr 2025 10:35:46 +0000
Subject: [PATCH 2/2] Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/Allen/-/jobs/54049247
---
 .../python/AllenConf/primary_vertex_reconstruction.py        | 2 +-
 device/PV/beamlinePV/src/pv_beamline_cleanup.cu              | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/configuration/python/AllenConf/primary_vertex_reconstruction.py b/configuration/python/AllenConf/primary_vertex_reconstruction.py
index c976a27f41b..e6f21861d2b 100644
--- a/configuration/python/AllenConf/primary_vertex_reconstruction.py
+++ b/configuration/python/AllenConf/primary_vertex_reconstruction.py
@@ -123,7 +123,7 @@ def make_pvs(velo_tracks,
         dev_multi_fit_vertices_t=pv_beamline_multi_fitter.
         dev_multi_fit_vertices_t,
         dev_number_of_multi_fit_vertices_t=pv_beamline_multi_fitter.
-        dev_number_of_multi_fit_vertices_t )
+        dev_number_of_multi_fit_vertices_t)
 
     return {
         "dev_number_of_zpeaks":
diff --git a/device/PV/beamlinePV/src/pv_beamline_cleanup.cu b/device/PV/beamlinePV/src/pv_beamline_cleanup.cu
index 4a729abfc0a..5f73f435710 100644
--- a/device/PV/beamlinePV/src/pv_beamline_cleanup.cu
+++ b/device/PV/beamlinePV/src/pv_beamline_cleanup.cu
@@ -37,7 +37,7 @@ void pv_beamline_cleanup::pv_beamline_cleanup_t::operator()(
     m_histogram_n_smogpvs.data(context),
     m_histogram_pv_x.data(context),
     m_histogram_pv_y.data(context),
-    m_histogram_pv_z.data(context) );
+    m_histogram_pv_z.data(context));
 }
 
 __device__ void pv_beamline_cleanup::sort_pvs_by_z(PV::Vertex* final_vertices, unsigned n_vertices)
@@ -123,8 +123,7 @@ __global__ void pv_beamline_cleanup::pv_beamline_cleanup(
         dev_pv_y_histo.increment(vertex1.position.y);
       }
 
-      if (vertex1.position.z < BeamlinePVConstants::Common::SMOG2_pp_separation) 
-        atomicAdd(tmp_number_SMOG_vertices, 1);      
+      if (vertex1.position.z < BeamlinePVConstants::Common::SMOG2_pp_separation) atomicAdd(tmp_number_SMOG_vertices, 1);
     }
   }
   __syncthreads();
-- 
GitLab