Skip to content
Snippets Groups Projects
Commit eb83b90c authored by deserevi's avatar deserevi
Browse files

* Add error message and exit NPSimulation when charge or mass is not conserved

  in the reaction.
parent 556cddd9
No related branches found
No related tags found
No related merge requests found
...@@ -83,20 +83,26 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na ...@@ -83,20 +83,26 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na
{ {
//------------- Constructor with nuclei names and beam energy ------------ //------------- Constructor with nuclei names and beam energy ------------
fNuclei1 = new Nucleus(name1); fNuclei1 = new Nucleus(name1);
fNuclei2 = new Nucleus(name2); fNuclei2 = new Nucleus(name2);
fNuclei3 = new Nucleus(name3); fNuclei3 = new Nucleus(name3);
fNuclei4 = new Nucleus(name4); fNuclei4 = new Nucleus(name4);
fBeamEnergy = BeamEnergy; fBeamEnergy = BeamEnergy;
fThetaCM = 0; fThetaCM = 0;
fExcitationLight = ExcitationEnergyLight; fExcitationLight = ExcitationEnergyLight;
fExcitationHeavy = ExcitationEnergyHeavy; fExcitationHeavy = ExcitationEnergyHeavy;
fQValue = ( fNuclei1->GetMassExcess() + fNuclei2->GetMassExcess() fQValue = (fNuclei1->GetMassExcess() + fNuclei2->GetMassExcess()
- fNuclei3->GetMassExcess() - fNuclei4->GetMassExcess()) / 1000; - fNuclei3->GetMassExcess() - fNuclei4->GetMassExcess()) / 1000;
int masse = fNuclei1->GetA() + fNuclei2->GetA() - fNuclei3->GetA() - fNuclei4->GetA(); int masse = fNuclei1->GetA() + fNuclei2->GetA() - fNuclei3->GetA() - fNuclei4->GetA();
int charge = fNuclei1->GetZ() + fNuclei2->GetZ() - fNuclei3->GetZ() - fNuclei4->GetZ(); int charge = fNuclei1->GetZ() + fNuclei2->GetZ() - fNuclei3->GetZ() - fNuclei4->GetZ();
if (masse || charge) cout << "Problem with charge or mass conservation" << endl; if (masse || charge) {
cout << endl;
cout << "********************************** Error **********************************" << endl;
cout << "* NPReaction: charge of mass not conserved. Check you event generator file *" << endl;
cout << "***************************************************************************************" << endl;
exit(1);
}
///Read the differential cross section ///Read the differential cross section
string GlobalPath = getenv("NPTOOL"); string GlobalPath = getenv("NPTOOL");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment