52 G4int icounter_max=1024;
55 if ( icounter > icounter_max ) {
56 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
63 if(temp->size()!=1)
throw G4HadronicException(__FILE__, __LINE__,
"SampleOne: Yield not correct");
66 result = temp->operator[](0);
94 G4double cmsMom = std::sqrt(the3CMS*the3CMS);
95 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
105 anEnergy =
fCache.Get().theProjectileRP->GetKineticEnergy();
112 fCache.Get().theTotalMeanEnergy=0;
115 std::vector<int> nParticles;
133 sumZ += massCode/1000 * nPart;
134 sumA += massCode % 1000 * nPart;
136 if( getenv(
"G4ParticleHPDebug") )
G4cout << i <<
" G4ParticleHPEnAngCorrelation::MULTIPLICITY " << massCode <<
" sumZ " << sumZ <<
" sumA " << sumA <<
" NPART " << nPart <<
G4endl;
138 nParticles.push_back( nPart );
141 double targetZ =
fCache.Get().theTarget->GetDefinition()->GetAtomicNumber();
142 double targetA =
fCache.Get().theTarget->GetDefinition()->GetAtomicMass();
143 targetZ +=
fCache.Get().theProjectileRP->GetDefinition()->GetAtomicNumber();
144 targetA +=
fCache.Get().theProjectileRP->GetDefinition()->GetAtomicMass();
161 if ( ( sumZ != targetZ || sumA != targetA )
162 && ( sumZ > targetZ || sumA > targetA || (targetZ-sumZ) >= (targetA-sumA) ) ) {
167 if ( getenv(
"G4ParticleHPDebug") )
168 G4cerr <<
" WRONG MULTIPLICITY Z= " << sumZ
171 <<
" > " << targetA <<
G4endl;
181 G4Exception(
"G4ParticleHPEnAngCorrelation::Sample",
184 "Too many trials were done. Exiting current loop by force. You may have Probably, the result violating (baryon number) conservation law will be obtained.");
203 fCache.Get().theTotalMeanEnergy += aMeanEnergy;
211 for(
unsigned int ii=0; ii<it->size(); ii++)
215 it->operator[](ii)->GetTotalEnergy());
217 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4particleHPEnAngCorrelation COS THETA " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
218 it->operator[](ii)->SetMomentum(pTmp1.vect());
219 it->operator[](ii)->SetTotalEnergy(pTmp1.e());
220 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4particleHPEnAngCorrelation COS THETA after toLab " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
224 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*
fCache.Get().theTarget));
229 if( getenv(
"G4ParticleHPDebug") )
230 G4cout <<
"G4ParticleHPEnAngCorrelation: before Lorentz boost "<<
231 it->at(ii)->GetKineticEnergy()<<
" "<<
232 it->at(ii)->GetMomentum()<<
G4endl;
234 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
236 if( getenv(
"G4ParticleHPDebug") )
237 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
238 it->at(ii)->GetKineticEnergy()<<
" "<<
239 it->at(ii)->GetMomentum()<<
G4endl;
248 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*
fCache.Get().theTarget));
250 if( getenv(
"G4ParticleHPDebug") )
251 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
252 it->at(ii)->GetKineticEnergy()<<
" "<<
253 it->at(ii)->GetMomentum()<<
G4endl;
259 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
261 if( getenv(
"G4ParticleHPDebug") )
262 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
263 it->at(ii)->GetKineticEnergy()<<
" "<<
264 it->at(ii)->GetMomentum()<<
G4endl;
270 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
272 if( getenv(
"G4PHPTEST") )
G4cout <<
frameFlag <<
" G4particleHPEnAngCorrelation COS THETA after Lorentz " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
276 result->push_back(it->operator[](ii));
G4int GetMultiplicity(G4double anEnergy)
G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles)
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4ReactionProductVector * Sample(G4double anEnergy)
G4ReactionProduct * SampleOne(G4double anEnergy)
void SetTotalEnergy(const G4double en)
void SetMass(const G4double mas)
G4double GetTotalEnergy() const
G4Cache< toBeCached > fCache
HepLorentzRotation & rotateZ(double delta)
HepLorentzRotation inverse() const
G4ThreeVector GetMomentum() const
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4GLOB_DLL std::ostream G4cerr
G4double G4ParticleHPJENDLHEData::G4double result
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
G4double MeanEnergyOfThisInteraction()
HepLorentzRotation & rotateY(double delta)
G4ParticleHPProduct * theProducts
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)