47 if(nProducts!=1)
throw G4HadronicException(__FILE__, __LINE__,
"More than one product in SampleOne");
54 G4int icounter_max=1024;
57 if ( icounter > icounter_max ) {
58 G4cout <<
"Loop-counter exceeded the threshold value at " << __LINE__ <<
"th line of " << __FILE__ <<
"." <<
G4endl;
61 temp = theProducts[i++].
Sample(anEnergy,1);
65 if(temp->size()!=1)
throw G4HadronicException(__FILE__, __LINE__,
"SampleOne: Yield not correct");
68 result = temp->operator[](0);
89 G4ThreeVector the3IncidentPart = fCache.
Get().theProjectileRP->GetMomentum();
90 G4double nEnergy = fCache.
Get().theProjectileRP->GetTotalEnergy();
92 G4double tEnergy = fCache.
Get().theTarget->GetTotalEnergy();
96 G4double cmsMom = std::sqrt(the3CMS*the3CMS);
97 G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
101 aIncidentPart.
Lorentz(*fCache.
Get().theProjectileRP, theCMS);
107 anEnergy = fCache.
Get().theProjectileRP->GetKineticEnergy();
114 fCache.
Get().theTotalMeanEnergy=0;
117 for(i=0; i<nProducts; i++)
121 it = theProducts[i].
Sample(anEnergy,nPart);
129 fCache.
Get().theTotalMeanEnergy += aMeanEnergy;
133 fCache.
Get().theTotalMeanEnergy = anEnergy/nProducts+theProducts[i].
GetQValue();
137 for(
unsigned int ii=0; ii<it->size(); ii++)
141 it->operator[](ii)->GetTotalEnergy());
143 if( std::getenv(
"G4PHPTEST") )
G4cout <<
" G4particleHPEnAngCorrelation COS THETA " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
144 it->operator[](ii)->SetMomentum(pTmp1.
vect());
145 it->operator[](ii)->SetTotalEnergy(pTmp1.
e());
146 if( std::getenv(
"G4PHPTEST") )
G4cout <<
" G4particleHPEnAngCorrelation COS THETA after toLab " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
150 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*fCache.
Get().theTarget));
152 else if(frameFlag==2 )
155 if( std::getenv(
"G4ParticleHPDebug") )
156 G4cout <<
"G4ParticleHPEnAngCorrelation: before Lorentz boost "<<
157 it->at(ii)->GetKineticEnergy()<<
" "<<
158 it->at(ii)->GetMomentum()<<
G4endl;
160 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
162 if( std::getenv(
"G4ParticleHPDebug") )
163 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
164 it->at(ii)->GetKineticEnergy()<<
" "<<
165 it->at(ii)->GetMomentum()<<
G4endl;
169 else if(frameFlag==3)
171 if ( theProducts[i].GetMassCode() > 2004.5 )
174 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*(*fCache.
Get().theTarget));
176 if( std::getenv(
"G4ParticleHPDebug") )
177 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
178 it->at(ii)->GetKineticEnergy()<<
" "<<
179 it->at(ii)->GetMomentum()<<
G4endl;
185 it->operator[](ii)->Lorentz(*(it->operator[](ii)), -1.*theCMS);
187 if( std::getenv(
"G4ParticleHPDebug") )
188 G4cout <<
"G4ParticleHPEnAngCorrelation: after Lorentz boost "<<
189 it->at(ii)->GetKineticEnergy()<<
" "<<
190 it->at(ii)->GetMomentum()<<
G4endl;
196 throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPEnAngCorrelation::Sample: The frame of the finalstate is not specified");
198 if( std::getenv(
"G4PHPTEST") )
G4cout << frameFlag <<
" G4particleHPEnAngCorrelation COS THETA after Lorentz " << std::cos(it->operator[](ii)->GetMomentum().theta()) <<
G4endl;
202 result->push_back(it->operator[](ii));
std::vector< G4ReactionProduct * > G4ReactionProductVector
G4GLOB_DLL std::ostream G4cout
HepLorentzRotation & rotateY(double delta)
HepLorentzRotation & rotateZ(double delta)
HepLorentzRotation inverse() const
G4ReactionProduct * SampleOne(G4double anEnergy)
G4ReactionProductVector * Sample(G4double anEnergy)
G4ReactionProductVector * Sample(G4double anEnergy, G4int nParticles)
G4double MeanEnergyOfThisInteraction()
G4int GetMultiplicity(G4double anEnergy)
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
G4double GetTotalEnergy() const
G4ThreeVector GetMomentum() const
void Lorentz(const G4ReactionProduct &p1, const G4ReactionProduct &p2)
void SetMass(const G4double mas)