From e9d6d8e596496de5ff3c88fb9c2742ebb4b6a063 Mon Sep 17 00:00:00 2001
From: "guofangyi@ihep.ac.cn" <guofangyi@ihep.ac.cn>
Date: Thu, 26 Dec 2024 02:58:42 +0000
Subject: [PATCH] Correct the beam particle number sampling in beam background
 simulation

---
 Generator/src/BeamBackgroundFileParserV1.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Generator/src/BeamBackgroundFileParserV1.cpp b/Generator/src/BeamBackgroundFileParserV1.cpp
index a39d2cd3..fc17b2ba 100644
--- a/Generator/src/BeamBackgroundFileParserV1.cpp
+++ b/Generator/src/BeamBackgroundFileParserV1.cpp
@@ -69,8 +69,7 @@ bool BeamBackgroundFileParserV1::load(IBeamBackgroundFileParser::BeamBackgroundD
 bool BeamBackgroundFileParserV1::SampleParticleNum(int& npart, int& start ){
 
   if(m_Nmcp==-1){
-    npart = int(m_rate * m_timewindow);
-    npart = CLHEP::RandPoisson::shoot(npart);
+    npart = int( CLHEP::RandPoisson::shoot(m_rate * m_timewindow) ) ;
   }
   else npart = m_Nmcp;
 
-- 
GitLab