Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -62,25 +62,32 @@ void HistoManager::Book()
analysisManager->SetActivation(true); // enable inactivation of histograms
// Define histogram indices, titles
G4int maxHisto = 13;
G4int maxHisto = 15;
G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10","11","12","13" };
"10","11","12","13","14","15","16","17","18","19" };
// TODO change throughout code
G4String title[] = {
"dummy", // 0
"Cerenkov spectrum", // 1
"scintillation spectrum", // 2
"boundary process status", // 3
"X momentum dir of backward-going photons", // 4
"Y momentum dir of backward-going photons", // 5
"Z momentum dir of backward-going photons", // 6
"X momentum dir of forward-going photons", // 7
"Y momentum dir of forward-going photons", // 8
"Z momentum dir of forward-going photons", // 9
"X momentum dir of Fresnel-refracted photons", //10
"Y momentum dir of Fresnel-refracted photons", //11
"Z momentum dir of Fresnel-refracted photons", //12
"scintillation photons creation time", //13
"scintillation photons creation time", // 3
"WLS absorption spectrum", // 4
"WLS emission spectrum", // 5
"WLS emission time", // 6
"WLS2 absorption spectrum", // 7
"WLS2 emission spectrum", // 8
"WLS2 emission time", // 9
"boundary process status", //10
"X momentum dir of backward-going photons", //11
"Y momentum dir of backward-going photons", //12
"Z momentum dir of backward-going photons", //13
"X momentum dir of forward-going photons", //14
"Y momentum dir of forward-going photons", //15
"Z momentum dir of forward-going photons", //16
"X momentum dir of Fresnel-refracted photons", //17
"Y momentum dir of Fresnel-refracted photons", //18
"Z momentum dir of Fresnel-refracted photons", //19
};
// Default values (to be reset via /analysis/h1/set command)
+57 -8
View File
@@ -47,10 +47,18 @@ Run::Run()
fEkin = -1.;
fCerenkovEnergy = 0.0;
fScintEnergy = 0.0;
fScintEnergy = 0.0;
fWLSAbsorptionEnergy = 0.0;
fWLSEmissionEnergy = 0.0;
fWLS2AbsorptionEnergy = 0.0;
fWLS2EmissionEnergy = 0.0;
fCerenkovCount = 0;
fScintCount = 0;
fScintCount = 0;
fWLSAbsorptionCount = 0;
fWLSEmissionCount = 0;
fWLS2AbsorptionCount = 0;
fWLS2EmissionCount = 0;
fRayleighCount = 0;
fOpAbsorption = 0;
@@ -87,9 +95,17 @@ void Run::Merge(const G4Run* run)
fCerenkovEnergy += localRun->fCerenkovEnergy;
fScintEnergy += localRun->fScintEnergy;
fWLSAbsorptionEnergy += localRun->fWLSAbsorptionEnergy;
fWLSEmissionEnergy += localRun->fWLSEmissionEnergy;
fWLS2AbsorptionEnergy += localRun->fWLS2AbsorptionEnergy;
fWLS2EmissionEnergy += localRun->fWLS2EmissionEnergy;
fCerenkovCount += localRun->fCerenkovCount;
fScintCount += localRun->fScintCount;
fWLSAbsorptionCount += localRun->fWLSAbsorptionCount;
fWLSEmissionCount += localRun->fWLSEmissionCount;
fWLS2AbsorptionCount += localRun->fWLS2AbsorptionCount;
fWLS2EmissionCount += localRun->fWLS2EmissionCount;
fRayleighCount += localRun->fRayleighCount;
fTotalSurface += localRun->fTotalSurface;
@@ -107,8 +123,8 @@ void Run::Merge(const G4Run* run)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::EndOfRun()
{
G4int TotNbofEvents = numberOfEvent;
if (TotNbofEvents == 0) return;
if (numberOfEvent == 0) return;
G4double TotNbofEvents = (G4double)numberOfEvent;
const DetectorConstruction* det = (const DetectorConstruction*)
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
@@ -120,6 +136,7 @@ void Run::EndOfRun()
G4cout << "---------------------------------\n";
G4cout << "Primary particle was: " << fParticle->GetParticleName()
<< " with energy " << G4BestUnit(fEkin, "Energy") << "." << G4endl;
G4cout << "Number of events: " << numberOfEvent << G4endl;
G4cout << "Material of world: " << det->GetWorldMaterial()->GetName()
<< G4endl;
@@ -132,18 +149,50 @@ void Run::EndOfRun()
G4cout << "Average number of Cerenkov photons created per event: "
<< fCerenkovCount/TotNbofEvents << G4endl;
if (fCerenkovCount > 0) {
G4cout << " Average energy: " << (fCerenkovEnergy/eV)/fCerenkovCount
<< " eV." << G4endl;
G4cout << " Average energy per photon: "
<< (fCerenkovEnergy/eV)/fCerenkovCount << " eV." << G4endl;
}
G4cout << "Average energy of scintillation photons created per event: "
<< (fScintEnergy/eV)/TotNbofEvents << " eV." << G4endl;
G4cout << "Average number of scintillation photons created per event: "
<< fScintCount/TotNbofEvents << G4endl;
if (fScintCount > 0) {
G4cout << " Average energy: " << (fScintEnergy/eV)/fScintCount << " eV."
<< G4endl;
G4cout << " Average energy per photon: "
<< (fScintEnergy/eV)/fScintCount << " eV." << G4endl;
}
}
G4cout << "Average number of photons absorbed by WLS per event: "
<< fWLSAbsorptionCount/G4double(TotNbofEvents) << " " << G4endl;
if (fWLSAbsorptionCount > 0) {
G4cout << " Average energy per photon: "
<< (fWLSAbsorptionEnergy/eV)/fWLSAbsorptionCount << " eV." <<G4endl;
}
G4cout << "Average number of photons created by WLS per event: "
<< fWLSEmissionCount/TotNbofEvents << G4endl;
if (fWLSEmissionCount > 0) {
G4cout << " Average energy per photon: "
<< (fWLSEmissionEnergy/eV)/fWLSEmissionCount << " eV." << G4endl;
}
G4cout << "Average energy of WLS photons created per event: "
<< (fWLSEmissionEnergy/eV)/TotNbofEvents << " eV." << G4endl;
G4cout << "Average number of photons absorbed by WLS2 per event: "
<< fWLS2AbsorptionCount/G4double(TotNbofEvents) << " " << G4endl;
if (fWLS2AbsorptionCount > 0) {
G4cout << " Average energy per photon: "
<< (fWLS2AbsorptionEnergy/eV)/fWLS2AbsorptionCount << " eV." <<G4endl;
}
G4cout << "Average number of photons created by WLS2 per event: "
<< fWLS2EmissionCount/TotNbofEvents << G4endl;
if (fWLS2EmissionCount > 0) {
G4cout << " Average energy per photon: "
<< (fWLS2EmissionEnergy/eV)/fWLS2EmissionCount << " eV." << G4endl;
}
G4cout << "Average energy of WLS2 photons created per event: "
<< (fWLS2EmissionEnergy/eV)/TotNbofEvents << " eV." << G4endl;
G4cout << "Average number of OpRayleigh per event: "
<< fRayleighCount/TotNbofEvents << G4endl;
G4cout << "Average number of OpAbsorption per event: "
@@ -63,8 +63,9 @@ SteppingAction::~SteppingAction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingAction::UserSteppingAction(const G4Step* step)
{
static G4ParticleDefinition* opticalphoton =
static G4ParticleDefinition* opticalphoton =
G4OpticalPhoton::OpticalPhotonDefinition();
G4AnalysisManager* analysisMan = G4AnalysisManager::Instance();
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
@@ -73,38 +74,69 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
G4StepPoint* endPoint = step->GetPostStepPoint();
G4StepPoint* startPoint = step->GetPreStepPoint();
G4String particleName = track->GetDynamicParticle()->
GetParticleDefinition()->GetParticleName();
const G4DynamicParticle* theParticle = track->GetDynamicParticle();
const G4ParticleDefinition* particleDef = theParticle->
GetParticleDefinition();
TrackInformation* trackInfo =
TrackInformation* trackInfo =
(TrackInformation*)(track->GetUserInformation());
if (particleName == "opticalphoton") {
if (particleDef == opticalphoton) {
const G4VProcess* pds = endPoint->GetProcessDefinedStep();
if (pds->GetProcessName() == "OpAbsorption") {
run->AddOpAbsorption();
G4String procname = pds->GetProcessName();
if (procname.compare("OpAbsorption") == 0) {
run->AddOpAbsorption();
if (trackInfo->GetIsFirstTankX()) {
run->AddOpAbsorptionPrior();
}
}
else if (pds->GetProcessName() == "OpRayleigh") {
else if (procname.compare("OpRayleigh") == 0) {
run->AddRayleigh();
}
else if (procname.compare("OpWLS") == 0) {
G4double en = track->GetKineticEnergy();
run->AddWLSAbsorption();
run->AddWLSAbsorptionEnergy(en);
analysisMan->FillH1(4, en/eV); //absorption energy
// loop over secondaries, create statistics
//const std::vector<const G4Track*>* secondaries =
auto secondaries = step->GetSecondaryInCurrentStep();
for (auto sec : *secondaries) {
en = sec->GetKineticEnergy();
run->AddWLSEmission();
run->AddWLSEmissionEnergy(en);
analysisMan->FillH1(5, en/eV); // emission energy
G4double time = sec->GetGlobalTime();
analysisMan->FillH1(6, time/ns);
}
}
else if (procname.compare("OpWLS2") == 0) {
G4double en = track->GetKineticEnergy();
run->AddWLS2Absorption();
run->AddWLS2AbsorptionEnergy(en);
analysisMan->FillH1(7, en/eV); //absorption energy
// loop over secondaries, create statistics
//const std::vector<const G4Track*>* secondaries =
auto secondaries = step->GetSecondaryInCurrentStep();
for (auto sec : *secondaries) {
en = sec->GetKineticEnergy();
run->AddWLS2Emission();
run->AddWLS2EmissionEnergy(en);
analysisMan->FillH1(8, en/eV); // emission energy
G4double time = sec->GetGlobalTime();
analysisMan->FillH1(9, time/ns);
}
}
// optical process has endpt on bdry,
if (endPoint->GetStepStatus() == fGeomBoundary) {
const G4DynamicParticle* theParticle = track->GetDynamicParticle();
G4ThreeVector oldMomentumDir = theParticle->GetMomentumDirection();
G4ThreeVector m0 = startPoint->GetMomentumDirection();
G4ThreeVector m1 = endPoint->GetMomentumDirection();
G4OpBoundaryProcessStatus theStatus = Undefined;
G4ProcessManager* OpManager =
G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
G4ProcessManager* OpManager = opticalphoton->GetProcessManager();
G4int MAXofPostStepLoops =
OpManager->GetPostStepProcessVector()->entries();
G4ProcessVector* postStepDoItVector =
@@ -116,13 +148,13 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
G4double py1 = momdir.y();
G4double pz1 = momdir.z();
if (px1 < 0.) {
analysisMan->FillH1(4, px1);
analysisMan->FillH1(5, py1);
analysisMan->FillH1(6, pz1);
} else if (px1 >= 0.) {
analysisMan->FillH1(7, px1);
analysisMan->FillH1(8, py1);
analysisMan->FillH1(9, pz1);
analysisMan->FillH1(11, px1);
analysisMan->FillH1(12, py1);
analysisMan->FillH1(13, pz1);
} else {
analysisMan->FillH1(14, px1);
analysisMan->FillH1(15, py1);
analysisMan->FillH1(16, pz1);
}
trackInfo->SetIsFirstTankX(false);
@@ -135,15 +167,15 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
if (opProc) {
theStatus = opProc->GetStatus();
analysisMan->FillH1(3, theStatus);
analysisMan->FillH1(10, theStatus);
if (theStatus == Transmission) {
run->AddTransmission();
}
else if (theStatus == FresnelRefraction) {
run->AddFresnelRefraction();
analysisMan->FillH1(10, px1);
analysisMan->FillH1(11, py1);
analysisMan->FillH1(12, pz1);
analysisMan->FillH1(17, px1);
analysisMan->FillH1(18, py1);
analysisMan->FillH1(19, pz1);
}
else if (theStatus == FresnelReflection) {
run->AddFresnelReflection();
@@ -279,11 +311,12 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
G4int n_scint = 0;
G4int n_cer = 0;
for (G4int i = 0; i < n_proc; ++i) {
if ((*proc_vec)[i]->GetProcessName().compare("Cerenkov") == 0) {
G4String proc_name = (*proc_vec)[i]->GetProcessName();
if (proc_name.compare("Cerenkov") == 0) {
auto cer = (G4Cerenkov*)(*proc_vec)[i];
n_cer = cer->GetNumPhotons();
}
else if ((*proc_vec)[i]->GetProcessName().compare("Scintillation") == 0) {
else if (proc_name.compare("Scintillation") == 0) {
auto scint = (G4Scintillation*)(*proc_vec)[i];
n_scint = scint->GetNumPhotons();
}
@@ -302,21 +335,21 @@ void SteppingAction::UserSteppingAction(const G4Step* step)
for (auto sec : *secondaries) {
if (sec->GetDynamicParticle()->GetParticleDefinition() == opticalphoton){
if (sec->GetCreatorProcess()->GetProcessName().compare("Cerenkov")==0){
G4String creator_process = sec->GetCreatorProcess()->GetProcessName();
if (creator_process.compare("Cerenkov") == 0){
G4double en = sec->GetKineticEnergy();
run->AddCerenkovEnergy(en);
run->AddCerenkov();
G4AnalysisManager::Instance()->FillH1(1, en/eV);
analysisMan->FillH1(1, en/eV);
}
else if (sec->GetCreatorProcess()
->GetProcessName().compare("Scintillation") == 0) {
else if (creator_process.compare("Scintillation") == 0) {
G4double en = sec->GetKineticEnergy();
run->AddScintillationEnergy(en);
run->AddScintillation();
G4AnalysisManager::Instance()->FillH1(2, en/eV);
analysisMan->FillH1(2, en/eV);
G4double time = sec->GetGlobalTime();
analysisMan->FillH1(13, time/ns);
analysisMan->FillH1(3, time/ns);
}
}
}