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();
109 toZ.rotateZ(-1*Ptmp.phi());
110 toZ.rotateY(-1*Ptmp.theta());
112 fCache.Get().theTotalMeanEnergy=0;
115 std::vector<int> nParticles;
131 sumZ += massCode/1000 * nPart;
132 sumA += massCode % 1000 * nPart;
134 if( getenv(
"G4ParticleHPDebug") )
G4cout << i <<
" G4ParticleHPEnAngCorrelation::MULTIPLICITY " << massCode <<
" sumZ " << sumZ <<
" sumA " << sumA <<
" NPART " << nPart <<
G4endl;
136 nParticles.push_back( nPart );
139 double targetZ =
fCache.Get().theTarget->GetDefinition()->GetAtomicNumber();
140 double targetA =
fCache.Get().theTarget->GetDefinition()->GetAtomicMass();
141 targetZ +=
fCache.Get().theProjectileRP->GetDefinition()->GetAtomicNumber();
142 targetA +=
fCache.Get().theProjectileRP->GetDefinition()->GetAtomicMass();
144 if ( (sumZ != targetZ || sumA != targetA ) &&
145 (sumZ > targetZ || sumA > targetA
150 if( getenv(
"G4ParticleHPDebug") )
151 G4cerr <<
" WRONG MULTIPLICITY Z= " << sumZ
154 <<
" > " << targetA <<
G4endl;
162 G4Exception(
"G4ParticleHPEnAngCorrelation::Sample",
165 "Too many trials were done. Exiting current loop by force. You may have Probably, the result violating (baryon number) conservation law will be obtained.");
184 fCache.Get().theTotalMeanEnergy += aMeanEnergy;
192 for(
unsigned int ii=0; ii<it->size(); ii++)
196 it->operator[](ii)->GetTotalEnergy());
198 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4particleHPEnAngCorrelation COS THETA " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
199 it->operator[](ii)->SetMomentum(pTmp1.vect());
200 it->operator[](ii)->SetTotalEnergy(pTmp1.e());
201 if( getenv(
"G4PHPTEST") )
G4cout <<
" G4particleHPEnAngCorrelation COS THETA after toLab " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
205 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*
fCache.Get().theTarget));
210 if( getenv(
"G4ParticleHPDebug") )
211 G4cout <<
"G4ParticleHPEnAngCorrelation: before Lorentz boost "<<
212 it->at(ii)->GetKineticEnergy()<<
" "<<
213 it->at(ii)->GetMomentum()<<
G4endl;
215 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
217 if( getenv(
"G4ParticleHPDebug") )
218 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
219 it->at(ii)->GetKineticEnergy()<<
" "<<
220 it->at(ii)->GetMomentum()<<
G4endl;
229 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*
fCache.Get().theTarget));
231 if( getenv(
"G4ParticleHPDebug") )
232 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
233 it->at(ii)->GetKineticEnergy()<<
" "<<
234 it->at(ii)->GetMomentum()<<
G4endl;
240 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
242 if( getenv(
"G4ParticleHPDebug") )
243 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
244 it->at(ii)->GetKineticEnergy()<<
" "<<
245 it->at(ii)->GetMomentum()<<
G4endl;
251 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
253 if( getenv(
"G4PHPTEST") )
G4cout <<
frameFlag <<
" G4particleHPEnAngCorrelation COS THETA after Lorentz " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
257 result->push_back(it->operator[](ii));
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepLorentzRotation G4LorentzRotation
void SetMomentum(const G4double x, const G4double y, const G4double z)
G4Cache< toBeCached > fCache
G4double MeanEnergyOfThisInteraction()
G4ReactionProductVector * Sample(G4double anEnergy)
std::vector< G4ReactionProduct * > G4ReactionProductVector
void SetMass(const G4double mas)
G4GLOB_DLL std::ostream G4cout
void SetTotalEnergy(const G4double en)
static G4IonTable * GetIonTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetTotalEnergy() const
G4int GetMultiplicity(G4double anEnergy)
G4ReactionProduct * SampleOne(G4double anEnergy)
G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles)
G4ThreeVector GetMomentum() const
G4ParticleHPProduct * theProducts
G4GLOB_DLL std::ostream G4cerr
CLHEP::HepLorentzVector G4LorentzVector