Import Geant4 6.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:49:58 +02:00
parent 96686e0c8f
commit 1d812b78b1
4545 changed files with 24433 additions and 175005 deletions
@@ -31,6 +31,7 @@
#include "G4FragmentVector.hh"
#include "G4HadFinalState.hh"
#include "G4DynamicParticleVector.hh"
#include "G4HadTmpUtil.hh"
#include <algorithm>
@@ -50,57 +51,135 @@ public:
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* )
{
// decay the strong resonances
G4ReactionProductVector * theResult = new G4ReactionProductVector;
//static int call_count = 0;
//if(call_count++<10)
//{
// G4cout << "Security print-out: Entering G4DecayStrongResonances::Propagate";
//}
G4ReactionProductVector * theResult;
try
{
theResult = new G4ReactionProductVector;
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory ");
}
G4KineticTrackVector *result1, *secondaries, *result;
if(!theSecondaries)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: 0x0 input vector ");
}
result1=theSecondaries;
result=new G4KineticTrackVector();
try
{
result=new G4KineticTrackVector();
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory in ");
}
size_t aResult=0;
for (aResult=0; aResult < result1->size(); aResult++)
{
G4ParticleDefinition * pdef;
if(!result1->operator[](aResult))
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: null pointer in input vector!!! ");
}
pdef=result1->operator[](aResult)->GetDefinition();
if(!pdef)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: 0x0 particle definition ");
}
secondaries=NULL;
if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
{
secondaries = result1->operator[](aResult)->Decay();
try
{
secondaries = result1->operator[](aResult)->Decay();
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: failing in Decay ");
}
}
if ( secondaries == NULL )
{
result->push_back(result1->operator[](aResult));
try
{
result->push_back(result1->operator[](aResult));
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push_back failed - out of memory ");
}
result1->operator[](aResult)=NULL; //protect for clearAndDestroy
}
else
{
for (size_t aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
{
try
{
result1->push_back(secondaries->operator[](aSecondary));
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push_back 1 failed - out of mem");
}
}
delete secondaries;
if(secondaries) delete secondaries;
}
}
std::for_each(result1->begin(), result1->end(), DeleteKineticTrack());
delete result1;
try
{
std::for_each(result1->begin(), result1->end(), G4Delete());
delete result1;
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: memory corruption.");
}
// translate to ReactionProducts
G4ReactionProduct * it = NULL;
for(aResult=0; aResult < result->size(); aResult++)
{
it = new G4ReactionProduct();
try
{
it = new G4ReactionProduct();
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: out of memory ");
}
it->SetDefinition((*result)[aResult]->GetDefinition());
it->SetMass((*result)[aResult]->GetDefinition()->GetPDGMass());
it->SetTotalEnergy((*result)[aResult]->Get4Momentum().t());
it->SetMomentum((*result)[aResult]->Get4Momentum().vect());
theResult->push_back(it);
try
{
theResult->push_back(it);
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: push to result failed - out of mem.");
}
}
try
{
std::for_each(result->begin(), result->end(), G4Delete());
delete result;
}
catch(...)
{
throw G4HadronicException(__FILE__, __LINE__, "DecayStrongRes: memory corruption at end.");
}
std::for_each(result->begin(), result->end(), DeleteKineticTrack());
delete result;
return theResult;
}
private:
};
#endif // G4DecayStrongResonances_h
@@ -139,6 +139,7 @@ G4LorentzVector G4ExcitedString::Get4Momentum() const
G4LorentzVector momentum;
for ( unsigned int index=0; index < thePartons.size() ; index++ )
{
// std::cout << "HPW "<<thePartons[index]->Get4Momentum()<<std::endl;
momentum += thePartons[index]->Get4Momentum();
}
return momentum;