59 for (
G4int index=0; index<right.numberOfProducts; ++index)
69 if (pPreAssigned !=
nullptr)
74 theProductVector->push_back( pDaughter );
76 numberOfProducts = right.numberOfProducts;
86 if (theParentParticle !=
nullptr)
delete theParentParticle;
90 for (index=0; index<numberOfProducts; ++index)
92 delete theProductVector->at(index);
94 theProductVector->clear();
97 for (index=0; index<right.numberOfProducts; ++index)
107 if (pPreAssigned !=
nullptr)
112 theProductVector->push_back( pDaughter );
114 numberOfProducts = right.numberOfProducts;
122 if (theParentParticle !=
nullptr)
delete theParentParticle;
123 theParentParticle =
nullptr;
126 for (
G4int index=0; index<numberOfProducts; ++index)
128 delete theProductVector->at(index);
130 theProductVector->clear();
131 numberOfProducts = 0;
132 delete theProductVector;
133 theProductVector =
nullptr;
138 if ( numberOfProducts >0 )
140 numberOfProducts -= 1;
142 theProductVector->pop_back();
153 theProductVector->push_back(aParticle);
154 numberOfProducts += 1;
155 return numberOfProducts;
160 if ((numberOfProducts > anIndex) && (anIndex >=0) )
162 return theProductVector->at(anIndex);
172 if (theParentParticle !=
nullptr)
delete theParentParticle;
183 if ( totalEnergy > mass )
185 totalMomentum = std::sqrt( (totalEnergy - mass)*(totalEnergy + mass) );
187 G4double betax = momentumDirection.
x()*totalMomentum/totalEnergy;
188 G4double betay = momentumDirection.
y()*totalMomentum/totalEnergy;
189 G4double betaz = momentumDirection.
z()*totalMomentum/totalEnergy;
190 Boost(betax, betay, betaz);
209 G4double betax = -1.0*direction.
x()*momentum/energy;
210 G4double betay = -1.0*direction.
y()*momentum/energy;
211 G4double betaz = -1.0*direction.
z()*momentum/energy;
213 for (
G4int index=0; index<numberOfProducts; ++index)
216 p4 = (theProductVector->at(index))->Get4Momentum();
219 p4.
boost(betax, betay, betaz);
222 p4.
boost(newbetax, newbetay, newbetaz);
225 (theProductVector->at(index))->Set4Momentum(p4);
230 for (
G4int index=0; index<numberOfProducts; ++index)
233 p4 = (theProductVector->at(index))->Get4Momentum();
236 p4.
boost(newbetax, newbetay, newbetaz);
239 (theProductVector->at(index))->Set4Momentum(p4);
244 mass = theParentParticle->
GetMass();
248 parent4.
boost(newbetax, newbetay, newbetaz);
256 G4bool returnValue =
true;
266 if ((parent_momentum.
mag() >0.0) && (std::fabs(direction.
mag()-1.0) >1.0e-6))
269 G4cout <<
"G4DecayProducts::IsChecked():: "
270 <<
" Momentum Direction Vector of Parent is not normalized "
271 <<
" (=" << direction.
mag() <<
")" <<
G4endl;
274 parent_momentum = parent_momentum * (1./direction.
mag());
280 G4double total_energy = parent_energy;
283 for (
G4int index=0; index < numberOfProducts; ++index)
292 if ( (momentum.
mag()>0.0) && (std::fabs(direction.
mag()-1.0) > 1.0e-6))
295 G4cout <<
"G4DecayProducts::IsChecked():: "
296 <<
" Momentum Direction Vector of Daughter [" << index
297 <<
"] is not normalized (=" << direction.
mag() <<
")" <<
G4endl;
300 momentum = momentum * (1./direction.
mag());
306 G4cout <<
"G4DecayProducts::IsChecked():: "
307 <<
" Daughter [" << index <<
"] has no kinetic energy "<<
G4endl;
311 total_energy -= energy;
312 total_momentum -= momentum;
315 if ( (std::fabs(total_energy) >1.0e-9*MeV)
316 || (total_momentum.
mag() >1.0e-9*MeV ) )
319 G4cout <<
"G4DecayProducts::IsChecked():: "
320 <<
" Energy/Momentum is not conserved "<<
G4endl;
321 G4cout <<
" difference between parent energy & sum of daughters energy: "
322 << total_energy /MeV <<
"[MeV] " <<
G4endl;
323 G4cout <<
" difference between parent momentum & sum of daughters momentum: "
324 <<
" x:" << total_momentum.
getX()/MeV
325 <<
" y:" << total_momentum.
getY()/MeV
326 <<
" z:" << total_momentum.
getZ()/MeV
336 G4cout <<
" ----- List of DecayProducts -----" <<
G4endl;
337 G4cout <<
" ------ Parent Particle ----------" <<
G4endl;
338 if (theParentParticle != 0) theParentParticle->
DumpInfo();
339 G4cout <<
" ------ Daughter Particles ------" <<
G4endl;
340 for (
G4int index=0; index<numberOfProducts; ++index)
342 G4cout <<
" ----------" << index+1 <<
" -------------" <<
G4endl;
343 (theProductVector->at(index))->
DumpInfo();
345 G4cout <<
" ----- End List of DecayProducts -----" <<
G4endl;
G4GLOB_DLL std::ostream G4cout
HepLorentzVector & boost(double, double, double)
std::vector< G4DynamicParticle * > G4DecayProductVector
G4DynamicParticle * PopProducts()
G4int PushProducts(G4DynamicParticle *aParticle)
G4DecayProducts & operator=(const G4DecayProducts &right)
G4DynamicParticle * operator[](G4int anIndex) const
void SetParentParticle(const G4DynamicParticle &aParticle)
void Boost(G4double totalEnergy, const G4ThreeVector &momentumDirection)
void SetPreAssignedDecayProducts(G4DecayProducts *aDecayProducts)
void DumpInfo(G4int mode=0) const
const G4ThreeVector & GetMomentumDirection() const
const G4DecayProducts * GetPreAssignedDecayProducts() const
G4double GetTotalEnergy() const
void Set4Momentum(const G4LorentzVector &momentum)
void SetPreAssignedDecayProperTime(G4double)
G4double GetPreAssignedDecayProperTime() const
G4double GetTotalMomentum() const