51 :numberOfProducts(0),theParentParticle(0)
57 :numberOfProducts(0),theParentParticle(0)
72 for (
G4int index=0; index < right.numberOfProducts; index++) {
85 theProductVector->push_back( pDaughter );
87 numberOfProducts = right.numberOfProducts;
97 if (theParentParticle != 0)
delete theParentParticle;
101 for (index=0; index < numberOfProducts; index++) {
102 delete theProductVector->at(index);
104 theProductVector->clear();
107 for (index=0; index < right.numberOfProducts; index++) {
119 theProductVector->push_back( pDaughter );
121 numberOfProducts = right.numberOfProducts;
130 if (theParentParticle != 0)
delete theParentParticle;
133 for (
G4int index=0; index < numberOfProducts; index++) {
134 delete theProductVector->at(index);
136 theProductVector->clear();
137 numberOfProducts = 0;
138 delete theProductVector;
143 if ( numberOfProducts >0 ) {
144 numberOfProducts -= 1;
146 theProductVector->pop_back();
155 theProductVector->push_back(aParticle);
156 numberOfProducts += 1;
157 return numberOfProducts;
162 if ((numberOfProducts > anIndex) && (anIndex >=0) ) {
163 return theProductVector->at(anIndex);
171 if (theParentParticle != 0)
delete theParentParticle;
181 if (totalEnergy > mass ) totalMomentum = std::sqrt( (totalEnergy - mass)*(totalEnergy + mass) );
182 G4double betax = momentumDirection.
x()*totalMomentum/totalEnergy;
183 G4double betay = momentumDirection.
y()*totalMomentum/totalEnergy;
184 G4double betaz = momentumDirection.
z()*totalMomentum/totalEnergy;
185 this->
Boost(betax, betay, betaz);
201 G4double betax = -1.0*direction.
x()*momentum/energy;
202 G4double betay = -1.0*direction.
y()*momentum/energy;
203 G4double betaz = -1.0*direction.
z()*momentum/energy;
205 for (
G4int index=0; index < numberOfProducts; index++) {
207 p4 = (theProductVector->at(index))->Get4Momentum();
210 p4.
boost(betax, betay, betaz);
213 p4.
boost(newbetax, newbetay, newbetaz);
216 (theProductVector->at(index))->Set4Momentum(p4);
219 for (
G4int index=0; index < numberOfProducts; index++) {
221 p4 = (theProductVector->at(index))->Get4Momentum();
224 p4.
boost(newbetax, newbetay, newbetaz);
227 (theProductVector->at(index))->Set4Momentum(p4);
231 mass = theParentParticle->
GetMass();
235 parent4.
boost(newbetax, newbetay, newbetaz);
243 G4bool returnValue =
true;
250 if ( (parent_momentum.
mag() >0.0) && (std::fabs(direction.
mag()-1.0) >1.0e-6 ) ) {
252 G4cerr <<
"G4DecayProducts::IsChecked():: "
253 <<
" Momentum Direction Vector of Parent is not normalized "
254 <<
" (=" << direction.
mag() <<
")" <<
G4endl;
257 parent_momentum = parent_momentum * (1./direction.
mag());
263 G4double total_energy = parent_energy;
265 for (
G4int index=0; index < numberOfProducts; index++)
273 if ( (momentum.
mag()>0.0) && (std::fabs(direction.
mag()-1.0) > 1.0e-6)) {
275 G4cerr <<
"G4DecayProducts::IsChecked():: "
276 <<
" Momentum Direction Vector of Daughter [" << index
277 <<
"] is not normalized (=" << direction.
mag() <<
")" <<
G4endl;
280 momentum = momentum * (1./direction.
mag());
283 if (energy - mass <
DBL_MIN ) {
285 G4cerr <<
"G4DecayProducts::IsChecked():: "
286 <<
" Daughter [" << index <<
"] has no kinetic energy "<<
G4endl;
290 total_energy -= energy;
291 total_momentum -= momentum;
294 if ( (std::fabs(total_energy) >1.0e-9*MeV) || (total_momentum.
mag() >1.0e-9*MeV ) ){
296 G4cerr <<
"G4DecayProducts::IsChecked():: "
297 <<
" Energy/Momentum is not conserved "<<
G4endl;
298 G4cerr <<
" difference between parent energy and sum of dughters' energy : "
299 << total_energy /MeV <<
"[MeV] " <<
G4endl;
300 G4cerr <<
" difference between parent momentum and sum of dughters' momentum : "
301 <<
" x:" << total_momentum.
getX()/MeV
302 <<
" y:" << total_momentum.
getY()/MeV
303 <<
" z:" << total_momentum.
getZ()/MeV
313 G4cout <<
" ----- List of DecayProducts -----" <<
G4endl;
314 G4cout <<
" ------ Parent Particle ----------" <<
G4endl;
315 if (theParentParticle != 0) theParentParticle->
DumpInfo();
316 G4cout <<
" ------ Daughter Particles ------" <<
G4endl;
317 for (
G4int index=0; index < numberOfProducts; index++)
319 G4cout <<
" ----------" << index+1 <<
" -------------" <<
G4endl;
320 (theProductVector->at(index))->
DumpInfo();
322 G4cout <<
" ----- End List of DecayProducts -----" <<
G4endl;
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
HepLorentzVector & boost(double, double, double)
G4DynamicParticle * PopProducts()
std::vector< G4DynamicParticle * > G4DecayProductVector
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