Import Geant4 10.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2016-06-30 14:12:05 +02:00
parent a654a7ab1f
commit 4ec577e5c4
2021 changed files with 100995 additions and 78277 deletions
@@ -40,17 +40,19 @@
G4VSplitableHadron* G4GammaParticipants::SelectInteractions(const G4ReactionProduct &thePrimary)
{
// Check reaction threshold - goes to CheckThreshold
G4VSplitableHadron* aProjectile = new G4QGSMSplitableHadron(thePrimary, TRUE); // @@@ check the TRUE
const std::vector<G4Nucleon>& theTargetNuc = theNucleus->GetNucleons();
theProjectileSplitable = new G4QGSMSplitableHadron(thePrimary, TRUE); // @@@ check the TRUE
theProjectileSplitable->SetStatus(1); // Uzhi 21.05.2015
G4LorentzVector aPrimaryMomentum(thePrimary.GetMomentum(), thePrimary.GetTotalEnergy());
G4LorentzVector aTargetNMomentum(0.,0.,0.,938.);
if((!(aPrimaryMomentum.e()>-1)) && (!(aPrimaryMomentum.e()<1)) )
{
throw G4HadronicException(__FILE__, __LINE__,
"G4GammaParticipants::SelectInteractions: primary nan energy.");
}
G4double S = (aPrimaryMomentum + theTargetNuc[0].Get4Momentum()).mag2();
G4double ThresholdMass = thePrimary.GetMass() + theTargetNuc[0].GetDefinition()->GetPDGMass();
G4double S = (aPrimaryMomentum + aTargetNMomentum).mag2();
G4double ThresholdMass = thePrimary.GetMass() + 938.;
ModelMode = SOFT;
if (sqr(ThresholdMass + ThresholdParameter) > S)
{
@@ -69,16 +71,26 @@ G4VSplitableHadron* G4GammaParticipants::SelectInteractions(const G4ReactionProd
#ifdef debug_G4GammaParticipants
G4double eK = thePrimary.GetKineticEnergy()/GeV;
G4int nucleonCount = theTargetNuc.size(); // debug
G4int nucleonCount = theNucleus->GetMassNumber();
#endif
G4int theCurrent = static_cast<G4int> (theTargetNuc.size()*G4UniformRand());
const G4Nucleon& pNucleon = theTargetNuc[theCurrent];
G4QGSMSplitableHadron* aTarget = new G4QGSMSplitableHadron(pNucleon);
theTargets.push_back(aTarget);
const_cast<G4Nucleon&>(pNucleon).Hit(aTarget);
if ( (0.06 > G4UniformRand() &&(ModelMode==SOFT)) || (ModelMode==DIFFRACTIVE ) )
{
G4int theCurrent = G4int(theNucleus->GetMassNumber()*G4UniformRand());
G4int NucleonNo=0;
theNucleus->StartLoop();
G4Nucleon * pNucleon =0; // theNucleus->GetNextNucleon(); // Uzhi 27.05.2015
while( (pNucleon = theNucleus->GetNextNucleon()) ) /* Loop checking, 07.08.2015, A.Ribon */
{if(NucleonNo == theCurrent) break; NucleonNo++;}
if ( pNucleon ) {
G4QGSMSplitableHadron* aTarget = new G4QGSMSplitableHadron(*pNucleon);
pNucleon->Hit(aTarget);
if ( (0.06 > G4UniformRand() &&(ModelMode==SOFT)) || (ModelMode==DIFFRACTIVE ) )
{
/*
// diffractive interaction occurs
if(IsSingleDiffractive())
{
@@ -88,22 +100,41 @@ G4VSplitableHadron* G4GammaParticipants::SelectInteractions(const G4ReactionProd
{
theDiffExcitaton.ExciteParticipants(aProjectile, aTarget);
}
G4InteractionContent * aInteraction = new G4InteractionContent(aProjectile);
aInteraction->SetTarget(aTarget);
theInteractions.push_back(aInteraction);
aInteraction->SetNumberOfDiffractiveCollisions(1);
*/
G4InteractionContent * aInteraction = new G4InteractionContent(theProjectileSplitable);
theProjectileSplitable->SetStatus(1*theProjectileSplitable->GetStatus());
aInteraction->SetTarget(aTarget);
aInteraction->SetTargetNucleon(pNucleon);
aTarget->SetCollisionCount(0);
aTarget->SetStatus(1);
aInteraction->SetNumberOfDiffractiveCollisions(1);
aInteraction->SetNumberOfSoftCollisions(0);
aInteraction->SetStatus(1);
theInteractions.push_back(aInteraction);
totalCuts += 1;
}
else
{
}
else
{
// nondiffractive soft interaction occurs
aTarget->IncrementCollisionCount(1);
aProjectile->IncrementCollisionCount(1);
G4InteractionContent * aInteraction = new G4InteractionContent(aProjectile);
aTarget->SetStatus(0);
theTargets.push_back(aTarget);
theProjectileSplitable->IncrementCollisionCount(1);
theProjectileSplitable->SetStatus(0*theProjectileSplitable->GetStatus());
G4InteractionContent * aInteraction =
new G4InteractionContent(theProjectileSplitable);
aInteraction->SetTarget(aTarget);
aInteraction->SetTargetNucleon(pNucleon);
aInteraction->SetNumberOfSoftCollisions(1);
aInteraction->SetStatus(0);
theInteractions.push_back(aInteraction);
totalCuts += 1;
}
return aProjectile;
}
}
return theProjectileSplitable; //aProjectile;
}
@@ -0,0 +1,321 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4PomeronCrossSection.cc 96952 2016-05-18 12:21:34Z gcosmo $
//
#include "G4PomeronCrossSection.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Pow.hh"
#include "G4Exp.hh"
#include "G4Log.hh"
G4PomeronCrossSection::G4PomeronCrossSection() :
pomeron_Alpha(0), pomeron_Alpha_Hard(0), pomeron_Alphaprime(0),
pomeron_C(0), pomeron_Gamma(0), pomeron_Gamma_Hard(0),
pomeron_Rsquare(0), pomeron_S(0)
{}
G4PomeronCrossSection::~G4PomeronCrossSection()
{;}
//**********************************************************************************************
G4PomeronCrossSection::G4PomeronCrossSection(const G4ParticleDefinition * particle)
{
G4int Encoding = std::abs(particle->GetPDGEncoding());
if (std::abs(particle->GetBaryonNumber())!=0)
InitForNucleon();
else if (Encoding/100== 3 || Encoding/10 == 3)
InitForKaon();
else
InitForPion();
}
//**********************************************************************************************
G4PomeronCrossSection::G4PomeronCrossSection(const G4Proton * )
{
InitForNucleon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4Neutron * )
{
InitForNucleon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionPlus * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionMinus * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4PionZero * )
{
InitForPion();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonPlus * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonMinus * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZero * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZeroLong * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4KaonZeroShort * )
{
InitForKaon();
}
G4PomeronCrossSection::G4PomeronCrossSection(const G4Gamma * )
{
InitForGamma();
}
G4double G4PomeronCrossSection::GetTotalCrossSection(const G4double S)
{
G4double FZ2= Expand(Z(S)/2);
return SigP(S) * FZ2;
}
G4double G4PomeronCrossSection::GetElasticCrossSection(const G4double S)
{
return SigP(S)/pomeron_C *(Expand(Z(S)/2) - Expand(Z(S)));
}
G4double G4PomeronCrossSection::GetDiffractiveCrossSection(const G4double S)
{
return ( pomeron_C -1) * GetElasticCrossSection(S);
}
G4double G4PomeronCrossSection::GetInelasticCrossSection(const G4double S)
{
return GetTotalCrossSection(S) - GetElasticCrossSection(S);
}
//-------------------------Probabilities ----------------------------
G4double G4PomeronCrossSection::GetTotalProbability(const G4double S,
const G4double impactsquare)
{
return 2/pomeron_C*(1-G4Exp(-1*Eikonal(S,impactsquare)));
}
G4double G4PomeronCrossSection::GetDiffractiveProbability(const G4double S,
const G4double impactsquare)
{
return (pomeron_C-1)/pomeron_C *
(GetTotalProbability(S,impactsquare) -
GetNondiffractiveProbability(S,impactsquare));
}
G4double G4PomeronCrossSection::GetNondiffractiveProbability(const G4double S,
const G4double impactsquare)
{
return (1-G4Exp(-2*Eikonal(S,impactsquare)))/pomeron_C;
}
G4double G4PomeronCrossSection::GetElasticProbability(const G4double S,
const G4double impactsquare)
{
return (GetTotalProbability(S,impactsquare) -
GetInelasticProbability(S,impactsquare));
}
G4double G4PomeronCrossSection::GetInelasticProbability(const G4double S,
const G4double impactsquare)
{
return GetNondiffractiveProbability(S,impactsquare) +
GetDiffractiveProbability(S,impactsquare);
}
G4double G4PomeronCrossSection::GetCutPomeronProbability(const G4double S,
const G4double impactsquare, const G4int nPomerons)
{
G4double factorial=G4Pow::GetInstance()->factorial(nPomerons);
return G4Exp(-2*Eikonal(S,impactsquare))/pomeron_C*
G4Pow::GetInstance()->powN(2*Eikonal(S,impactsquare),nPomerons)/factorial;
}
// ---------------Temporary --- GF
void G4PomeronCrossSection::Setgamma(const G4double agam)
{
pomeron_Gamma=agam/GeV/GeV;
}
//----------------- private/Implementation methods
void G4PomeronCrossSection::InitForNucleon()
{
// pomeron_S= 3.0*GeV*GeV;
pomeron_S= 2.7*GeV*GeV;
// pomeron_Gamma= 2.16/GeV/GeV;
// pomeron_Gamma= 3.96/GeV/GeV;
pomeron_Gamma= (2.6+3.96)/GeV/GeV;
pomeron_C= 1.4;
pomeron_Rsquare= 3.56/GeV/GeV;
// pomeron_Alpha= 1.0808;
pomeron_Alpha= 0.9808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV; // Note! if pomeron_Gamma_Hard != 0 to fit total pp-crosscection
// pomeron_Gamma_Soft shold be 2.35/GeV/GeV
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForPion()
{
pomeron_S= 1.5*GeV*GeV;
// pomeron_Gamma= 1.46/GeV/GeV;
pomeron_Gamma= 2.17/GeV/GeV;
pomeron_C= 1.6;
pomeron_Rsquare= 2.36/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForKaon()
{
pomeron_S= 2.3*GeV*GeV;
// pomeron_Gamma= 1.31/GeV/GeV;
pomeron_Gamma= 1.92/GeV/GeV;
pomeron_C= 1.8;
pomeron_Rsquare= 1.96/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
void G4PomeronCrossSection::InitForGamma()
{
pomeron_S= 1.7*GeV*GeV;
// pomeron_Gamma= 1.42/GeV/GeV;
pomeron_Gamma= 2.07/GeV/GeV;
pomeron_C= 1.7;
pomeron_Rsquare= 2.16/GeV/GeV;
pomeron_Alpha= 1.0808;
pomeron_Alphaprime= 0.25/GeV/GeV;
pomeron_Gamma_Hard = 0.0002/GeV/GeV;
pomeron_Alpha_Hard = 1.47;
}
G4double G4PomeronCrossSection::Expand(G4double z)
{
G4double sum=1.;
G4double current=1.;
for (G4int j=2; j<21; j++ )
{
current *= -z *(j-1)/sqr(j);
sum+=current;
}
return sum;
}
G4double G4PomeronCrossSection::Power(const G4double S)
{
return pomeron_Gamma * G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha -1);
}
G4double G4PomeronCrossSection::Z(const G4double S)
{
return 2*pomeron_C * Power(S) / Lambda(S);
}
G4double G4PomeronCrossSection::Lambda(const G4double S)
{
return pomeron_Rsquare+pomeron_Alphaprime*G4Log(S/pomeron_S);
}
G4double G4PomeronCrossSection::SigP(const G4double S)
{
return 8 * pi * hbarc_squared * Power(S);
}
G4double G4PomeronCrossSection::Eikonal(const G4double S,
const G4double impactsquare)
{
return Z(S)/2 * G4Exp(-impactsquare/(4*Lambda(S)*hbarc_squared));
}
//*************************************************************************************************
G4double G4PomeronCrossSection::PowerSoft(const G4double S)
{
return pomeron_Gamma * G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha -1);
}
G4double G4PomeronCrossSection::PowerHard(const G4double S)
{
return pomeron_Gamma_Hard*G4Pow::GetInstance()->powA(S/pomeron_S, pomeron_Alpha_Hard -1);
}
G4double G4PomeronCrossSection::LambdaSoft(const G4double S)
{
return pomeron_Rsquare+pomeron_Alphaprime*G4Log(S/pomeron_S);
}
G4double G4PomeronCrossSection::LambdaHard(const G4double /*S*/)
{
return pomeron_Rsquare; //+pomeron_Alphaprime*G4Log(s/pomeron_S);
}
G4double G4PomeronCrossSection::Zsoft(const G4double S)
{
return 2*pomeron_C*PowerHard(S) / LambdaSoft(S);
}
G4double G4PomeronCrossSection::Zhard(const G4double S)
{
return 2*pomeron_C*PowerHard(S)/LambdaHard(S);
}
G4double G4PomeronCrossSection::SoftEikonal(G4double S, G4double impactsquare)
{
return Zsoft(S)/2*G4Exp(-impactsquare/LambdaSoft(S)/hbarc_squared/4);
}
G4double G4PomeronCrossSection::HardEikonal(G4double S, G4double impactsquare)
{
return Zhard(S)/2*G4Exp(-impactsquare/LambdaHard(S)/hbarc_squared/4);
}
//*************************************************************************************************
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4QGSDiffractiveExcitation.cc 93563 2015-10-26 14:46:09Z gcosmo $
// $Id: G4QGSDiffractiveExcitation.cc 94750 2015-12-07 08:24:29Z gcosmo $
// ------------------------------------------------------------
// GEANT 4 class implemetation file
//
@@ -60,8 +60,13 @@
#include "G4Log.hh"
#include "G4Pow.hh"
//============================================================================
G4QGSDiffractiveExcitation::G4QGSDiffractiveExcitation() // Uzhi
//#define debugQGSdiffExictation
//============================================================================
G4QGSDiffractiveExcitation::G4QGSDiffractiveExcitation()
{
}
@@ -73,6 +78,8 @@ G4QGSDiffractiveExcitation::~G4QGSDiffractiveExcitation()
G4bool G4QGSDiffractiveExcitation::
ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) const
{
G4cout<<"G4QGSDiffractiveExcitation::ExciteParticipants"<<G4endl;
G4cout<<"Proj Targ "<<projectile->GetDefinition()->GetPDGEncoding()<<" "<<target->GetDefinition()->GetPDGEncoding()<<G4endl;
G4LorentzVector Pprojectile=projectile->Get4Momentum();
@@ -122,6 +129,9 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
// -------------------- Target parameters ----------------------------------------------
G4LorentzVector Ptarget=target->Get4Momentum();
//G4cout<<"Pr Tr 4-Mom "<<Pprojectile<<" "<<Pprojectile.mag()<<G4endl
// <<" "<<Ptarget <<" "<<Ptarget.mag() <<G4endl;
G4double M0target = Ptarget.mag();
if(M0target < target->GetDefinition()->GetPDGMass())
@@ -217,11 +227,8 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
G4LorentzVector Qmomentum;
G4double Qminus, Qplus;
// /* Vova
G4int whilecount=0;
do {
// Generate pt
if (whilecount++ >= 500 && (whilecount%100)==0)
// G4cout << "G4QGSDiffractiveExcitation::ExciteParticipants possibly looping"
// << ", loop count/ maxPtSquare : "
@@ -232,27 +239,9 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
return false; // Ignore this interaction
}
// Generate pt
Qmomentum=G4LorentzVector(GaussianPt(AveragePt2,maxPtSquare),0);
//G4cout << "generated Pt " << Qmomentum << G4endl;
//G4cout << "Pprojectile with pt : " << Pprojectile+Qmomentum << G4endl;
//G4cout << "Ptarget with pt : " << Ptarget-Qmomentum << G4endl;
// Momentum transfer
/* // Uzhi
G4double Xmin = minmass / ( Pprojectile.e() + Ptarget.e() );
G4double Xmax=1.;
G4double Xplus =ChooseX(Xmin,Xmax);
G4double Xminus=ChooseX(Xmin,Xmax);
// G4cout << " X-plus " << Xplus << G4endl;
// G4cout << " X-minus " << Xminus << G4endl;
G4double pt2=G4ThreeVector(Qmomentum.vect()).mag2();
G4double Qplus =-1 * pt2 / Xminus/Ptarget.minus();
G4double Qminus= pt2 / Xplus /Pprojectile.plus();
*/ // Uzhi *
Pt2=G4ThreeVector(Qmomentum.vect()).mag2();
ProjMassT2=Mprojectile2+Pt2;
ProjMassT =std::sqrt(ProjMassT2);
@@ -293,12 +282,13 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
*/ // Uzhi *
} while ( /* Loop checking, 26.10.2015, A.Ribon */
( (Pprojectile+Qmomentum).mag2() < Mprojectile2 || // Uzhi No without excitation
(Ptarget -Qmomentum).mag2() < Mtarget2 ) || // Uzhi
( (Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2 && // Uzhi No double Diffraction
(Ptarget -Qmomentum).mag2() < NuclearNucleonDiffCut2) );// Uzhi
} while (( (Pprojectile+Qmomentum).mag2() < Mprojectile2 || // Uzhi No without excitation
(Ptarget -Qmomentum).mag2() < Mtarget2 ) || // Uzhi
( (Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2 && // Uzhi No double Diffraction
(Ptarget -Qmomentum).mag2() < NuclearNucleonDiffCut2) ); /* Loop checking, 07.08.2015, A.Ribon */
//G4cout<<"(Ptarget-Qmomentum).mag2() < NuclearNucleonDiffCut2 "<<(Ptarget-Qmomentum).mag2() <<" "<<NuclearNucleonDiffCut2<<G4endl;
//G4cout<<"(Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2 "<<(Pprojectile+Qmomentum).mag2()<<" "<< ProjectileDiffCut2<<G4endl;
if((Ptarget-Qmomentum).mag2() < NuclearNucleonDiffCut2) // Uzhi Projectile diffraction
{
G4double TMinusNew=SqrtS-PMinusNew;
@@ -323,37 +313,17 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
Pprojectile += Qmomentum;
Ptarget -= Qmomentum;
// Vova
/*
Pprojectile.setPz(0.);
Pprojectile.setE(SqrtS-M0target);
Ptarget.setPz(0.);
Ptarget.setE(M0target);
*/
//G4cout << "Pprojectile with Q : " << Pprojectile << G4endl;
//G4cout << "Ptarget with Q : " << Ptarget << G4endl;
// G4cout << "Projectile back: " << toLab * Pprojectile << G4endl;
// G4cout << "Target back: " << toLab * Ptarget << G4endl;
// Transform back and update SplitableHadron Participant.
Pprojectile.transform(toLab);
Ptarget.transform(toLab);
//G4cout << "Pprojectile with Q M: " << Pprojectile<<" "<< Pprojectile.mag() << G4endl;
//G4cout << "Ptarget with Q M: " << Ptarget <<" "<< Ptarget.mag() << G4endl;
//G4cout << "Target mass " << Ptarget.mag() << G4endl;
//G4cout << "Pprojectile with Q and Mass: " << Pprojectile<<" "<< Pprojectile.mag() << G4endl;
//G4cout << "Ptarget with Q and Mass: " << Ptarget <<" "<< Ptarget.mag() << G4endl;
target->Set4Momentum(Ptarget);
//G4cout << "Projectile mass " << Pprojectile.mag() << G4endl;
projectile->Set4Momentum(Pprojectile);
//G4int Uzhi; G4cin>>Uzhi;
return true;
}
@@ -364,12 +334,12 @@ String(G4VSplitableHadron * hadron, G4bool isProjectile) const
hadron->SplitUp();
G4Parton *start= hadron->GetNextParton();
if ( start==NULL)
{ G4cout << " G4FTFModel::String() Error:No start parton found"<< G4endl;
{ G4cout << " G4QGSDiffractiveExcitation::String() Error:No start parton found"<< G4endl;
return NULL;
}
G4Parton *end = hadron->GetNextParton();
if ( end==NULL)
{ G4cout << " G4FTFModel::String() Error:No end parton found"<< G4endl;
{ G4cout << " G4QGSDiffractiveExcitation::String() Error:No end parton found"<< G4endl;
return NULL;
}
@@ -424,10 +394,10 @@ String(G4VSplitableHadron * hadron, G4bool isProjectile) const
start->Set4Momentum(Pstart);
end->Set4Momentum(Pend);
#ifdef G4_FTFDEBUG
G4cout << " generated string flavors " << start->GetPDGcode() << " / " << end->GetPDGcode() << G4endl;
#ifdef debugQGSdiffExictation
G4cout << " generated string flavors " << start->GetPDGcode() << " / " << end->GetPDGcode() << G4endl;
G4cout << " generated string momenta: quark " << start->Get4Momentum() << "mass : " <<start->Get4Momentum().mag()<< G4endl;
G4cout << " generated string momenta: Diquark " << end ->Get4Momentum() << "mass : " <<end->Get4Momentum().mag()<< G4endl;
G4cout << " generated string momenta: Diquark " << end ->Get4Momentum() << "mass : " <<end->Get4Momentum().mag()<< G4endl;
G4cout << " sum of ends " << Pstart+Pend << G4endl;
G4cout << " Original " << hadron->Get4Momentum() << G4endl;
#endif
@@ -438,13 +408,12 @@ String(G4VSplitableHadron * hadron, G4bool isProjectile) const
// --------- private methods ----------------------
G4double G4QGSDiffractiveExcitation::ChooseP(G4double Pmin, G4double Pmax) const // Uzhi
G4double G4QGSDiffractiveExcitation::ChooseP(G4double Pmin, G4double Pmax) const
{
// choose an x between Xmin and Xmax with P(x) ~ 1/x
// to be improved...
G4double range=Pmax-Pmin; // Uzhi
G4double range=Pmax-Pmin;
if ( Pmin <= 0. || range <=0. )
{
@@ -453,29 +422,17 @@ G4double G4QGSDiffractiveExcitation::ChooseP(G4double Pmin, G4double Pmax) const
}
G4double P;
/* // Uzhi
do {
x=Xmin + G4UniformRand() * range;
} while ( Xmin/x < G4UniformRand() );
*/ // Uzhi
P=Pmin * G4Pow::GetInstance()->powA(Pmax/Pmin,G4UniformRand()); // Uzhi
P=Pmin * G4Pow::GetInstance()->powA(Pmax/Pmin,G4UniformRand());
//debug-hpw cout << "DiffractiveX "<<x<<G4endl;
return P;
}
G4ThreeVector G4QGSDiffractiveExcitation::GaussianPt(G4double AveragePt2, G4double maxPtSquare) const // Uzhi
G4ThreeVector G4QGSDiffractiveExcitation::GaussianPt(G4double AveragePt2, G4double maxPtSquare) const
{ // @@ this method is used in FTFModel as well. Should go somewhere common!
G4double Pt2;
/* // Uzhi
do {
pt2=widthSquare * G4Log( G4UniformRand() );
} while ( pt2 > maxPtSquare);
*/ // Uzhi
Pt2 = -AveragePt2 * G4Log(1. + G4UniformRand() * (G4Exp(-maxPtSquare/AveragePt2)-1.));// Uzhi
Pt2 = -AveragePt2 * G4Log(1. + G4UniformRand() * (G4Exp(-maxPtSquare/AveragePt2)-1.));
G4double Pt=std::sqrt(Pt2);
@@ -37,7 +37,6 @@
#include "G4Log.hh"
#include "G4Pow.hh"
// based on prototype by Maxim Komogorov
// Splitting into methods, and centralizing of model parameters HPW Feb 1999
// restructuring HPW Feb 1999
@@ -71,6 +70,8 @@ void G4QGSMSplitableHadron::InitParameters()
widthOfPtSquare = 0.01*GeV*GeV;
Direction = FALSE;
minTransverseMass = 1*keV;
iP =0;// Color.begin(); // Uzhi
iAP =0;// AntiColor.begin(); // Uzhi
}
G4QGSMSplitableHadron::G4QGSMSplitableHadron()
@@ -105,7 +106,22 @@ G4QGSMSplitableHadron::G4QGSMSplitableHadron(const G4Nucleon & aNucleon, G4bool
Direction = aDirection;
}
G4QGSMSplitableHadron::~G4QGSMSplitableHadron(){}
G4QGSMSplitableHadron::~G4QGSMSplitableHadron()
{
/*
G4cout<<"Destructor "<<Color.size()<<" "<<AntiColor.size()<<G4endl;
for(unsigned int i=0; i<Color.size();i++) {
G4cout<<"i "<<i<<G4endl;
delete Color.operator[](i);
delete AntiColor.operator[](i);
}
G4cout<<"empty"<<G4endl;
while(!Color.empty()) {Color.pop_back();}
while(!AntiColor.empty()) {AntiColor.pop_back();}
G4cout<<"clear"<<G4endl;
Color.clear(); AntiColor.clear();
*/
}
@@ -113,10 +129,13 @@ G4QGSMSplitableHadron::~G4QGSMSplitableHadron(){}
void G4QGSMSplitableHadron::SplitUp()
{
//G4cout<<G4endl<<"SplitUp() this "<<this<<" IsSplit() "<<IsSplit()<<G4endl;
if (IsSplit()) return;
Splitting();
Splitting(); // Uzhi To mark that a hadron is split
//G4cout<<"Color.size() "<<Color.size()<<G4endl;
if (Color.size()!=0) return;
if (GetSoftCollisionCount() == 0)
//G4cout<<"GetSoftCollisionCount() "<<GetSoftCollisionCount()<<G4endl;
if (GetSoftCollisionCount() == 0) // GetSoftCollisionCount() from G4VSplitableHadron
{
DiffractiveSplitUp();
}
@@ -124,10 +143,14 @@ void G4QGSMSplitableHadron::SplitUp()
{
SoftSplitUp();
}
//G4cout<<"Color.size() "<<Color.size()<<G4endl;
}
void G4QGSMSplitableHadron::DiffractiveSplitUp()
{
//G4cout<<G4endl<<"G4QGSMSplitableHadron::DiffractiveSplitUp() "<<GetDefinition()->GetParticleName()<<G4endl;
//G4cout<<" GetSoftCollisionCount() "<<GetSoftCollisionCount()<<G4endl;
//G4cout<<"Mom M "<<Get4Momentum()<<" "<<Get4Momentum().mag()<<G4endl;
// take the particle definitions and get the partons HPW
G4Parton * Left = NULL;
G4Parton * Right = NULL;
@@ -135,14 +158,25 @@ void G4QGSMSplitableHadron::DiffractiveSplitUp()
Left->SetPosition(GetPosition());
Right->SetPosition(GetPosition());
//G4cout<<"Partons Left Right "<<Left->GetDefinition()->GetParticleName()<<" "<<Right->GetDefinition()->GetParticleName()<<G4endl;
/*
G4LorentzVector tmp(0., 0., 0., 0.);
Left->Set4Momentum(tmp);
Right->Set4Momentum(tmp);
Color.push_back(Left);
AntiColor.push_back(Right);
*/ // Uzhi
G4LorentzVector HadronMom = Get4Momentum();
//std::cout << "DSU 1 - "<<HadronMom<<std::endl;
// momenta of string ends
G4double pt2 = HadronMom.perp2();
G4double transverseMass2 = HadronMom.plus()*HadronMom.minus();
G4double maxAvailMomentum2 = sqr(std::sqrt(transverseMass2) - std::sqrt(pt2));
// G4double pt2 = HadronMom.perp2();
// G4double transverseMass2 = HadronMom.plus()*HadronMom.minus();
// G4double maxAvailMomentum2 = sqr(std::sqrt(transverseMass2) - std::sqrt(pt2)); // It is wrong! Uzhi
G4double maxAvailMomentum2 = sqr(HadronMom.mag()/2.); // Uzhi
//G4cout<<"Hadron M M estimated Pt "<<HadronMom.mag()<<" "<<std::sqrt(transverseMass2) - std::sqrt(pt2)<<" "<<std::sqrt(pt2)<<G4endl;
G4ThreeVector pt(minTransverseMass, minTransverseMass, 0);
//G4cout<<"maxAvailMomentum2 widthOfPtSquare "<<maxAvailMomentum2<<" "<<widthOfPtSquare<<G4endl;
if(maxAvailMomentum2/widthOfPtSquare>0.01) pt = GaussianPt(widthOfPtSquare, maxAvailMomentum2);
//std::cout << "DSU 1.1 - "<< maxAvailMomentum2<< pt <<std::endl;
@@ -158,6 +192,10 @@ void G4QGSMSplitableHadron::DiffractiveSplitUp()
if (Direction) Local2 = -Local2;
G4double RightMinus = 0.5*(Local1 + Local2);
G4double LeftMinus = HadronMom.minus() - RightMinus;
if (LeftMinus <= 0.0) { // Uzhi-14Apr2016
RightMinus = 0.5*(Local1 - Local2);
LeftMinus = HadronMom.minus() - RightMinus;
}
//std::cout << "DSU 4 - "<< RightMinus <<" "<< LeftMinus << " "<<HadronMom.minus() <<std::endl;
G4double LeftPlus = LeftMom.perp2()/LeftMinus;
@@ -170,26 +208,77 @@ void G4QGSMSplitableHadron::DiffractiveSplitUp()
//std::cout << "DSU 6 - "<< LeftMom <<" "<< RightMom <<std::endl;
Left->Set4Momentum(LeftMom);
Right->Set4Momentum(RightMom);
//G4cout<<"Momenta H q AntiQ"<<G4endl;
//G4cout<<Get4Momentum()<<G4endl<<Left->Get4Momentum()<<G4endl<<Right->Get4Momentum()<<G4endl;
//G4cout<<"Color AntiColor "<<Left<<" "<<Right<<G4endl;
Color.push_back(Left);
AntiColor.push_back(Right);
iP=0; iAP=0; // Vova
// Uzhi
}
void G4QGSMSplitableHadron::SoftSplitUp()
{
//G4cout<<"G4QGSMSplitableHadron::SoftSplitUp()"<<G4endl;
//G4cout<<" GetSoftCollisionCount() "<<GetSoftCollisionCount()<<G4endl;
//... sample transversal momenta for sea and valence quarks
/* Uzhi
G4double phi, pts;
G4double SumPy = 0.;
G4double SumPx = 0.;
G4ThreeVector Pos = GetPosition();
*/ // Uzhi
G4int nSeaPair = GetSoftCollisionCount()-1;
G4LorentzVector tmp(0., 0., 0., 0.);
G4int aSeaPair;
for (aSeaPair = 0; aSeaPair < nSeaPair; aSeaPair++)
{
// choose quark flavour, d:u:s = 1:1:(1/StrangeSuppress-2)
G4int aPDGCode = 1 + (G4int)(G4UniformRand()/StrangeSuppress);
// BuildSeaQuark() determines quark spin, isospin and colour
// via parton-constructor G4Parton(aPDGCode)
G4Parton * aParton = BuildSeaQuark(false, aPDGCode, nSeaPair);
G4int firstPartonColour = aParton->GetColour();
G4double firstPartonSpinZ = aParton->GetSpinZ();
aParton->Set4Momentum(tmp);
Color.push_back(aParton);
// create anti-quark
aParton = BuildSeaQuark(true, aPDGCode, nSeaPair);
aParton->SetSpinZ(-firstPartonSpinZ);
aParton->SetColour(-firstPartonColour);
AntiColor.push_back(aParton);
}
// Valence quark
G4Parton* pColorParton = NULL;
G4Parton* pAntiColorParton = NULL;
GetValenceQuarkFlavors(GetDefinition(), pColorParton, pAntiColorParton);
// G4int ColorEncoding = pColorParton->GetPDGcode();
pColorParton->Set4Momentum(tmp);
pAntiColorParton->Set4Momentum(tmp);
//G4cout<<"Color AntiColor "<<pColorParton<<" "<<pAntiColorParton<<G4endl;
Color.push_back(pColorParton);
AntiColor.push_back(pAntiColorParton);
iP=0; iAP=0; // Vova
/* Uzhi
// here the condition,to ensure viability of splitting, also in cases
// where difractive excitation occured together with soft scattering.
// G4double LightConeMomentum = (Direction)? Get4Momentum().plus() : Get4Momentum().minus();
// G4double Xmin = theMinPz/LightConeMomentum;
G4double Xmin = theMinPz/( Get4Momentum().e() - GetDefinition()->GetPDGMass() );
while(Xmin>=1-(2*nSeaPair+1)*Xmin) Xmin*=0.95; /* Loop checking, 26.10.2015, A.Ribon */
while(Xmin>=1-(2*nSeaPair+1)*Xmin) Xmin*=0.95;
G4int aSeaPair;
for (aSeaPair = 0; aSeaPair < nSeaPair; aSeaPair++)
@@ -239,6 +328,8 @@ void G4QGSMSplitableHadron::SoftSplitUp()
SumPy += aParton->Get4Momentum().py();
AntiColor.push_back(aParton);
}
*/ // Uzhi
/* Uzhi
// Valence quark
G4Parton* pColorParton = NULL;
G4Parton* pAntiColorParton = NULL;
@@ -280,7 +371,6 @@ void G4QGSMSplitableHadron::SoftSplitUp()
if (GetDefinition() == G4PionZero::PionZeroDefinition()) aBeta = 1.;
if (GetDefinition() == G4KaonPlus::KaonPlusDefinition()) aBeta = 0.;
if (GetDefinition() == G4KaonMinus::KaonMinusDefinition()) aBeta = 0.;
const G4int maxNumberOfAttempts = 1000;
do
{
SumX = 0;
@@ -301,8 +391,7 @@ void G4QGSMSplitableHadron::SoftSplitUp()
if (1. - SumX <= Xmin) break;
}
}
while ( (1. - SumX <= Xmin) && nAttempt < maxNumberOfAttempts ); /* Loop checking, 26.10.2015, A.Ribon */
if ( nAttempt >= maxNumberOfAttempts ) return;
while (1. - SumX <= Xmin);
(*(AntiColor.end()-1))->SetX(1. - SumX); // the di-quark takes the rest, then go to momentum
G4double lightCone = ((!Direction) ? Get4Momentum().minus() : Get4Momentum().plus());
@@ -315,6 +404,7 @@ void G4QGSMSplitableHadron::SoftSplitUp()
aParton = AntiColor[aSeaPair];
aParton->DefineMomentumInZ(lightCone, lightCone2, Direction);
}
*/ // Uzhi
return;
}
@@ -386,9 +476,11 @@ G4ThreeVector G4QGSMSplitableHadron::GaussianPt(G4double widthSquare, G4double m
G4double R;
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = -1;
while ( ((R = -widthSquare*G4Log(G4UniformRand())) > maxPtSquare) && /* Loop checking, 26.10.2015, A.Ribon */
++loopCounter < maxNumberOfLoops ) {;}
if ( loopCounter >= maxNumberOfLoops ) R = 0.0;
while( ((R = -widthSquare*G4Log(G4UniformRand())) > maxPtSquare) &&
++loopCounter < maxNumberOfLoops ) {;} /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
R = 0.99*maxPtSquare; // Just an acceptable value, without any physics consideration.
}
R = std::sqrt(R);
G4double phi = twopi*G4UniformRand();
return G4ThreeVector (R*std::cos(phi), R*std::sin(phi), 0.);
@@ -415,32 +507,34 @@ SampleX(G4double anXmin, G4int nSea, G4int totalSea, G4double aBeta)
for(G4int ii=1; ii<100; ii++)
{
G4double y = G4Pow::GetInstance()->powA(1./G4double(ii), alpha);
y *= G4Pow::GetInstance()->powN( G4Pow::GetInstance()->powA(1-anXmin-totalSea*anXmin, alpha+1) - G4Pow::GetInstance()->powA(anXmin, alpha+1), nSea);
y *= G4Pow::GetInstance()->powA(1-anXmin-totalSea*anXmin, aBeta+1) - G4Pow::GetInstance()->powA(anXmin, aBeta+1);
y *= G4Pow::GetInstance()->powN( G4Pow::GetInstance()->powA(1-anXmin-totalSea*anXmin, alpha+1) -
G4Pow::GetInstance()->powA(anXmin, alpha+1), nSea);
y *= G4Pow::GetInstance()->powA(1-anXmin-totalSea*anXmin, aBeta+1) -
G4Pow::GetInstance()->powA(anXmin, aBeta+1);
if(y>ymax) ymax = y;
}
G4double y;
G4double xMax=1-(totalSea+1)*anXmin;
if(anXmin > xMax)
{
G4cout << "anXmin = "<<anXmin<<" nSea = "<<nSea<<" totalSea = "<< totalSea<<G4endl;
// G4cout << "anXmin = "<<anXmin<<" nSea = "<<nSea<<" totalSea = "<< totalSea<<G4endl;
throw G4HadronicException(__FILE__, __LINE__, "G4QGSMSplitableHadron - Fatal: Cannot sample parton densities under these constraints.");
}
const G4int maxNumberOfLoops = 10000;
G4int loopCounter = -1;
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = 0;
do
{
x1 = G4RandFlat::shoot(anXmin, xMax);
y = G4Pow::GetInstance()->powA(x1, alpha);
y *= G4Pow::GetInstance()->powN( G4Pow::GetInstance()->powA(1-x1-totalSea*anXmin, alpha+1) - G4Pow::GetInstance()->powA(anXmin, alpha+1), nSea);
y *= G4Pow::GetInstance()->powA(1-x1-totalSea*anXmin, aBeta+1) - G4Pow::GetInstance()->powA(anXmin, aBeta+1);
y *= G4Pow::GetInstance()->powN( G4Pow::GetInstance()->powA(1-x1-totalSea*anXmin, alpha+1) -
G4Pow::GetInstance()->powA(anXmin, alpha+1), nSea);
y *= G4Pow::GetInstance()->powA(1-x1-totalSea*anXmin, aBeta+1) -
G4Pow::GetInstance()->powA(anXmin, aBeta+1);
x2 = ymax*G4UniformRand();
}
while ( (x2>y) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 26.10.2015, A.Ribon */
while( (x2>y) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
G4ExceptionDescription ed;
ed << " Failed sampling after maxNumberOfLoops attempts : forced exit! " << G4endl;
G4Exception( "G4QGSMSplitableHadron::SampleX ", "HAD_QGS_002", JustWarning, ed );
x1 = 0.5*( anXmin + xMax ); // Just an acceptable value, without any physics consideration.
}
result = x1;
return result;
File diff suppressed because it is too large Load Diff
@@ -97,6 +97,7 @@ void G4SPBaryon::
SampleQuarkAndDiquark(G4int & quark, G4int & diQuark) const
{
typedef std::vector<G4SPPartonInfo *>::const_iterator iter;
G4double random = G4UniformRand();
G4double sum = 0;
iter i;
@@ -153,9 +154,9 @@ FindDiquark(G4int quark, G4int & diQuark) const
G4SPBaryon::
G4SPBaryon(G4Proton * aProton)
{
theDefinition = aProton;
thePartonInfo.push_back(new G4SPPartonInfo(2203, 1, 1./3.)); // uu_1, d
thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./6.)); // ud_1, u
theDefinition = aProton; // Uzhi
thePartonInfo.push_back(new G4SPPartonInfo(2203, 1, 1./3./2.)); // uu_1, d
thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./6.*2.)); // ud_1, u
thePartonInfo.push_back(new G4SPPartonInfo(2101, 2, 1./2.)); // ud_0, u
}
@@ -171,10 +172,10 @@ G4SPBaryon(G4AntiProton * aAntiProton)
G4SPBaryon::
G4SPBaryon(G4Neutron * aNeutron)
{
theDefinition = aNeutron;
thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 1./6.)); // ud_1, d
thePartonInfo.push_back(new G4SPPartonInfo(2101, 1, 1./2.)); // ud_0, d
thePartonInfo.push_back(new G4SPPartonInfo(1103, 2, 1./3.)); // dd_1, u
theDefinition = aNeutron; // Uzhi
thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 1./6.*2.)); // ud_1, d
thePartonInfo.push_back(new G4SPPartonInfo(2101, 1, 1./2. )); // ud_0, d
thePartonInfo.push_back(new G4SPPartonInfo(1103, 2, 1./3./2 )); // dd_1, u
}
G4SPBaryon::
@@ -348,7 +349,8 @@ G4SPBaryon(G4ParticleDefinition * aDefinition)
G4ParticleTable::GetParticleTable()->FindParticle(2114))// D0
{
thePartonInfo.push_back(new G4SPPartonInfo(2103, 1, 2./3.));
thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./3.));
// Uzhi thePartonInfo.push_back(new G4SPPartonInfo(2103, 2, 1./3.));
thePartonInfo.push_back(new G4SPPartonInfo(1103, 2, 1./3.)); // Uzhi 14.05.2014
}
else if(theDefinition ==
G4ParticleTable::GetParticleTable()->FindParticle(-2114))// anti D0
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4SingleDiffractiveExcitation.cc 93563 2015-10-26 14:46:09Z gcosmo $
// $Id: G4SingleDiffractiveExcitation.cc 94750 2015-12-07 08:24:29Z gcosmo $
// ------------------------------------------------------------
// GEANT 4 class implemetation file
//
@@ -47,6 +47,7 @@
#include "G4ExcitedString.hh"
#include "G4Log.hh"
#include "G4Pow.hh"
G4SingleDiffractiveExcitation::G4SingleDiffractiveExcitation(G4double sigmaPt, G4double minextraMass,G4double x0mass)
@@ -61,31 +62,39 @@ G4SingleDiffractiveExcitation::~G4SingleDiffractiveExcitation()
G4bool G4SingleDiffractiveExcitation::
ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) const
{
/*
G4cout<<G4endl<<"G4SingleDiffractiveExcitation::ExciteParticipants"<<G4endl;
G4cout<<"Proj Targ "<<projectile->GetDefinition()->GetPDGEncoding()<<" "<<target->GetDefinition()->GetPDGEncoding()<<G4endl;
G4cout<<"minExtraMass "<<minExtraMass<<" minmass "<<minmass<<" widthOfPtSquare "<<widthOfPtSquare<<G4endl;
*/
G4LorentzVector Pprojectile=projectile->Get4Momentum();
G4double Mprojectile2=sqr(projectile->GetDefinition()->GetPDGMass() + minExtraMass);
G4double Mprojectile = projectile->GetDefinition()->GetPDGMass();
G4double Mprojectile2=sqr(projectile->GetDefinition()->GetPDGMass()); // + minExtraMass);
G4LorentzVector Ptarget=target->Get4Momentum();
G4double Mtarget2=sqr(target->GetDefinition()->GetPDGMass() + minExtraMass);
// G4cout << "E proj, target :" << Pprojectile.e() << ", " <<
// Ptarget.e() << G4endl;
G4double Mtarget = target->GetDefinition()->GetPDGMass();
G4double Mtarget2=sqr(target->GetDefinition()->GetPDGMass()); // + minExtraMass);
G4bool KeepProjectile= G4UniformRand() > 0.5;
// reset the min.mass of the non diffractive particle to its value, ( minus a bit for rounding...)
if ( KeepProjectile )
{
// cout << " Projectile fix" << G4endl;
Mprojectile2 = sqr(projectile->GetDefinition()->GetPDGMass() * (1-perCent) );
} else {
// cout << " Target fix" << G4endl;
Mtarget2=sqr(target->GetDefinition()->GetPDGMass() * (1-perCent) );
}
//G4cout<<"Pr Tr 4-Mom "<<Pprojectile<<" "<<Pprojectile.mag()<<G4endl<<" "<<Ptarget <<" "<<Ptarget.mag() <<G4endl;
// Transform momenta to cms and then rotate parallel to z axis;
G4double AveragePt2=sqr(400.*MeV);
G4LorentzVector Psum;
Psum=Pprojectile+Ptarget;
G4LorentzVector Psum=Pprojectile+Ptarget;
G4double SqrtS=Psum.mag();
G4double S =Psum.mag2();
if(SqrtS-Mprojectile-Mtarget <= 250.0*MeV) {
return true;
/*
G4cerr<<"Projectile: "<<projectile->GetDefinition()->GetPDGEncoding()<<" "
<<Pprojectile<<" "<<Pprojectile.mag()<<G4endl;
G4cerr<<"Target: "<<target->GetDefinition()->GetPDGEncoding()<<" "
<<Ptarget<<" "<<Ptarget.mag()<<G4endl;
G4cerr<<"sqrt(S) = "<<SqrtS<<" Mp + Mt = "<<Pprojectile.mag()+Ptarget.mag()<<G4endl;
throw G4HadronicException(__FILE__, __LINE__, "The QGSM cannot work at such low energy!");
*/
}
G4LorentzRotation toCms(-1*Psum.boostVector());
@@ -101,101 +110,119 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
toCms.rotateZ(-1*Ptmp.phi());
toCms.rotateY(-1*Ptmp.theta());
// G4cout << "Pprojectile be4 boost " << Pprojectile << G4endl;
// G4cout << "Ptarget be4 boost : " << Ptarget << G4endl;
G4LorentzRotation toLab(toCms.inverse());
//G4cout << "Pprojectile be4 boost " << Pprojectile << G4endl;
//G4cout << "Ptarget be4 boost : " << Ptarget << G4endl;
Pprojectile.transform(toCms);
Ptarget.transform(toCms);
//G4cout << "Pprojectile aft boost " << Pprojectile << G4endl;
//G4cout << "Ptarget aft boost : " << Ptarget << G4endl;
G4double maxPtSquare=sqr(Ptarget.pz());
G4double Pt2, PZcms, PZcms2;
G4double ProjMassT2, ProjMassT;
G4double TargMassT2, TargMassT;
G4double PMinusMin, PMinusMax;
//G4double PPlusMin , PPlusMax;
G4double TPlusMin, TPlusMax;
G4double PMinusNew, PPlusNew, TPlusNew, TMinusNew;
G4LorentzVector Qmomentum;
G4double Qminus, Qplus;
G4bool ProjectileDiffraction= G4UniformRand() > 0.5;
if ( ProjectileDiffraction )
{ // The projectile will fragment, the target will saved.
Mprojectile2=sqr(Mprojectile + 250.*MeV );
} else {// The target will fragment, the projectile will saved.
Mtarget2 = sqr(Mtarget + 250.*MeV );
}
G4int whilecount=0;
do {
whilecount++;
if (whilecount > 1000 )
{
//G4cout<<"whilecount > 1000 "<<whilecount<<G4endl;
Qmomentum=G4LorentzVector(0.,0.,0.,0.);
return false; // Ignore this interaction
}
// Generate pt
Qmomentum=G4LorentzVector(GaussianPt(AveragePt2,maxPtSquare),0);
G4double maxPtSquare=sqr(Ptarget.pz());
if (whilecount++ >= 500 && (whilecount%100)==0)
// G4cout << "G4SingleDiffractiveExcitation::ExciteParticipants possibly looping"
// << ", loop count/ maxPtSquare : "
// << whilecount << " / " << maxPtSquare << G4endl;
if (whilecount > 1000 )
{
Qmomentum=G4LorentzVector(0.,0.,0.,0.);
// G4cout << "G4SingleDiffractiveExcitation::ExciteParticipants: Aborting loop!" << G4endl;
return false; // Ignore this interaction
}
Qmomentum=G4LorentzVector(GaussianPt(widthOfPtSquare,maxPtSquare),0);
Pt2 = G4ThreeVector( Qmomentum.vect() ).mag2();
ProjMassT2 = Mprojectile2 + Pt2;
ProjMassT = std::sqrt( ProjMassT2 );
TargMassT2 = Mtarget2 + Pt2;
TargMassT = std::sqrt( TargMassT2 );
//G4cout<<whilecount<<" "<<Pt2<<" "<<ProjMassT<<" "<<TargMassT<<" "<<SqrtS<<" "<<S<<" "<<ProjectileDiffraction<<G4endl;
if ( SqrtS < ProjMassT + TargMassT ) continue;
PZcms2 = ( S*S + ProjMassT2*ProjMassT2 + TargMassT2*TargMassT2
- 2.0*S*ProjMassT2 - 2.0*S*TargMassT2 - 2.0*ProjMassT2*TargMassT2 ) / 4.0 / S;
if ( PZcms2 < 0 ) continue;
PZcms = std::sqrt( PZcms2 );
if ( ProjectileDiffraction )
{ // The projectile will fragment, the target will saved.
PMinusMin = std::sqrt( ProjMassT2 + PZcms2 ) - PZcms;
PMinusMax = SqrtS - TargMassT;
PMinusNew = ChooseX( PMinusMin, PMinusMax );
TMinusNew = SqrtS - PMinusNew;
Qminus = Ptarget.minus() - TMinusNew;
TPlusNew = TargMassT2 / TMinusNew;
Qplus = Ptarget.plus() - TPlusNew;
} else {// The target will fragment, the projectile will saved.
TPlusMin = std::sqrt( TargMassT2 + PZcms2 ) - PZcms;
TPlusMax = SqrtS - ProjMassT;
TPlusNew = ChooseX( TPlusMin, TPlusMax );
PPlusNew = SqrtS - TPlusNew;
Qplus = PPlusNew - Pprojectile.plus();
PMinusNew = ProjMassT2 / PPlusNew;
Qminus = PMinusNew - Pprojectile.minus();
}
// Momentum transfer
G4double Xmin = minmass / ( Pprojectile.e() + Ptarget.e() );
G4double Xmax=1.;
G4double Xplus =ChooseX(Xmin,Xmax);
G4double Xminus=ChooseX(Xmin,Xmax);
Qmomentum.setPz( (Qplus - Qminus)/2 );
Qmomentum.setE( (Qplus + Qminus)/2 );
//G4cout<<ProjectileDiffraction<<" "<<( Pprojectile + Qmomentum ).mag2()<<" "<< Mprojectile2<<G4endl;
//G4cout<<!ProjectileDiffraction<<" "<<( Ptarget + Qmomentum ).mag2()<<" "<< Mtarget2<<G4endl;
} while ( ( ProjectileDiffraction&&( Pprojectile + Qmomentum ).mag2() < Mprojectile2 ) ||
(!ProjectileDiffraction&&( Ptarget - Qmomentum ).mag2() < Mtarget2 ) ); /* Loop checking, 07.08.2015, A.Ribon */
// Repeat the sampling because there was not any excitation
G4double pt2=G4ThreeVector(Qmomentum.vect()).mag2();
G4double Qplus =-1 * pt2 / Xminus/Ptarget.minus();
G4double Qminus= pt2 / Xplus /Pprojectile.plus();
if ( KeepProjectile )
{
Qminus = (sqr(projectile->GetDefinition()->GetPDGMass()) + pt2 )
/ (Pprojectile.plus() + Qplus )
- Pprojectile.minus();
} else
{
Qplus = Ptarget.plus()
- (sqr(target->GetDefinition()->GetPDGMass()) + pt2 )
/ (Ptarget.minus() - Qminus );
}
Qmomentum.setPz( (Qplus-Qminus)/2 );
Qmomentum.setE( (Qplus+Qminus)/2 );
// G4cout << "Qplus / Qminus " << Qplus << " / " << Qminus<<G4endl;
// G4cout << "pt2 " << pt2 << G4endl;
// G4cout << "Qmomentum " << Qmomentum << G4endl;
// G4cout << " Masses (P/T) : " << (Pprojectile+Qmomentum).mag() <<
// " / " << (Ptarget-Qmomentum).mag() << G4endl;
} while ( (Ptarget-Qmomentum).mag2() <= Mtarget2 /* Loop checking, 26.10.2015, A.Ribon */
|| (Pprojectile+Qmomentum).mag2() <= Mprojectile2
|| (Ptarget-Qmomentum).e() < 0.
|| (Pprojectile+Qmomentum).e() < 0. );
// G4double Ecms=Pprojectile.e() + Ptarget.e();
Pprojectile += Qmomentum;
Ptarget -= Qmomentum;
// G4cout << "Pprojectile.e() : " << Pprojectile.e() << G4endl;
// G4cout << "Ptarget.e() : " << Ptarget.e() << G4endl;
// G4cout << "end event_______________________________________________"<<G4endl;
//
// G4cout << "Pprojectile with Q : " << Pprojectile << G4endl;
// G4cout << "Ptarget with Q : " << Ptarget << G4endl;
// G4cout << "Projectile back: " << toLab * Pprojectile << G4endl;
// G4cout << "Target back: " << toLab * Ptarget << G4endl;
// Transform back and update SplitableHadron Participant.
Pprojectile.transform(toLab);
Ptarget.transform(toLab);
// G4cout << "G4SingleDiffractiveExcitation- Target mass " << Ptarget.mag() << G4endl;
// G4cout << "G4SingleDiffractiveExcitation- Projectile mass " << Pprojectile.mag() << G4endl;
//G4cout << "Pprojectile aft boost " << Pprojectile << G4endl;
//G4cout << "Ptarget aft boost : " << Ptarget << G4endl;
//G4cout << "G4SingleDiffractiveExcitation- Target mass " << Ptarget.mag() << G4endl;
//G4cout << "G4SingleDiffractiveExcitation- Projectile mass " << Pprojectile.mag() << G4endl;
//G4int Uzhi; G4cin>>Uzhi;
target->Set4Momentum(Ptarget);
projectile->Set4Momentum(Pprojectile);
return true;
}
@@ -207,9 +234,6 @@ ExciteParticipants(G4VSplitableHadron *projectile, G4VSplitableHadron *target) c
G4double G4SingleDiffractiveExcitation::ChooseX(G4double Xmin, G4double Xmax) const
{
// choose an x between Xmin and Xmax with P(x) ~ 1/x
// to be improved...
G4double range=Xmax-Xmin;
if ( Xmin <= 0. || range <=0. )
@@ -218,12 +242,7 @@ G4double G4SingleDiffractiveExcitation::ChooseX(G4double Xmin, G4double Xmax) co
throw G4HadronicException(__FILE__, __LINE__, "G4SingleDiffractiveExcitation::ChooseX : Invalid arguments ");
}
G4double x;
do {
x=Xmin + G4UniformRand() * range;
} while ( Xmin/x < G4UniformRand() ); /* Loop checking, 26.10.2015, A.Ribon */
// cout << "DiffractiveX "<<x<<G4endl;
G4double x = Xmin*G4Pow::GetInstance()->powA(Xmax/Xmin, G4UniformRand() );
return x;
}
@@ -233,11 +252,13 @@ G4ThreeVector G4SingleDiffractiveExcitation::GaussianPt(G4double widthSquare, G4
G4double pt2;
const G4int maxNumberOfLoops = 1000;
G4int loopCounter = -1;
G4int loopCounter = 0;
do {
pt2=widthSquare * G4Log( G4UniformRand() );
} while ( ( pt2 > maxPtSquare) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 26.10.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) pt2 = 0.0;
pt2=-widthSquare * G4Log( G4UniformRand() );
} while ( ( pt2 > maxPtSquare) && ++loopCounter < maxNumberOfLoops ); /* Loop checking, 07.08.2015, A.Ribon */
if ( loopCounter >= maxNumberOfLoops ) {
pt2 = 0.99*maxPtSquare; // Just an acceptable value, without any physics consideration.
}
pt2=std::sqrt(pt2);