00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 #include "G4QCoherentChargeExchange.hh"
00061 #include "G4SystemOfUnits.hh"
00062 #include "G4HadronicDeprecate.hh"
00063
00064
00065
00066
00067
00068 G4int G4QCoherentChargeExchange::nPartCWorld=85;
00069 std::vector<G4int> G4QCoherentChargeExchange::ElementZ;
00070 std::vector<G4double> G4QCoherentChargeExchange::ElProbInMat;
00071 std::vector<std::vector<G4int>*> G4QCoherentChargeExchange::ElIsoN;
00072 std::vector<std::vector<G4double>*>G4QCoherentChargeExchange::IsoProbInEl;
00073
00074
00075 G4QCoherentChargeExchange::G4QCoherentChargeExchange(const G4String& processName)
00076 : G4VDiscreteProcess(processName, fHadronic)
00077 {
00078 G4HadronicDeprecate("G4QCoherentChargeExchange");
00079
00080 #ifdef debug
00081 G4cout<<"G4QCohChargeEx::Constructor is called processName="<<processName<<G4endl;
00082 #endif
00083 if (verboseLevel>0) G4cout << GetProcessName() << " process is created "<< G4endl;
00084
00085 }
00086
00087
00088 G4QCoherentChargeExchange::~G4QCoherentChargeExchange() {}
00089
00090
00091 G4LorentzVector G4QCoherentChargeExchange::GetEnegryMomentumConservation()
00092 {return EnMomConservation;}
00093
00094 G4int G4QCoherentChargeExchange::GetNumberOfNeutronsInTarget() {return nOfNeutrons;}
00095
00096
00097
00098
00099 G4double G4QCoherentChargeExchange::GetMeanFreePath(const G4Track& aTrack,G4double Q,
00100 G4ForceCondition* Fc)
00101 {
00102 *Fc = NotForced;
00103 const G4DynamicParticle* incidentParticle = aTrack.GetDynamicParticle();
00104 G4ParticleDefinition* incidentParticleDefinition=incidentParticle->GetDefinition();
00105 if( !IsApplicable(*incidentParticleDefinition))
00106 G4cout<<"*W*G4QCohChargeEx::GetMeanFreePath called for notImplementedParticle"<<G4endl;
00107
00108 G4double Momentum = incidentParticle->GetTotalMomentum();
00109 #ifdef debug
00110 G4double KinEn = incidentParticle->GetKineticEnergy();
00111 G4cout<<"G4QCohChEx::GetMeanFreePath: kinE="<<KinEn<<",Mom="<<Momentum<<G4endl;
00112 #endif
00113 const G4Material* material = aTrack.GetMaterial();
00114 const G4double* NOfNucPerVolume = material->GetVecNbOfAtomsPerVolume();
00115 const G4ElementVector* theElementVector = material->GetElementVector();
00116 G4int nE=material->GetNumberOfElements();
00117 #ifdef debug
00118 G4cout<<"G4QCohChargeExchange::GetMeanFreePath:"<<nE<<" Elem's in theMaterial"<<G4endl;
00119 #endif
00120 G4int pPDG=0;
00121
00122 if (incidentParticleDefinition == G4Proton::Proton() ) pPDG=2212;
00123 else if(incidentParticleDefinition == G4Neutron::Neutron()) pPDG=2112;
00124 else G4cout<<"G4QCohChargeEx::GetMeanFreePath: only nA & pA are implemented"<<G4endl;
00125
00126 G4QIsotope* Isotopes = G4QIsotope::Get();
00127 G4double sigma=0.;
00128 G4int IPIE=IsoProbInEl.size();
00129 if(IPIE) for(G4int ip=0; ip<IPIE; ++ip)
00130 {
00131 std::vector<G4double>* SPI=IsoProbInEl[ip];
00132 SPI->clear();
00133 delete SPI;
00134 std::vector<G4int>* IsN=ElIsoN[ip];
00135 IsN->clear();
00136 delete IsN;
00137 }
00138 ElProbInMat.clear();
00139 ElementZ.clear();
00140 IsoProbInEl.clear();
00141 ElIsoN.clear();
00142 for(G4int i=0; i<nE; ++i)
00143 {
00144 G4Element* pElement=(*theElementVector)[i];
00145 G4int Z = static_cast<G4int>(pElement->GetZ());
00146 ElementZ.push_back(Z);
00147 G4int isoSize=0;
00148 G4int indEl=0;
00149 G4IsotopeVector* isoVector=pElement->GetIsotopeVector();
00150 if(isoVector) isoSize=isoVector->size();
00151 #ifdef debug
00152 G4cout<<"G4QCoherentChargeExchange::GetMeanFreePath:isovectorLength="<<isoSize<<G4endl;
00153 #endif
00154 if(isoSize)
00155 {
00156 indEl=pElement->GetIndex()+1;
00157 #ifdef debug
00158 G4cout<<"G4QCCX::GetMFP: iE="<<indEl<<", def="<<Isotopes->IsDefined(Z,indEl)<<G4endl;
00159 #endif
00160 if(!Isotopes->IsDefined(Z,indEl))
00161 {
00162 std::vector<std::pair<G4int,G4double>*>* newAbund =
00163 new std::vector<std::pair<G4int,G4double>*>;
00164 G4double* abuVector=pElement->GetRelativeAbundanceVector();
00165 for(G4int j=0; j<isoSize; j++)
00166 {
00167 G4int N=pElement->GetIsotope(j)->GetN()-Z;
00168 if(pElement->GetIsotope(j)->GetZ()!=Z)G4cerr<<"G4QCohChX::GetMeanFreePath: Z="
00169 <<pElement->GetIsotope(j)->GetZ()<<"#"<<Z<<G4endl;
00170 G4double abund=abuVector[j];
00171 std::pair<G4int,G4double>* pr= new std::pair<G4int,G4double>(N,abund);
00172 #ifdef debug
00173 G4cout<<"G4QCohChEx::GetMeanFreePath:pair#="<<j<<",N="<<N<<",ab="<<abund<<G4endl;
00174 #endif
00175 newAbund->push_back(pr);
00176 }
00177 #ifdef debug
00178 G4cout<<"G4QCohChEx::GetMeanFreePath: pairVectorLength="<<newAbund->size()<<G4endl;
00179 #endif
00180 indEl=G4QIsotope::Get()->InitElement(Z,indEl,newAbund);
00181 for(G4int k=0; k<isoSize; k++) delete (*newAbund)[k];
00182 delete newAbund;
00183 }
00184 }
00185 std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->GetCSVector(Z,indEl);
00186 std::vector<G4double>* SPI = new std::vector<G4double>;
00187 IsoProbInEl.push_back(SPI);
00188 std::vector<G4int>* IsN = new std::vector<G4int>;
00189 ElIsoN.push_back(IsN);
00190 G4int nIs=cs->size();
00191 #ifdef debug
00192 G4cout<<"G4QCohChargEx::GMFP:=***=>,#isot="<<nIs<<", Z="<<Z<<", indEl="<<indEl<<G4endl;
00193 #endif
00194 G4double susi=0.;
00195 if(nIs) for(G4int j=0; j<nIs; j++)
00196 {
00197 std::pair<G4int,G4double>* curIs=(*cs)[j];
00198 G4int N=curIs->first;
00199 IsN->push_back(N);
00200 #ifdef debug
00201 G4cout<<"G4QCCX::GMFP:true, P="<<Momentum<<",Z="<<Z<<",N="<<N<<",PDG="<<pPDG<<G4endl;
00202 #endif
00203 G4bool ccsf=true;
00204 if(Q==-27.) ccsf=false;
00205 #ifdef debug
00206 G4cout<<"G4QCoherentChargeExchange::GMFP: GetCS #1 j="<<j<<G4endl;
00207 #endif
00208 G4double CSI=CalculateXSt(ccsf, true, Momentum, Z, N, pPDG);
00209
00210 #ifdef debug
00211 G4cout<<"G4QCohChEx::GetMeanFreePath:jI="<<j<<",Zt="<<Z<<",Nt="<<N<<",Mom="<<Momentum
00212 <<", XSec="<<CSI/millibarn<<G4endl;
00213 #endif
00214 curIs->second = CSI;
00215 susi+=CSI;
00216 SPI->push_back(susi);
00217 }
00218 sigma+=Isotopes->GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i];
00219 #ifdef debug
00220 G4cout<<"G4QCohChEx::GMFP:<S>="<<Isotopes->GetMeanCrossSection(Z,indEl)<<",AddToSigma="
00221 <<Isotopes->GetMeanCrossSection(Z,indEl)*NOfNucPerVolume[i]<<G4endl;
00222 #endif
00223 ElProbInMat.push_back(sigma);
00224 }
00225
00226 #ifdef debug
00227 G4cout<<"G4QCoherentChargeExchange::GetMeanFreePath: MeanFreePath="<<1./sigma<<G4endl;
00228 #endif
00229 if(sigma > 0.) return 1./sigma;
00230 return DBL_MAX;
00231 }
00232
00233 G4bool G4QCoherentChargeExchange::IsApplicable(const G4ParticleDefinition& particle)
00234 {
00235 if (particle == *( G4Proton::Proton() )) return true;
00236 else if (particle == *( G4Neutron::Neutron() )) return true;
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261 #ifdef debug
00262 G4cout<<"***>>G4QCoherChargeExch::IsApplicable: PDG="<<particle.GetPDGEncoding()<<G4endl;
00263 #endif
00264 return false;
00265 }
00266
00267 G4VParticleChange* G4QCoherentChargeExchange::PostStepDoIt(const G4Track& track,
00268 const G4Step& step)
00269 {
00270 static const G4double mProt= G4QPDGCode(2212).GetMass();
00271 static const G4double mNeut= G4QPDGCode(2212).GetMass();
00272
00273
00274 static G4bool CWinit = true;
00275 if(CWinit)
00276 {
00277 CWinit=false;
00278 G4QCHIPSWorld::Get()->GetParticles(nPartCWorld);
00279 }
00280
00281 const G4DynamicParticle* projHadron = track.GetDynamicParticle();
00282 const G4ParticleDefinition* particle=projHadron->GetDefinition();
00283 #ifdef debug
00284 G4cout<<"G4QCohChargeExchange::PostStepDoIt: Before the GetMeanFreePath is called In4M="
00285 <<projHadron->Get4Momentum()<<" of PDG="<<particle->GetPDGEncoding()<<", Type="
00286 <<particle->GetParticleType()<<", Subtp="<<particle->GetParticleSubType()<<G4endl;
00287 #endif
00288 G4ForceCondition cond=NotForced;
00289 GetMeanFreePath(track, -27., &cond);
00290 #ifdef debug
00291 G4cout<<"G4QCohChargeExchange::PostStepDoIt: After GetMeanFreePath is called"<<G4endl;
00292 #endif
00293 G4LorentzVector proj4M=(projHadron->Get4Momentum())/MeV;
00294 G4double momentum = projHadron->GetTotalMomentum()/MeV;
00295 G4double Momentum = proj4M.rho();
00296 if(std::fabs(Momentum-momentum)>.000001)
00297 G4cerr<<"*Warning*G4QCohChEx::PostStepDoIt:P(IU)="<<Momentum<<"#"<<momentum<<G4endl;
00298 #ifdef pdebug
00299 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt: pP(IU)="<<Momentum<<"="<<momentum
00300 <<",pM="<<pM<<",proj4M="<<proj4M<<proj4M.m()<<G4endl;
00301 #endif
00302 if (!IsApplicable(*particle))
00303 {
00304 G4cerr<<"G4QCoherentChargeExchange::PostStepDoIt: Only NA is implemented."<<G4endl;
00305 return 0;
00306 }
00307 const G4Material* material = track.GetMaterial();
00308 G4int Z=0;
00309 const G4ElementVector* theElementVector = material->GetElementVector();
00310 G4int nE=material->GetNumberOfElements();
00311 #ifdef debug
00312 G4cout<<"G4QCohChargeExchange::PostStepDoIt: "<<nE<<" elements in the material."<<G4endl;
00313 #endif
00314 G4int projPDG=0;
00315
00316 if (particle == G4Proton::Proton() ) projPDG= 2212;
00317 else if (particle == G4Neutron::Neutron() ) projPDG= 2112;
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346 #ifdef debug
00347 G4int prPDG=particle->GetPDGEncoding();
00348 G4cout<<"G4QCohChrgExchange::PostStepDoIt: projPDG="<<projPDG<<", stPDG="<<prPDG<<G4endl;
00349 #endif
00350 if(!projPDG)
00351 {
00352 G4cerr<<"*Warning*G4QCoherentChargeExchange::PostStepDoIt:UndefinedProjHadron"<<G4endl;
00353 return 0;
00354 }
00355
00356
00357 G4double pM=mNeut;
00358 if(projPDG==2112) pM=mProt;
00359 G4double pM2=pM*pM;
00360
00361 G4int EPIM=ElProbInMat.size();
00362 #ifdef debug
00363 G4cout<<"G4QCohChEx::PostStDoIt:m="<<EPIM<<",n="<<nE<<",T="<<ElProbInMat[EPIM-1]<<G4endl;
00364 #endif
00365 G4int i=0;
00366 if(EPIM>1)
00367 {
00368 G4double rnd = ElProbInMat[EPIM-1]*G4UniformRand();
00369 for(i=0; i<nE; ++i)
00370 {
00371 #ifdef debug
00372 G4cout<<"G4QCohChEx::PostStepDoIt:EPM["<<i<<"]="<<ElProbInMat[i]<<",r="<<rnd<<G4endl;
00373 #endif
00374 if (rnd<ElProbInMat[i]) break;
00375 }
00376 if(i>=nE) i=nE-1;
00377 }
00378 G4Element* pElement=(*theElementVector)[i];
00379 Z=static_cast<G4int>(pElement->GetZ());
00380 #ifdef debug
00381 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt: i="<<i<<", Z(element)="<<Z<<G4endl;
00382 #endif
00383 if(Z<=0)
00384 {
00385 G4cerr<<"-Warning-G4QCoherentChargeExchange::PostStepDoIt: Element with Z="<<Z<<G4endl;
00386 if(Z<0) return 0;
00387 }
00388 std::vector<G4double>* SPI = IsoProbInEl[i];
00389 std::vector<G4int>* IsN = ElIsoN[i];
00390 G4int nofIsot=SPI->size();
00391 #ifdef debug
00392 G4cout<<"G4QCohChargeExchange::PosStDoIt:nI="<<nofIsot<<",T="<<(*SPI)[nofIsot-1]<<G4endl;
00393 #endif
00394 G4int j=0;
00395 if(nofIsot>1)
00396 {
00397 G4double rndI=(*SPI)[nofIsot-1]*G4UniformRand();
00398 for(j=0; j<nofIsot; ++j)
00399 {
00400 #ifdef debug
00401 G4cout<<"G4QCohChargEx::PostStepDoIt: SP["<<j<<"]="<<(*SPI)[j]<<", r="<<rndI<<G4endl;
00402 #endif
00403 if(rndI < (*SPI)[j]) break;
00404 }
00405 if(j>=nofIsot) j=nofIsot-1;
00406 }
00407 G4int N =(*IsN)[j]; ;
00408 #ifdef debug
00409 G4cout<<"G4QCohChargeEx::PostStepDoIt: j="<<i<<", N(isotope)="<<N<<", MeV="<<MeV<<G4endl;
00410 #endif
00411 if(N<0)
00412 {
00413 G4cerr<<"*Warning*G4QCohChEx::PostStepDoIt: Isotope with Z="<<Z<<", 0>N="<<N<<G4endl;
00414 return 0;
00415 }
00416 nOfNeutrons=N;
00417 #ifdef debug
00418 G4cout<<"G4QCohChargeExchange::PostStepDoIt: N="<<N<<" for element with Z="<<Z<<G4endl;
00419 #endif
00420 if(N<0)
00421 {
00422 G4cerr<<"*Warning*G4QCoherentChargeExchange::PostStepDoIt:Element with N="<<N<< G4endl;
00423 return 0;
00424 }
00425 aParticleChange.Initialize(track);
00426 #ifdef debug
00427 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt: track is initialized"<<G4endl;
00428 #endif
00429 G4double weight = track.GetWeight();
00430 G4double localtime = track.GetGlobalTime();
00431 G4ThreeVector position = track.GetPosition();
00432 #ifdef debug
00433 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt: before Touchable extraction"<<G4endl;
00434 #endif
00435 G4TouchableHandle trTouchable = track.GetTouchableHandle();
00436 #ifdef debug
00437 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt: Touchable is extracted"<<G4endl;
00438 #endif
00439
00440 G4int targPDG=90000000+Z*1000+N;
00441 if(projPDG==2212) targPDG+=999;
00442 else if(projPDG==2112) targPDG-=999;
00443 G4QPDGCode targQPDG(targPDG);
00444 G4double tM=targQPDG.GetMass();
00445 G4double kinEnergy= projHadron->GetKineticEnergy()*MeV;
00446 G4ParticleMomentum dir = projHadron->GetMomentumDirection();
00447 G4LorentzVector tot4M=proj4M+G4LorentzVector(0.,0.,0.,tM);
00448 #ifdef debug
00449 G4cout<<"G4QCohChrgEx::PostStepDoIt: tM="<<tM<<", p4M="<<proj4M<<", t4M="<<tot4M<<G4endl;
00450 #endif
00451 EnMomConservation=tot4M;
00452
00453 #ifdef debug
00454 G4cout<<"G4QCCX::PSDI:false, P="<<Momentum<<",Z="<<Z<<",N="<<N<<",PDG="<<projPDG<<G4endl;
00455 #endif
00456 G4double xSec=CalculateXSt(false, true, Momentum, Z, N, projPDG);
00457 #ifdef debug
00458 G4cout<<"G4QCoChEx::PSDI:PDG="<<projPDG<<",P="<<Momentum<<",CS="<<xSec/millibarn<<G4endl;
00459 #endif
00460 #ifdef nandebug
00461 if(xSec>0. || xSec<0. || xSec==0);
00462 else G4cout<<"*Warning*G4QCohChargeExchange::PSDI: xSec="<<xSec/millibarn<<G4endl;
00463 #endif
00464
00465 if(xSec <= 0.)
00466 {
00467 #ifdef pdebug
00468 G4cerr<<"*Warning*G4QCoherentChargeExchange::PSDoIt:*Zero cross-section* PDG="<<projPDG
00469 <<",tPDG="<<targPDG<<",P="<<Momentum<<G4endl;
00470 #endif
00471
00472 aParticleChange.ProposeEnergy(kinEnergy);
00473 aParticleChange.ProposeLocalEnergyDeposit(0.);
00474 aParticleChange.ProposeMomentumDirection(dir) ;
00475 return G4VDiscreteProcess::PostStepDoIt(track,step);
00476 }
00477 G4double mint=CalculateXSt(false, false, Momentum, Z, N, projPDG);
00478 #ifdef pdebug
00479 G4cout<<"G4QCohChEx::PoStDoIt:pPDG="<<projPDG<<",tPDG="<<targPDG<<",P="<<Momentum<<",CS="
00480 <<xSec<<",-t="<<mint<<G4endl;
00481 #endif
00482 #ifdef nandebug
00483 if(mint>-.0000001);
00484 else G4cout<<"*Warning*G4QCoherentChargeExchange::PostStDoIt:-t="<<mint<<G4endl;
00485 #endif
00486 G4double maxt=CalculateXSt(true, false, Momentum, Z, N, projPDG);
00487 if(maxt<=0.) maxt=1.e-27;
00488 G4double cost=1.-mint/maxt;
00489
00490 #ifdef ppdebug
00491 G4cout<<"G4QCoherentChargeExchange::PoStDoIt:t="<<mint<<",dpcm2="<<maxt
00492 <<",Ek="<<kinEnergy<<",tM="<<tM<<",pM="<<pM<<",cost="<<cost<<G4endl;
00493 #endif
00494 if(cost>1. || cost<-1. || !(cost>-1. || cost<1.))
00495 {
00496 if(cost>1.000001 || cost<-1.000001 || !(cost>-1. || cost<1.))
00497 {
00498 G4double tM2=tM*tM;
00499 G4double pEn=pM+kinEnergy;
00500 G4double sM=(tM+tM)*pEn+tM2+pM2;
00501 G4double twop2cm=(tM2+tM2)*(pEn*pEn-pM2)/sM;
00502 G4cout<<"*Warning*G4QCohChEx::PostStepDoIt:cos="<<cost<<",t="<<mint<<",T="<<kinEnergy
00503 <<",tM="<<tM<<",tmax="<<2*kinEnergy*tM<<",p="<<projPDG<<",t="<<targPDG<<G4endl;
00504 G4cout<<"..G4QCohChEx::PoStDoI: dpcm2="<<twop2cm<<"="<<maxt<<G4endl;
00505 }
00506 if (cost>1.) cost=1.;
00507 else if(cost<-1.) cost=-1.;
00508 }
00509 G4LorentzVector reco4M=G4LorentzVector(0.,0.,0.,tM);
00510 G4LorentzVector scat4M=G4LorentzVector(0.,0.,0.,pM);
00511 G4LorentzVector dir4M=tot4M-G4LorentzVector(0.,0.,0.,(tot4M.e()-tM-pM)*.01);
00512 if(!G4QHadron(tot4M).RelDecayIn2(scat4M, reco4M, dir4M, cost, cost))
00513 {
00514 G4cerr<<"G4QCohChEx::PSDI:t4M="<<tot4M<<",pM="<<pM<<",tM="<<tM<<",cost="<<cost<<G4endl;
00515
00516 }
00517 #ifdef debug
00518 G4cout<<"G4QCohChEx::PoStDoIt:s4M="<<scat4M<<"+r4M="<<reco4M<<"="<<scat4M+reco4M<<G4endl;
00519 G4cout<<"G4QCohChEx::PoStDoIt: scatE="<<scat4M.e()-pM<<", recoE="<<reco4M.e()-tM<<",d4M="
00520 <<tot4M-scat4M-reco4M<<G4endl;
00521 #endif
00522
00523 aParticleChange.ProposeTrackStatus(fStopAndKill);
00524
00525 G4DynamicParticle* theSec = new G4DynamicParticle;
00526 G4ParticleDefinition* theDefinition=G4Proton::Proton();
00527 if(projPDG==2212) theDefinition=G4Neutron::Neutron();
00528 theSec->SetDefinition(theDefinition);
00529 EnMomConservation-=scat4M;
00530 theSec->Set4Momentum(scat4M);
00531 G4Track* aNewTrack = new G4Track(theSec, localtime, position );
00532 aNewTrack->SetWeight(weight);
00533 aNewTrack->SetTouchableHandle(trTouchable);
00534 aParticleChange.AddSecondary( aNewTrack );
00535
00536 theSec = new G4DynamicParticle;
00537 G4int aA = Z+N;
00538 #ifdef pdebug
00539 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt: Ion Z="<<Z<<", A="<<aA<<G4endl;
00540 #endif
00541 theDefinition=G4ParticleTable::GetParticleTable()->FindIon(Z,aA,0,Z);
00542 if(!theDefinition)G4cout<<"*Warning*G4QCohChEx::PostStepDoIt:drop PDG="<<targPDG<<G4endl;
00543 #ifdef pdebug
00544 G4cout<<"G4QCohChEx::PostStepDoIt:RecoilName="<<theDefinition->GetParticleName()<<G4endl;
00545 #endif
00546 theSec->SetDefinition(theDefinition);
00547 EnMomConservation-=reco4M;
00548 #ifdef tdebug
00549 G4cout<<"G4QCohChEx::PostSDoIt:"<<targPDG<<reco4M<<reco4M.m()<<EnMomConservation<<G4endl;
00550 #endif
00551 theSec->Set4Momentum(reco4M);
00552 #ifdef debug
00553 G4ThreeVector curD=theSec->GetMomentumDirection();
00554 G4double curM=theSec->GetMass();
00555 G4double curE=theSec->GetKineticEnergy()+curM;
00556 G4cout<<"G4QCohChEx::PostStpDoIt:p="<<curD<<curD.mag()<<",e="<<curE<<",m="<<curM<<G4endl;
00557 #endif
00558
00559 aNewTrack = new G4Track(theSec, localtime, position );
00560 aNewTrack->SetWeight(weight);
00561 aNewTrack->SetTouchableHandle(trTouchable);
00562 aParticleChange.AddSecondary( aNewTrack );
00563 #ifdef debug
00564 G4cout<<"G4QCoherentChargeExchange::PostStepDoIt:*** PostStepDoIt is done ***"<<G4endl;
00565 #endif
00566 return G4VDiscreteProcess::PostStepDoIt(track, step);
00567 }
00568
00569 G4double G4QCoherentChargeExchange::CalculateXSt(G4bool oxs, G4bool xst, G4double p,
00570 G4int Z, G4int N, G4int pPDG)
00571 {
00572 static G4bool init=false;
00573 static G4bool first=true;
00574 static G4VQCrossSection* PCSmanager;
00575 static G4VQCrossSection* NCSmanager;
00576 G4QuasiFreeRatios* qfMan=G4QuasiFreeRatios::GetPointer();
00577 if(first)
00578 {
00579 PCSmanager=G4QProtonElasticCrossSection::GetPointer();
00580 NCSmanager=G4QNeutronElasticCrossSection::GetPointer();
00581 first=false;
00582 }
00583 G4double res=0.;
00584 if(oxs && xst)
00585 {
00586 if(pPDG==2212) res=PCSmanager->GetCrossSection(true, p, Z, N, pPDG);
00587 else res=NCSmanager->GetCrossSection(true, p, Z, N, pPDG);
00588 res*=qfMan->ChExElCoef(p*MeV, Z, N, pPDG);
00589 }
00590 else if(!oxs && xst)
00591 {
00592 if(pPDG==2212) res=PCSmanager->GetCrossSection(false, p, Z, N, pPDG);
00593 else res=NCSmanager->GetCrossSection(false, p, Z, N, pPDG);
00594 res*=qfMan->ChExElCoef(p*MeV, Z, N, pPDG);
00595
00596 init=true;
00597 }
00598 else if(init)
00599 {
00600 if(pPDG==2212)
00601 {
00602 if(oxs) res=PCSmanager->GetHMaxT();
00603 else res=PCSmanager->GetExchangeT(Z, N, pPDG);
00604 }
00605 else
00606 {
00607 if(oxs) res=NCSmanager->GetHMaxT();
00608 else res=NCSmanager->GetExchangeT(Z, N, pPDG);
00609 }
00610 }
00611 else G4cout<<"*Warning*G4QCohChrgExchange::CalculateXSt: NotInitiatedScattering"<<G4endl;
00612 return res;
00613 }