From d8468dad31f6d2738f7abceb316327e8ede12149 Mon Sep 17 00:00:00 2001
From: Bertram Kopf <bertram@ep1.rub.de>
Date: Fri, 28 Jun 2024 11:19:48 +0200
Subject: [PATCH] minor fix for the consideration of electric charge in
 AbsDecay.cc

---
 PwaUtils/AbsDecay.cc | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/PwaUtils/AbsDecay.cc b/PwaUtils/AbsDecay.cc
index 9e842433..fc9207af 100644
--- a/PwaUtils/AbsDecay.cc
+++ b/PwaUtils/AbsDecay.cc
@@ -144,13 +144,22 @@ AbsDecay::AbsDecay(Particle* mother, Particle* daughter1, Particle* daughter2,
     
     _isospinClebschG=Clebsch(_idaughter1, _i3daughter1, _idaughter2, _i3daughter2, Imother, I3mother);
 
+    //check electric charge
+    if( _mother->charge() != (_daughter1->charge()+_daughter2->charge())){
+      Alert << "electric charge is not conserved for the decay " << _mother->name() << " to " 
+	    << _daughter1->name() << " " << _daughter2->name() << endmsg;
+      Alert << "mother->charge(): " << _mother->charge() << " != " << "daughter1->charge(): " <<  _daughter1->charge() 
+	    << " + " << "daughter1->charge(): " <<  _daughter2->charge() << endmsg;
+      exit(1); 
+    }
+
     //check z-component of the isospin
     if( I3mother != (_i3daughter1+_i3daughter2)){
-      Alert << "electric charge is not conserved for the decay " << _mother->name() << " to " 
+      WarningMsg << "electric charge is not conserved for the decay " << _mother->name() << " to " 
 	    << _daughter1->name() << " " << _daughter2->name() << endmsg;
-      Alert << "I3(mother): " << I3mother << " != " << "I3(daughter1): " <<  _i3daughter1 
+      WarningMsg << "I3(mother): " << I3mother << " != " << "I3(daughter1): " <<  _i3daughter1 
 	    << " + " << "I3(daughter2): " <<  _i3daughter2 << endmsg;
-      exit(1); 
+      // exit(1); 
     } 
   
     if(fabs(_isospinClebschG)<1.e-8){
-- 
GitLab