Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
@@ -0,0 +1,35 @@
# -----------------------------------------------------------
# GNUmakefile for chips granular library. HPW 20-Nov-99
# -----------------------------------------------------------
name := G4hadronic_interface_ci
ifndef G4INSTALL
G4INSTALL = ../../../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/hadronic/management/include/ \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include/ \
-I$(G4BASE)/processes/hadronic/models/generator/util/include \
-I$(G4BASE)/processes/hadronic/models/generator/management/include \
-I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include \
-I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include \
-I$(G4BASE)/particles/management/include \
-I$(G4BASE)/particles/leptons/include \
-I$(G4BASE)/particles/bosons/include \
-I$(G4BASE)/particles/hadrons/mesons/include \
-I$(G4BASE)/particles/hadrons/barions/include \
-I$(G4BASE)/particles/hadrons/ions/include \
-I$(G4BASE)/materials/include
include $(G4INSTALL)/config/common.gmk
@@ -0,0 +1,161 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4ChiralInvariantPhaseSpace_h
#define G4ChiralInvariantPhaseSpace_h
//#define CHIPSdebug
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4ParticleTable.hh"
#include "G4QEnvironment.hh"
//#include "G4Quasmon.hh"
#include "G4QNucleus.hh"
#include "G4QHadronVector.hh"
#include "G4ParticleChange.hh"
#include "G4LorentzVector.hh"
#include "G4DynamicParticle.hh"
#include "G4IonTable.hh"
#include "G4Neutron.hh"
class G4ChiralInvariantPhaseSpace
{
public:
G4VParticleChange * ApplyYourself(const G4Track& aTrack,
G4Nucleus& aTargetNucleus,
G4ParticleChange * aChange = 0);
private:
G4ParticleChange theResult;
};
inline
G4VParticleChange * G4ChiralInvariantPhaseSpace::
ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus, G4ParticleChange * aChange)
{
G4ParticleChange * aResult;
if(aChange != 0)
{
aResult = aChange;
}
else
{
aResult = & theResult;
aResult->Initialize(aTrack);
aResult->SetStatusChange(fStopAndKill);
}
//projectile properties needed in constructor of quasmon
G4LorentzVector proj4Mom;
proj4Mom = aTrack.GetDynamicParticle()->Get4Momentum();
G4int projectilePDGCode = aTrack.GetDynamicParticle()
->GetDefinition()
->GetPDGEncoding();
//target properties needed in constructor of quasmon
G4int targetZ = G4int(aTargetNucleus.GetZ()+0.5);
G4int targetA = G4int(aTargetNucleus.GetN()+0.5);
G4int targetPDGCode = 90000000 + 1000*targetZ + (targetA-targetZ);
// NOT NECESSARY ______________
G4double targetMass = G4ParticleTable::GetParticleTable()->GetIonTable()
->GetIonMass(targetZ, targetA);
G4LorentzVector targ4Mom(0.,0.,0.,targetMass);
// END OF NOT NECESSARY^^^^^^^^
G4int nop = 164; // nuclear clusters up to A=21
G4double fractionOfSingleQuasiFreeNucleons = 0.4;
G4double fractionOfPairedQuasiFreeNucleons = 0.0;
if(targetA>27) fractionOfPairedQuasiFreeNucleons = 0.04;
G4double clusteringCoefficient = 4.;
G4double temperature = 180.;
G4double halfTheStrangenessOfSee = 0.1; // = s/d = s/u
G4double etaToEtaPrime = 0.3;
// construct and fragment the quasmon
G4QCHIPSWorld aWorld(nop); // Create CHIPS World of nop particles
G4QNucleus::SetParameters(fractionOfSingleQuasiFreeNucleons,
fractionOfPairedQuasiFreeNucleons,
clusteringCoefficient);
G4Quasmon::SetParameters(temperature,
halfTheStrangenessOfSee,
etaToEtaPrime);
// G4cout << "Input info "<< projectilePDGCode << " "
// << targetPDGCode <<" "
// << 1./MeV*proj4Mom<<" "
// << 1./MeV*targ4Mom << " "
// << nop << G4endl;
G4QHadronVector projHV;
G4QHadron* iH = new G4QHadron(projectilePDGCode, 1./MeV*proj4Mom);
projHV.push_back(iH);
G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
G4std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
//G4Quasmon* pan= new G4Quasmon(projectilePDGCode, targetPDGCode, 1./MeV*proj4Mom, 1./MeV*targ4Mom, nop);
G4QHadronVector* output = pan->Fragment();
delete pan;
// Fill the particle change.
aResult->SetNumberOfSecondaries(output->size());
G4DynamicParticle * theSec;
#ifdef CHIPSdebug
G4cout << "G4ChiralInvariantPhaseSpace: NEW EVENT #ofHadrons="<<output->size()<<endl;
#endif
unsigned int particle;
for( particle = 0; particle < output->size(); particle++)
{
if(output->operator[](particle)->GetNFragments() != 0)
{
delete output->operator[](particle);
continue;
}
theSec = new G4DynamicParticle;
G4int pdgCode = output->operator[](particle)->GetPDGCode();
#ifdef CHIPSdebug
G4cout << "G4ChiralInvariantPhaseSpace: h#"<<particle<<", PDG="<<pdgCode<<endl;
#endif
G4ParticleDefinition * theDefinition;
// Note that I still have to take care of strange nuclei
// For this I need the mass calculation, and a changed interface
// for ion-tablel ==> work for Hisaya @@@@@@@
// Then I can sort out the pdgCode. I also need a decau process
// for strange nuclei; may be another chips interface
if(pdgCode>90000000)
{
G4int aZ = (pdgCode-90000000)/1000;
G4int anN = pdgCode-90000000-1000*aZ;
theDefinition = G4ParticleTable::GetParticleTable()->FindIon(aZ,anN+aZ,0,aZ);
if(aZ == 0 && anN == 1) theDefinition = G4Neutron::Neutron();
}
else
{
theDefinition = G4ParticleTable::GetParticleTable()->FindParticle(output->operator[](particle)->GetPDGCode());
}
theSec->SetDefinition(theDefinition);
theSec->SetMomentum(output->operator[](particle)->Get4Momentum().vect());
aResult->AddSecondary(theSec);
delete output->operator[](particle);
}
delete output;
return aResult;
}
#endif
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4ElectroNuclearReaction_h
#define G4ElectroNuclearReaction_h
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
#include "G4ElectroNuclearCrossSection.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
class G4ElectroNuclearReaction : public G4HadronicInteraction
{
public:
virtual ~G4ElectroNuclearReaction()
{
}
G4VParticleChange * ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
G4ElectroNuclearCrossSection theData;
G4ParticleChange theResult;
};
inline
G4VParticleChange * G4ElectroNuclearReaction::
ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
{
const G4ParticleDefinition* aD = aTrack.GetDynamicParticle()->GetDefinition();
if((aD != G4Electron::ElectronDefinition()) && (aD != G4Positron::PositronDefinition()))
{
G4Exception("Called G4ElectroNuclearReaction for particle other than electron or positron");
}
theResult.Initialize(aTrack);
const G4ElementTable* aTab = G4Element::GetElementTable();
G4Element * anElement = 0;
G4int aZ = static_cast<G4int>(aTargetNucleus.GetZ()+.1);
for(size_t ii=0; ii<aTab->size(); ii++)
{
if ( abs((*aTab)[ii]->GetZ()-aZ) < .1)
{
anElement = (*aTab)[ii];
break;
}
}
if(0==anElement)
{
G4cout << "G4ElectroNuclearReaction::ApplyYourself - trying to react on an element"<<G4endl;
G4cout << "that is not in the table of elements. Z="<<aTargetNucleus.GetZ()<<G4endl;
G4Exception("Folding with error.");
}
G4double photonEnergy = 10*GeV;
G4double xSec;
while(photonEnergy>3.*GeV)
{
xSec = theData.GetCrossSection(aTrack.GetDynamicParticle(), anElement);
photonEnergy = theData.GetEffectivePhotonEnergy();
}
if(aTrack.GetDynamicParticle()->GetKineticEnergy() - photonEnergy < 0)
{
G4Exception("G4ElectroNuclearReaction: photonEnergy above electron energy");
}
theResult.SetEnergyChange(aTrack.GetDynamicParticle()->GetKineticEnergy() - photonEnergy);
G4ThreeVector photonDirection = aTrack.GetMomentumDirection();
G4DynamicParticle localGamma(G4Gamma::GammaDefinition(), photonDirection, photonEnergy);
G4ThreeVector position(0,0,0);
G4Track localTrack(&localGamma, 0., position);
G4VParticleChange * result = theModel.ApplyYourself(localTrack, aTargetNucleus, &theResult);
return result;
}
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4GammaNuclearReaction_h
#define G4GammaNuclearReaction_h
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
#include "G4Gamma.hh"
class G4GammaNuclearReaction : public G4HadronicInteraction
{
public:
virtual ~G4GammaNuclearReaction()
{
}
G4VParticleChange * ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
};
inline
G4VParticleChange * G4GammaNuclearReaction::
ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
{
if(aTrack.GetDynamicParticle()->GetDefinition() != G4Gamma::GammaDefinition())
{
G4Exception("Called G4GammaNuclearReaction for particle other than gamma");
}
return theModel.ApplyYourself(aTrack, aTargetNucleus);
}
#endif
@@ -0,0 +1,104 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4PionMinusNuclearAtRestChips_h
#define G4PionMinusNuclearAtRestChips_h
#include "globals.hh"
#include "G4VRestProcess.hh"
#include "G4StopElementSelector.hh"
#include "G4PionMinus.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
class G4PionMinusNuclearAtRestChips : public G4VRestProcess
{
private:
// hide assignment operator as private
G4PionMinusNuclearAtRestChips& operator=(const G4PionMinusNuclearAtRestChips &right);
G4PionMinusNuclearAtRestChips(const G4PionMinusNuclearAtRestChips& );
public:
G4PionMinusNuclearAtRestChips(const G4String& processName ="PionMinusAnnihilationAtRest")
: G4VRestProcess (processName) {}
~G4PionMinusNuclearAtRestChips() {}
G4bool IsApplicable(const G4ParticleDefinition& aParticle)
{
return ( &aParticle == G4PionMinus::PionMinusDefinition() );
}
// null physics table
void BuildPhysicsTable(const G4ParticleDefinition&){}
G4double AtRestGetPhysicalInteractionLength(const G4Track&track,
G4ForceCondition*condition);
// zero mean lifetime
G4double GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition) {return 0.0;}
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
private:
G4ChiralInvariantPhaseSpace theModel;
G4StopElementSelector theSelector; // Assume identical laws as for muons
};
inline
G4VParticleChange * G4PionMinusNuclearAtRestChips::
AtRestDoIt(const G4Track& aTrack, const G4Step&aStep)
{
if(aTrack.GetDynamicParticle()->GetDefinition() != G4PionMinus::PionMinus())
{
G4Exception("Calling G4PionMinusNuclearAtRestChips with particle other than pi-!!!");
}
// Create target
G4Element * theTarget = theSelector.GetElement(aTrack.GetMaterial());
G4Nucleus aTargetNucleus(theTarget->GetN() ,theTarget->GetZ());
// Call chips
return theModel.ApplyYourself(aTrack, aTargetNucleus);
}
G4double G4PionMinusNuclearAtRestChips::
AtRestGetPhysicalInteractionLength(const G4Track&track,
G4ForceCondition*condition)
{
ResetNumberOfInteractionLengthLeft();
*condition = NotForced;
currentInteractionLength = GetMeanLifeTime(track, condition);
#ifdef CHIPSdebug
if ((currentInteractionLength <0.0) || (verboseLevel>2))
{
G4cout << "G4PionMinusNuclearAtRestChips::AtRestGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" <<G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl;
}
#endif
return theNumberOfInteractionLengthLeft * currentInteractionLength;
}
#endif
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4PionMinusNuclearReaction_h
#define G4PionMinusNuclearReaction_h
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
#include "G4PionMinus.hh"
class G4PionMinusNuclearReaction : public G4HadronicInteraction
{
public:
G4VParticleChange * ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
};
inline
G4VParticleChange * G4PionMinusNuclearReaction::
ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
{
// if(aTrack.GetDynamicParticle()->GetDefinition() != G4PionMinus::PionMinusDefinition())
// {
// G4Exception("Called G4PionMinusNuclearReaction for particle other than PionMinus");
// }
return theModel.ApplyYourself(aTrack, aTargetNucleus);
}
#endif
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4ProtonAntiProtonAtRestChips_h
#define G4ProtonAntiProtonAtRestChips_h
#include "globals.hh"
#include "G4VRestProcess.hh"
#include "G4ParticleTable.hh"
#include "G4Quasmon.hh"
#include "G4QHadronVector.hh"
#include "G4ParticleChange.hh"
#include "G4LorentzVector.hh"
#include "G4DynamicParticle.hh"
#include "G4IonTable.hh"
#include "G4Neutron.hh"
#include "G4StopElementSelector.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
class G4ProtonAntiProtonAtRestChips : public G4VRestProcess
{
private:
// hide assignment operator as private
G4ProtonAntiProtonAtRestChips& operator=(const G4ProtonAntiProtonAtRestChips &right);
G4ProtonAntiProtonAtRestChips(const G4ProtonAntiProtonAtRestChips& );
public:
G4ProtonAntiProtonAtRestChips(const G4String& processName ="AntiProtonAnnihilationAtRest")
: G4VRestProcess (processName) {}
~G4ProtonAntiProtonAtRestChips() {}
G4bool IsApplicable(const G4ParticleDefinition& aParticle)
{
return ( &aParticle == G4AntiProton::AntiProtonDefinition() );
}
// null physics table
void BuildPhysicsTable(const G4ParticleDefinition&){}
G4double AtRestGetPhysicalInteractionLength(const G4Track&track,
G4ForceCondition*condition);
// zero mean lifetime
G4double GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition) {return 0.0;}
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
private:
G4ChiralInvariantPhaseSpace theModel;
G4StopElementSelector theSelector; // Assume identical laws as for muons
};
inline
G4VParticleChange * G4ProtonAntiProtonAtRestChips::
AtRestDoIt(const G4Track& aTrack, const G4Step&aStep)
{
// Create target
G4Element * theTarget = theSelector.GetElement(aTrack.GetMaterial());
G4Nucleus aTargetNucleus(theTarget->GetN() ,theTarget->GetZ());
// Check model validity - note this will be a sub-branch in the ordinary stopping @@@@@@
// in the long haul. @@@@@@
if(aTrack.GetDynamicParticle()->GetDefinition() != G4AntiProton::AntiProton())
{
G4Exception("Calling G4ProtonAntiProtonAtRestChips with particle other than p-bar!!!");
}
if(aTargetNucleus.GetZ() != 1)
{
G4Exception("Calling G4ProtonAntiProtonAtRestChips for target other than Hydrogen!!!");
}
// Call chips
return theModel.ApplyYourself(aTrack, aTargetNucleus);
}
G4double G4ProtonAntiProtonAtRestChips::
AtRestGetPhysicalInteractionLength(const G4Track&track,
G4ForceCondition*condition)
{
ResetNumberOfInteractionLengthLeft();
*condition = NotForced;
currentInteractionLength = GetMeanLifeTime(track, condition);
#ifdef CHIPSdebug
if ((currentInteractionLength <0.0) || (verboseLevel>2))
{
G4cout << "G4ProtonAntiProtonAtRestChips::AtRestGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" <<G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl;
}
#endif
return theNumberOfInteractionLengthLeft * currentInteractionLength;
}
#endif
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4ProtonAntiProtonReaction_h
#define G4ProtonAntiProtonReaction_h
#include "globals.hh"
#include "G4HadronicInteraction.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
#include "G4AntiProton.hh"
class G4ProtonAntiProtonReaction : public G4HadronicInteraction
{
public:
G4VParticleChange * ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
};
inline
G4VParticleChange * G4ProtonAntiProtonReaction::
ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
{
if(aTrack.GetDynamicParticle()->GetDefinition() != G4AntiProton::AntiProton())
{
G4Exception("Calling G4ProtonAntiProtonReaction with particle other than p-bar!!!");
}
if(aTargetNucleus.GetZ() != 1)
{
G4Exception("Calling G4ProtonAntiProtonReaction for target other than Hydrogen!!!");
}
return theModel.ApplyYourself(aTrack, aTargetNucleus);
}
#endif
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4StringChipsInterface_h
#define G4StringChipsInterface_h
#include "G4VIntraNuclearTransportModel.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
class G4StringChipsInterface : public G4VIntraNuclearTransportModel
{
public:
G4StringChipsInterface();
virtual G4VParticleChange* ApplyYourself(const G4Track& aTrack,
G4Nucleus& theNucleus);
virtual G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
G4V3DNucleus* theNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
G4double theEnergyLossPerFermi;
};
#endif
@@ -0,0 +1,54 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#ifndef G4StringChipsParticleLevelInterface_h
#define G4StringChipsParticleLevelInterface_h
#include "G4VIntraNuclearTransportModel.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
class G4StringChipsParticleLevelInterface : public G4VIntraNuclearTransportModel
{
public:
G4StringChipsParticleLevelInterface();
virtual G4VParticleChange* ApplyYourself(const G4Track& aTrack,
G4Nucleus& theNucleus);
virtual G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
G4V3DNucleus* theNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
G4double theEnergyLossPerFermi;
G4double theInnerCoreDensityCut;
G4double fractionOfSingleQuasiFreeNucleons;
G4double fractionOfPairedQuasiFreeNucleons;
G4double clusteringCoefficient;
G4double temperature;
G4double halfTheStrangenessOfSee;
G4double etaToEtaPrime;
G4double fusionToExchange;
G4int nop;
};
#endif
@@ -0,0 +1,419 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4StringChipsInterface.hh"
#include "globals.hh"
#include "G4Pair.hh"
#include "g4std/list"
#include "G4KineticTrackVector.hh"
#include "G4Nucleon.hh"
#include "G4LorentzRotation.hh"
G4StringChipsInterface::G4StringChipsInterface()
{
#ifdef CHIPSdebug
G4cout << "Please enter the energy loss per fermi in GeV"<<G4endl;
G4cin >> theEnergyLossPerFermi;
#endif
theEnergyLossPerFermi *= GeV;
// theEnergyLossPerFermi = 1.*GeV;
}
G4VParticleChange* G4StringChipsInterface::
ApplyYourself(const G4Track& aTrack, G4Nucleus& theNucleus)
{
return theModel.ApplyYourself(aTrack, theNucleus);
}
G4ReactionProductVector* G4StringChipsInterface::
Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
{
// Protection for non physical conditions
if(theSecondaries->size() == 1)
G4Exception("G4StringChipsInterface: Only one particle from String models!");
// Calculate the mean energy lost
G4Pair<G4double, G4double> theImpact = theNucleus->RefetchImpactXandY();
G4double impactX = theImpact.first;
G4double impactY = theImpact.second;
G4double inpactPar2 = impactX*impactX + impactY*impactY;
G4double radius2 = theNucleus->GetNuclearRadius(5*perCent);
radius2 *= radius2;
G4double pathlength = 0;
if(radius2 - inpactPar2>0) pathlength = 2.*sqrt(radius2 - inpactPar2);
G4double theEnergyLostInFragmentation = theEnergyLossPerFermi*pathlength/fermi;
// now select all particles in range
G4std::list<G4Pair<G4double, G4KineticTrack *> > theSorted;
G4std::list<G4Pair<G4double, G4KineticTrack *> >::iterator current;
for(unsigned int secondary = 0; secondary<theSecondaries->size(); secondary++)
{
G4LorentzVector a4Mom = theSecondaries->operator[](secondary)->Get4Momentum();
#ifdef CHIPSdebug
G4cout <<"ALL STRING particles "<<theSecondaries->operator[](secondary)->GetDefinition()->GetPDGCharge()<<" "
<< theSecondaries->operator[](secondary)->GetDefinition()->GetPDGEncoding()<<" "
<< a4Mom <<G4endl;
#endif
G4double toSort = a4Mom.rapidity();
G4Pair<G4double, G4KineticTrack *> it;
it.first = toSort;
it.second = theSecondaries->operator[](secondary);
G4bool inserted = false;
for(current = theSorted.begin(); current!=theSorted.end(); current++)
{
if((*current).first > toSort)
{
theSorted.insert(current, it);
inserted = true;
break;
}
}
if(!inserted)
{
theSorted.push_front(it);
}
}
G4LorentzVector proj4Mom(0.,0.,0.,0.);
// @@ Use the G4QContent class, which is exactly (nD,nU,nS,nAD,nAU,nAS) !
// The G4QContent class is a basic clas in CHIPS (not PDG Code as in GEANT4),
// so in CHIPS on can has a hadronic obgect (Quasmon) with any Quark Content.
// As a simple extantion for the hadron (which is a special case for Hadron)
// there is a clas G4QChipolino, which is a Quasmon, which can decay in two
// hadrons. In future the three-hadron class can be added...
G4int nD = 0;
G4int nU = 0;
G4int nS = 0;
G4int nAD = 0;
G4int nAU = 0;
G4int nAS = 0;
G4std::list<G4Pair<G4double, G4KineticTrack *> >::iterator firstEscaping = theSorted.begin();
G4double runningEnergy = 0;
G4int particleCount = 0;
G4LorentzVector theLow = (*(theSorted.begin())).second->Get4Momentum();
G4LorentzVector theHigh;
#ifdef CHIPSdebug
G4cout << "CHIPS ENERGY LOST "<<theEnergyLostInFragmentation<<G4endl;
G4cout << "sorted rapidities event start"<<G4endl;
#endif
G4ReactionProductVector * theResult = new G4ReactionProductVector;
G4ReactionProduct * theSec;
G4KineticTrackVector * secondaries;
// first decay and add all escaping particles.
for(current = theSorted.begin(); current!=theSorted.end(); current++)
{
firstEscaping = current;
if((*current).second->GetDefinition()->GetQuarkContent(3)!=0 ||
(*current).second->GetDefinition()->GetAntiQuarkContent(3) !=0)
{
G4KineticTrack * aResult = (*current).second;
G4ParticleDefinition * pdef=aResult->GetDefinition();
secondaries = NULL;
if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
{
secondaries = aResult->Decay();
}
if ( secondaries == NULL )
{
theSec = new G4ReactionProduct(aResult->GetDefinition());
G4LorentzVector current4Mom = aResult->Get4Momentum();
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
else
{
for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
{
theSec = new G4ReactionProduct(secondaries->operator[](aSecondary)->GetDefinition());
G4LorentzVector current4Mom = secondaries->operator[](aSecondary)->Get4Momentum();
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
G4std::for_each(secondaries->begin(), secondaries->end(), DeleteKineticTrack());
delete secondaries;
}
continue;
}
runningEnergy += (*current).second->Get4Momentum().t();
if(runningEnergy > theEnergyLostInFragmentation) break;
#ifdef CHIPSdebug
G4cout <<"ABSORBED STRING particles "<<current->second->GetDefinition()->GetPDGCharge()<<" "
<< current->second->GetDefinition()->GetPDGEncoding()<<" "
<< current->second->Get4Momentum() <<G4endl;
#endif
// projectile 4-momentum needed in constructor of quasmon
particleCount++;
theHigh = (*current).second->Get4Momentum();
proj4Mom += (*current).second->Get4Momentum();
#ifdef CHIPSdebug
G4cout << "sorted rapidities "<<current->second->Get4Momentum().rapidity()<<G4endl;
#endif
// projectile quark contents needed for G4QContent construction (@@ ? -> G4QContent class)
nD += (*current).second->GetDefinition()->GetQuarkContent(1);
nU += (*current).second->GetDefinition()->GetQuarkContent(2);
nS += (*current).second->GetDefinition()->GetQuarkContent(3);
nAD += (*current).second->GetDefinition()->GetAntiQuarkContent(1);
nAU += (*current).second->GetDefinition()->GetAntiQuarkContent(2);
nAS += (*current).second->GetDefinition()->GetAntiQuarkContent(3);
}
// construct G4QContent
#ifdef CHIPSdebug
G4cout << "Quark content: d="<<nD<<", u="<<nU<< ", s="<< nS << G4endl;
G4cout << "Anti-quark content: anit-d="<<nAD<<", anti-u="<<nAU<< ", anti-s="<< nAS << G4endl;
#endif
G4QContent theProjectiles(nD, nU, nS, nAD, nAU, nAS);
#ifdef CHIPSdebug
G4cout << "G4QContent is constructed"<<endl;
#endif
// target properties needed in constructor of quasmon
// remove all hit nucleons to get Target code
theNucleus->StartLoop();
G4Nucleon * aNucleon;
G4int resA = 0;
G4int resZ = 0;
G4ThreeVector hitMomentum(0,0,0);
G4double hitMass = 0;
G4int hitCount = 0;
while((aNucleon = theNucleus->GetNextNucleon()))
{
if(!aNucleon->AreYouHit())
{
resA++;
resZ+=G4int (aNucleon->GetDefinition()->GetPDGCharge());
}
else
{
hitMomentum += aNucleon->GetMomentum().vect();
hitMass += aNucleon->GetMomentum().m();
hitCount ++;
}
}
G4int targetPDGCode = 90000000 + 1000*resZ + (resA-resZ);
G4double targetMass = theNucleus->GetMass();
targetMass -= hitMass;
G4double targetEnergy = sqrt(hitMomentum.mag2()+targetMass*targetMass);
// !! @@ Target should be at rest: hitMomentum=(0,0,0) @@ !! M.K.
G4LorentzVector targ4Mom(-1.*hitMomentum, targetEnergy);
// construct the quasmon
G4int nop = 223; // ??????
G4double fractionOfSingleQuasiFreeNucleons = 0.15;
G4double fractionOfPairedQuasiFreeNucleons = 0.01;
G4double clusteringCoefficient = 5.;
G4double temperature = 180.;
G4double halfTheStrangenessOfSee = 0.1; // = s/d = s/u
G4double etaToEtaPrime = 0.3;
G4QNucleus::SetParameters(fractionOfSingleQuasiFreeNucleons,
fractionOfPairedQuasiFreeNucleons,
clusteringCoefficient);
G4Quasmon::SetParameters(temperature,
halfTheStrangenessOfSee,
etaToEtaPrime);
#ifdef CHIPSdebug
G4cout << "G4QNucleus parameters "<< fractionOfSingleQuasiFreeNucleons << " "
<< fractionOfPairedQuasiFreeNucleons << " "<< clusteringCoefficient << G4endl;
G4cout << "G4Quasmon parameters "<< temperature << " "<< halfTheStrangenessOfSee << " "
<<etaToEtaPrime << G4endl;
G4cout << "The Target PDG code = "<<targetPDGCode<<G4endl;
G4cout << "The projectile momentum = "<<1./MeV*proj4Mom<<G4endl;
G4cout << "The target momentum = "<<1./MeV*targ4Mom<<G4endl;
#endif
// Chips expects all in target rest frame, along z.
G4QCHIPSWorld aWorld(nop); // Create CHIPS World of nop particles
G4QHadronVector projHV;
// target rest frame
proj4Mom.boost(-1.*targ4Mom.boostVector());
// now go along z
G4LorentzRotation toZ;
toZ.rotateZ(-1*proj4Mom.phi());
toZ.rotateY(-1*proj4Mom.theta());
proj4Mom = toZ*proj4Mom;
G4LorentzRotation toLab(toZ.inverse());
#ifdef CHIPSdebug
G4cout << "a Boosted projectile vector along z"<<proj4Mom<<" "<<proj4Mom.mag()<<G4endl;
#endif
G4QHadron* iH = new G4QHadron(theProjectiles, 1./MeV*proj4Mom);
projHV.push_back(iH);
// now call chips with this info in place
G4QHadronVector * output = 0;
if (particleCount!=0)
{
G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
G4std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
output = pan->Fragment();
delete pan;
}
else
{
output = new G4QHadronVector;
}
// Fill the result.
#ifdef CHIPSdebug
G4cout << "NEXT EVENT"<<endl;
#endif
// first decay and add all escaping particles.
for(current = firstEscaping; current!=theSorted.end(); current++)
{
G4KineticTrack * aResult = (*current).second;
G4ParticleDefinition * pdef=aResult->GetDefinition();
secondaries = NULL;
if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
{
secondaries = aResult->Decay();
}
if ( secondaries == NULL )
{
theSec = new G4ReactionProduct(aResult->GetDefinition());
G4LorentzVector current4Mom = aResult->Get4Momentum();
current4Mom = toLab*current4Mom;
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
else
{
for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
{
theSec = new G4ReactionProduct(secondaries->operator[](aSecondary)->GetDefinition());
G4LorentzVector current4Mom = secondaries->operator[](aSecondary)->Get4Momentum();
current4Mom = toLab*current4Mom;
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
G4std::for_each(secondaries->begin(), secondaries->end(), DeleteKineticTrack());
delete secondaries;
}
}
G4std::for_each(theSecondaries->begin(), theSecondaries->end(), DeleteKineticTrack());
delete theSecondaries;
// now add the quasmon output
#ifdef CHIPSdebug
G4cout << "Number of particles from string"<<theResult->size()<<G4endl;
G4cout << "Number of particles from chips"<<output->size()<<G4endl;
#endif
for(unsigned int particle = 0; particle < output->size(); particle++)
{
if(output->operator[](particle)->GetNFragments() != 0)
{
delete output->operator[](particle);
continue;
}
theSec = new G4ReactionProduct;
G4int pdgCode = output->operator[](particle)->GetPDGCode();
G4ParticleDefinition * theDefinition;
// Note that I still have to take care of strange nuclei
// For this I need the mass calculation, and a changed interface
// for ion-table ==> work for Hisaya @@@@@@@
// Then I can sort out the pdgCode. I also need a decau process
// for strange nuclei; may be another chips interface
if(pdgCode>90000000)
{
G4int aZ = (pdgCode-90000000)/1000;
if (aZ>1000) aZ=aZ%1000; // patch for strange nuclei, to be repaired @@@@
G4int anN = pdgCode-90000000-1000*aZ;
if(anN>1000) anN=anN%1000; // patch for strange nuclei, to be repaired @@@@
if(pdgCode==91000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==92000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==93000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==94000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==95000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==96000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==97000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==98000000) theDefinition = G4Lambda::LambdaDefinition();
else if(aZ == 0 && anN == 1) theDefinition = G4Neutron::Neutron();
else theDefinition = G4ParticleTable::GetParticleTable()->FindIon(aZ,anN+aZ,0,aZ);
}
else
{
theDefinition = G4ParticleTable::GetParticleTable()->FindParticle(output->operator[](particle)->GetPDGCode());
}
#ifdef CHIPSdebug
G4cout << "Particle code produced = "<< pdgCode <<G4endl;
#endif
theSec = new G4ReactionProduct(theDefinition);
G4LorentzVector current4Mom = output->operator[](particle)->Get4Momentum();
current4Mom = toLab*current4Mom;
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
#ifdef CHIPSdebug
G4cout <<"CHIPS particles "<<theDefinition->GetPDGCharge()<<" "
<< theDefinition->GetPDGEncoding()<<" "
<< current4Mom <<G4endl;
#endif
delete output->operator[](particle);
}
delete output;
#ifdef CHIPSdebug
G4cout << "Number of particles"<<theResult->size()<<G4endl;
G4cout << G4endl;
// @@ G4QContent has even the out option!
G4cout << "QUASMON preparation info "
<< 1./MeV*proj4Mom<<" "
<< 1./MeV*targ4Mom<<" "
<< nD<<" "<<nU<<" "<<nS<<" "<<nAD<<" "<<nAU<<" "<<nAS<<" "
<< hitCount<<" "
<< particleCount<<" "
<< theLow<<" "
<< theHigh<<" "
<< G4endl;
#endif
return theResult;
}
@@ -0,0 +1,486 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4StringChipsParticleLevelInterface.hh"
#include "globals.hh"
#include "G4Pair.hh"
#include "g4std/list"
#include "g4std/vector"
#include "G4KineticTrackVector.hh"
#include "G4Nucleon.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4LorentzRotation.hh"
// #define CHIPSdebug
// #define CHIPSdebug_1
G4StringChipsParticleLevelInterface::G4StringChipsParticleLevelInterface()
{
theEnergyLossPerFermi = 0.7*GeV;
nop = 164; // ??????
fractionOfSingleQuasiFreeNucleons = 0.1;
fractionOfPairedQuasiFreeNucleons = 0.;
clusteringCoefficient = 2.7;
temperature = 180.;
halfTheStrangenessOfSee = 0.3; // = s/d = s/u
etaToEtaPrime = 0.3;
fusionToExchange = 100.;
theInnerCoreDensityCut = 50.;
if(getenv("ChipsParameterTuning"))
{
G4cout << "Please enter the energy loss per fermi in GeV"<<G4endl;
G4cin >> theEnergyLossPerFermi;
theEnergyLossPerFermi *= GeV;
G4cout << "Please enter nop"<<G4endl;
G4cin >> nop;
G4cout << "Please enter the fractionOfSingleQuasiFreeNucleons"<<G4endl;
G4cin >> fractionOfSingleQuasiFreeNucleons;
G4cout << "Please enter the fractionOfPairedQuasiFreeNucleons"<<G4endl;
G4cin >> fractionOfPairedQuasiFreeNucleons;
G4cout << "Please enter the clusteringCoefficient"<<G4endl;
G4cin >> clusteringCoefficient;
G4cout << "Please enter the temperature"<<G4endl;
G4cin >> temperature;
G4cout << "Please enter halfTheStrangenessOfSee"<<G4endl;
G4cin >> halfTheStrangenessOfSee;
G4cout << "Please enter the etaToEtaPrime"<<G4endl;
G4cin >> etaToEtaPrime;
G4cout << "Please enter the fusionToExchange"<<G4endl;
G4cin >> fusionToExchange;
G4cout << "Please enter the cut-off for calculating the nuclear radius in percent"<<G4endl;
G4cin >> theInnerCoreDensityCut;
}
}
G4VParticleChange* G4StringChipsParticleLevelInterface::
ApplyYourself(const G4Track& aTrack, G4Nucleus& theNucleus)
{
return theModel.ApplyYourself(aTrack, theNucleus);
}
G4ReactionProductVector* G4StringChipsParticleLevelInterface::
Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
{
// Protection for non physical conditions
if(theSecondaries->size() == 1)
{
G4ReactionProductVector * theFastResult = new G4ReactionProductVector;
G4ReactionProduct * theFastSec;
theFastSec = new G4ReactionProduct((*theSecondaries)[0]->GetDefinition());
G4LorentzVector current4Mom = (*theSecondaries)[0]->Get4Momentum();
theFastSec->SetTotalEnergy(current4Mom.t());
theFastSec->SetMomentum(current4Mom.vect());
theFastResult->push_back(theFastSec);
return theFastResult;
// G4Exception("G4StringChipsParticleLevelInterface: Only one particle from String models!");
}
// target properties needed in constructor of quasmon, and for boosting to
// target rest frame
// remove all hit nucleons to get Target code
theNucleus->StartLoop();
G4Nucleon * aNucleon;
G4int resA = 0;
G4int resZ = 0;
G4ThreeVector hitMomentum(0,0,0);
G4double hitMass = 0;
unsigned int hitCount = 0;
while((aNucleon = theNucleus->GetNextNucleon()))
{
if(!aNucleon->AreYouHit())
{
resA++;
resZ+=G4int (aNucleon->GetDefinition()->GetPDGCharge());
}
else
{
hitMomentum += aNucleon->GetMomentum().vect();
hitMass += aNucleon->GetMomentum().m();
hitCount ++;
}
}
G4int targetPDGCode = 90000000 + 1000*resZ + (resA-resZ);
G4double targetMass = theNucleus->GetMass();
targetMass -= hitMass;
G4double targetEnergy = sqrt(hitMomentum.mag2()+targetMass*targetMass);
// !! @@ Target should be at rest: hitMomentum=(0,0,0) @@ !! M.K.
G4LorentzVector targ4Mom(-1.*hitMomentum, targetEnergy);
// Calculate the mean energy lost
G4Pair<G4double, G4double> theImpact = theNucleus->RefetchImpactXandY();
G4double impactX = theImpact.first;
G4double impactY = theImpact.second;
G4double inpactPar2 = impactX*impactX + impactY*impactY;
G4double radius2 = theNucleus->GetNuclearRadius(theInnerCoreDensityCut*perCent);
radius2 *= radius2;
G4double pathlength = 0;
if(radius2 - inpactPar2>0) pathlength = 2.*sqrt(radius2 - inpactPar2);
G4double theEnergyLostInFragmentation = theEnergyLossPerFermi*pathlength/fermi;
// now select all particles in range
G4std::list<G4Pair<G4double, G4KineticTrack *> > theSorted;
G4std::list<G4Pair<G4double, G4KineticTrack *> >::iterator current;
for(unsigned int secondary = 0; secondary<theSecondaries->size(); secondary++)
{
G4LorentzVector a4Mom = theSecondaries->operator[](secondary)->Get4Momentum();
#ifdef CHIPSdebug
G4cout <<"ALL STRING particles "<<theSecondaries->operator[](secondary)->GetDefinition()->GetPDGCharge()<<" "
<< theSecondaries->operator[](secondary)->GetDefinition()->GetPDGEncoding()<<" "
<< a4Mom <<G4endl;
#endif
G4double toSort = a4Mom.rapidity();
G4Pair<G4double, G4KineticTrack *> it;
it.first = toSort;
it.second = theSecondaries->operator[](secondary);
G4bool inserted = false;
for(current = theSorted.begin(); current!=theSorted.end(); current++)
{
if((*current).first > toSort)
{
theSorted.insert(current, it);
inserted = true;
break;
}
}
if(!inserted)
{
theSorted.push_back(it);
}
}
G4LorentzVector proj4Mom(0.,0.,0.,0.);
G4int nD = 0;
G4int nU = 0;
G4int nS = 0;
G4int nAD = 0;
G4int nAU = 0;
G4int nAS = 0;
G4std::list<G4Pair<G4double, G4KineticTrack *> >::iterator firstEscaping = theSorted.begin();
G4double runningEnergy = 0;
G4int particleCount = 0;
G4LorentzVector theLow = (*(theSorted.begin())).second->Get4Momentum();
G4LorentzVector theHigh;
#ifdef CHIPSdebug
G4cout << "CHIPS ENERGY LOST "<<theEnergyLostInFragmentation<<G4endl;
G4cout << "sorted rapidities event start"<<G4endl;
#endif
G4QHadronVector projHV;
G4std::vector<G4QContent> theContents;
G4std::vector<G4LorentzVector *> theMomenta;
G4ReactionProductVector * theResult = new G4ReactionProductVector;
G4ReactionProduct * theSec;
G4KineticTrackVector * secondaries;
for(current = theSorted.begin(); current!=theSorted.end(); current++)
{
firstEscaping = current;
if((*current).second->GetDefinition()->GetQuarkContent(3)!=0 ||
(*current).second->GetDefinition()->GetAntiQuarkContent(3) !=0)
{
G4KineticTrack * aResult = (*current).second;
G4ParticleDefinition * pdef=aResult->GetDefinition();
secondaries = NULL;
if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
{
secondaries = aResult->Decay();
}
if ( secondaries == NULL )
{
theSec = new G4ReactionProduct(aResult->GetDefinition());
G4LorentzVector current4Mom = aResult->Get4Momentum();
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
else
{
for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
{
theSec = new G4ReactionProduct(secondaries->operator[](aSecondary)->GetDefinition());
G4LorentzVector current4Mom = secondaries->operator[](aSecondary)->Get4Momentum();
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
G4std::for_each(secondaries->begin(), secondaries->end(), DeleteKineticTrack());
delete secondaries;
}
}
runningEnergy += (*current).second->Get4Momentum().t();
if((*current).second->GetDefinition() == G4Proton::Proton())
runningEnergy-=G4Proton::Proton()->GetPDGMass();
if((*current).second->GetDefinition() == G4Neutron::Neutron())
runningEnergy-=G4Neutron::Neutron()->GetPDGMass();
#ifdef CHIPSdebug
G4cout << "sorted rapidities "<<(*current).second->Get4Momentum().rapidity()<<G4endl;
#endif
if(runningEnergy > theEnergyLostInFragmentation) break;
#ifdef CHIPSdebug
G4cout <<"ABSORBED STRING particles "<<(*current).second->GetDefinition()->GetPDGCharge()<<" "
<< (*current).second->GetDefinition()->GetPDGEncoding()<<" "
<< (*current).second->Get4Momentum() <<G4endl;
#endif
// projectile 4-momentum in target rest frame needed in constructor of QHadron
particleCount++;
theHigh = (*current).second->Get4Momentum();
proj4Mom = (*current).second->Get4Momentum();
proj4Mom.boost(-1.*targ4Mom.boostVector());
nD = (*current).second->GetDefinition()->GetQuarkContent(1);
nU = (*current).second->GetDefinition()->GetQuarkContent(2);
nS = (*current).second->GetDefinition()->GetQuarkContent(3);
nAD = (*current).second->GetDefinition()->GetAntiQuarkContent(1);
nAU = (*current).second->GetDefinition()->GetAntiQuarkContent(2);
nAS = (*current).second->GetDefinition()->GetAntiQuarkContent(3);
G4QContent aProjectile(nD, nU, nS, nAD, nAU, nAS);
#ifdef CHIPSdebug_1
G4cout << G4endl;
G4cout << "Quark content: d="<<nD<<", u="<<nU<< ", s="<< nS << G4endl;
G4cout << "Anti-quark content: anit-d="<<nAD<<", anti-u="<<nAU<< ", anti-s="<< nAS << G4endl;
G4cout << "G4QContent is constructed"<<endl;
#endif
theContents.push_back(aProjectile);
G4LorentzVector * aVec = new G4LorentzVector(1./MeV*proj4Mom);
#ifdef CHIPSdebug_1
G4cout << "projectile momentum = "<<*aVec<<G4endl;
G4cout << G4endl;
#endif
theMomenta.push_back(aVec);
}
G4std::vector<G4QContent> theFinalContents;
G4std::vector<G4LorentzVector*> theFinalMomenta;
if(theContents.size()<hitCount || 1)
{
for(unsigned int hp = 0; hp<theContents.size(); hp++)
{
G4QHadron* aHadron = new G4QHadron(theContents[hp], *(theMomenta[hp]) );
projHV.push_back(aHadron);
}
}
else
{
unsigned int hp;
for(hp=0; hp<hitCount; hp++)
{
G4QContent co(0, 0, 0, 0, 0, 0);
theFinalContents.push_back(co);
G4LorentzVector * mo = new G4LorentzVector(0,0,0,0);
theFinalMomenta.push_back(mo);
}
unsigned int running = 0;
while (running<theContents.size())
{
for(hp = 0; hp<hitCount; hp++)
{
theFinalContents[hp] +=theContents[running];
*(theFinalMomenta[hp])+=*(theMomenta[running]);
running++;
if(running == theContents.size()) break;
}
}
for(hp = 0; hp<hitCount; hp++)
{
G4QHadron* aHadron = new G4QHadron(theFinalContents[hp], *theFinalMomenta[hp]);
projHV.push_back(aHadron);
}
}
// construct the quasmon
size_t i;
for (i=0; i<theFinalMomenta.size(); i++) delete theFinalMomenta[i];
for (i=0; i<theMomenta.size(); i++) delete theMomenta[i];
theFinalMomenta.clear();
theMomenta.clear();
G4QNucleus::SetParameters(fractionOfSingleQuasiFreeNucleons,
fractionOfPairedQuasiFreeNucleons,
clusteringCoefficient,
fusionToExchange);
G4Quasmon::SetParameters(temperature,
halfTheStrangenessOfSee,
etaToEtaPrime);
#ifdef CHIPSdebug
G4cout << "G4QNucleus parameters "<< fractionOfSingleQuasiFreeNucleons << " "
<< fractionOfPairedQuasiFreeNucleons << " "<< clusteringCoefficient << G4endl;
G4cout << "G4Quasmon parameters "<< temperature << " "<< halfTheStrangenessOfSee << " "
<< etaToEtaPrime << G4endl;
G4cout << "The Target PDG code = "<<targetPDGCode<<G4endl;
G4cout << "The projectile momentum = "<<1./MeV*proj4Mom<<G4endl;
G4cout << "The target momentum = "<<1./MeV*targ4Mom<<G4endl;
#endif
// now call chips with this info in place
G4QHadronVector * output = 0;
if (particleCount!=0 && resA!=0)
{
G4QCHIPSWorld aWorld(nop); // Create CHIPS World of nop particles
G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
// clean up particles
G4std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
output = pan->Fragment();
delete pan;
}
else
{
output = new G4QHadronVector;
}
// Fill the result.
#ifdef CHIPSdebug
G4cout << "NEXT EVENT"<<endl;
#endif
// first decay and add all escaping particles.
for(current = firstEscaping; current!=theSorted.end(); current++)
{
G4KineticTrack * aResult = (*current).second;
G4ParticleDefinition * pdef=aResult->GetDefinition();
secondaries = NULL;
if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
{
secondaries = aResult->Decay();
}
if ( secondaries == NULL )
{
theSec = new G4ReactionProduct(aResult->GetDefinition());
G4LorentzVector current4Mom = aResult->Get4Momentum();
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
else
{
for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
{
theSec = new G4ReactionProduct(secondaries->operator[](aSecondary)->GetDefinition());
G4LorentzVector current4Mom = secondaries->operator[](aSecondary)->Get4Momentum();
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
}
G4std::for_each(secondaries->begin(), secondaries->end(), DeleteKineticTrack());
delete secondaries;
}
}
G4std::for_each(theSecondaries->begin(), theSecondaries->end(), DeleteKineticTrack());
delete theSecondaries;
// now add the quasmon output
G4int maxParticle=output->size();
#ifdef CHIPSdebug
G4cout << "Number of particles from string"<<theResult->size()<<G4endl;
G4cout << "Number of particles from chips"<<maxParticle<<G4endl;
#endif
for(G4int particle = 0; particle < maxParticle; particle++)
{
if(output->operator[](particle)->GetNFragments() != 0)
{
delete output->operator[](particle);
continue;
}
G4int pdgCode = output->operator[](particle)->GetPDGCode();
#ifdef CHIPSdebug
G4cerr << "PDG code of chips particle = "<<pdgCode<<G4endl;
#endif
G4ParticleDefinition * theDefinition;
// Note that I still have to take care of strange nuclei
// For this I need the mass calculation, and a changed interface
// for ion-table ==> work for Hisaya @@@@@@@
// Then I can sort out the pdgCode. I also need a decau process
// for strange nuclei; may be another chips interface
if(pdgCode>90000000)
{
G4int aZ = (pdgCode-90000000)/1000;
if (aZ>1000) aZ=aZ%1000; // patch for strange nuclei, to be repaired @@@@
G4int anN = pdgCode-90000000-1000*aZ;
if(anN>1000) anN=anN%1000; // patch for strange nuclei, to be repaired @@@@
if(pdgCode==91000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==92000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==93000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==94000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==95000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==96000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==97000000) theDefinition = G4Lambda::LambdaDefinition();
else if(pdgCode==98000000) theDefinition = G4Lambda::LambdaDefinition();
else if(aZ == 0 && anN == 1) theDefinition = G4Neutron::Neutron();
else theDefinition = G4ParticleTable::GetParticleTable()->FindIon(aZ,anN+aZ,0,aZ);
}
else theDefinition = G4ParticleTable::GetParticleTable()->FindParticle(pdgCode);
#ifdef CHIPSdebug
G4cout << "Particle code produced = "<< pdgCode <<G4endl;
#endif
theSec = new G4ReactionProduct(theDefinition);
G4LorentzVector current4Mom = output->operator[](particle)->Get4Momentum();
current4Mom.boost(targ4Mom.boostVector());
theSec->SetTotalEnergy(current4Mom.t());
theSec->SetMomentum(current4Mom.vect());
theResult->push_back(theSec);
#ifdef CHIPSdebug
G4cout <<"CHIPS particles "<<theDefinition->GetPDGCharge()<<" "
<< theDefinition->GetPDGEncoding()<<" "
<< current4Mom <<G4endl;
#endif
delete output->operator[](particle);
}
delete output;
#ifdef CHIPSdebug
G4cout << "Number of particles"<<theResult->size()<<G4endl;
G4cout << G4endl;
G4cout << "QUASMON preparation info "
<< 1./MeV*proj4Mom<<" "
<< 1./MeV*targ4Mom<<" "
<< nD<<" "<<nU<<" "<<nS<<" "<<nAD<<" "<<nAU<<" "<<nAS<<" "
<< hitCount<<" "
<< particleCount<<" "
<< theLow<<" "
<< theHigh<<" "
<< G4endl;
#endif
return theResult;
}