Import Geant4 10.5.0.beta source tree
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ActionInitialization.cc 68058 2013-03-13 14:47:43Z gcosmo $
|
||||
//
|
||||
/// \file optical/OpNovice2/src/ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "TrackingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization()
|
||||
: G4VUserActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
SetUserAction(new RunAction());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction();
|
||||
SetUserAction(primary);
|
||||
SetUserAction(new RunAction(primary));
|
||||
SetUserAction(new SteppingAction());
|
||||
SetUserAction(new TrackingAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/DetectorConstruction.cc
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Element.hh"
|
||||
#include "G4LogicalBorderSurface.hh"
|
||||
#include "G4LogicalSkinSurface.hh"
|
||||
#include "G4OpticalSurface.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fDetectorMessenger(nullptr)
|
||||
{
|
||||
fExpHall_x = fExpHall_y = fExpHall_z = 10.0*m;
|
||||
fTank_x = fTank_y = fTank_z = 1.0*m;
|
||||
|
||||
fTank = nullptr;
|
||||
fSurface = nullptr;
|
||||
|
||||
fBoxMPT = new G4MaterialPropertiesTable();
|
||||
fWorldMPT = new G4MaterialPropertiesTable();
|
||||
fSurfaceMPT = new G4MaterialPropertiesTable();
|
||||
|
||||
fDetectorMessenger = new DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{
|
||||
delete fDetectorMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
{
|
||||
|
||||
// ------------- Materials -------------
|
||||
|
||||
G4NistManager* man = G4NistManager::Instance();
|
||||
|
||||
G4Material* air = man->FindOrBuildMaterial("G4_AIR");
|
||||
G4Material* water = man->FindOrBuildMaterial("G4_WATER");
|
||||
|
||||
//
|
||||
// ------------ Generate & Add Material Properties Table ------------
|
||||
//
|
||||
|
||||
|
||||
water->SetMaterialPropertiesTable(fBoxMPT);
|
||||
water->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
|
||||
|
||||
air->SetMaterialPropertiesTable(fWorldMPT);
|
||||
|
||||
// ------------- Volumes --------------
|
||||
// The experimental Hall
|
||||
G4Box* world_box = new G4Box("World", fExpHall_x, fExpHall_y, fExpHall_z);
|
||||
|
||||
G4LogicalVolume* world_LV
|
||||
= new G4LogicalVolume(world_box,air, "World", 0, 0, 0);
|
||||
|
||||
G4VPhysicalVolume* world_PV
|
||||
= new G4PVPlacement(0, G4ThreeVector(), world_LV, "World", 0, false, 0);
|
||||
|
||||
// The Water Tank
|
||||
G4Box* waterTank_box = new G4Box("Tank",fTank_x,fTank_y,fTank_z);
|
||||
|
||||
G4LogicalVolume* waterTank_log
|
||||
= new G4LogicalVolume(waterTank_box,water,"Tank",0,0,0);
|
||||
|
||||
fTank
|
||||
= new G4PVPlacement(0, G4ThreeVector(), waterTank_log, "Tank",
|
||||
world_LV, false, 0);
|
||||
|
||||
// ------------- Surface --------------
|
||||
|
||||
fSurface = new G4OpticalSurface("Surface");
|
||||
fSurface->SetType(dielectric_dielectric);
|
||||
fSurface->SetFinish(polished);
|
||||
fSurface->SetModel(unified);
|
||||
|
||||
fSurface->SetMaterialPropertiesTable(fSurfaceMPT);
|
||||
|
||||
G4LogicalBorderSurface* surface =
|
||||
new G4LogicalBorderSurface("Surface",
|
||||
fTank, world_PV, fSurface);
|
||||
|
||||
G4OpticalSurface* opticalSurface = dynamic_cast <G4OpticalSurface*>
|
||||
(surface->GetSurface(fTank,world_PV)->GetSurfaceProperty());
|
||||
G4cout << "opticalSurface->DumpInfo" << G4endl;
|
||||
if (opticalSurface) opticalSurface->DumpInfo();
|
||||
|
||||
return world_PV;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::SetSurfaceSigmaAlpha(G4double v) {
|
||||
fSurface->SetSigmaAlpha(v);
|
||||
G4RunManager::GetRunManager()->GeometryHasBeenModified();
|
||||
|
||||
G4cout << "Surface sigma alpha set to: " << fSurface->GetSigmaAlpha()
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddBoxMPV(const char* c,
|
||||
G4MaterialPropertyVector* mpv) {
|
||||
mpv->SetSpline(true);
|
||||
fBoxMPT->AddProperty(c, mpv);
|
||||
G4cout << "The MPT for the box is now: " << G4endl;
|
||||
fBoxMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddWorldMPV(const char* c,
|
||||
G4MaterialPropertyVector* mpv) {
|
||||
mpv->SetSpline(true);
|
||||
fWorldMPT->AddProperty(c, mpv);
|
||||
G4cout << "The MPT for the world is now: " << G4endl;
|
||||
fWorldMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddSurfaceMPV(const char* c,
|
||||
G4MaterialPropertyVector* mpv) {
|
||||
mpv->SetSpline(true);
|
||||
fSurfaceMPT->AddProperty(c, mpv);
|
||||
G4cout << "The MPT for the surface is now: " << G4endl;
|
||||
fSurfaceMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddBoxMPCV(const char* c, G4double v) {
|
||||
fBoxMPT->AddConstProperty(c, v);
|
||||
G4cout << "The MPT for the box is now: " << G4endl;
|
||||
fBoxMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void DetectorConstruction::AddWorldMPCV(const char* c, G4double v) {
|
||||
fWorldMPT->AddConstProperty(c, v);
|
||||
G4cout << "The MPT for the world is now: " << G4endl;
|
||||
fWorldMPT->DumpTable();
|
||||
G4cout << "............." << G4endl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,409 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/DetectorMessenger.cc
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
// $Id: DetectorMessenger.cc 77288 2013-11-22 10:52:58Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "G4OpticalSurface.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIparameter.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
:G4UImessenger(),fDetector(Det)
|
||||
{
|
||||
fOpticalDir = new G4UIdirectory("/opnovice2/");
|
||||
fOpticalDir->SetGuidance("Parameters for optical simulation.");
|
||||
|
||||
fSurfaceTypeCmd = new G4UIcmdWithAString("/opnovice2/surfaceType", this);
|
||||
fSurfaceTypeCmd->SetGuidance("Surface type.");
|
||||
fSurfaceTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSurfaceTypeCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSurfaceFinishCmd = new G4UIcmdWithAString("/opnovice2/surfaceFinish", this);
|
||||
fSurfaceFinishCmd->SetGuidance("Surface finish.");
|
||||
fSurfaceFinishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSurfaceFinishCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSurfaceModelCmd =
|
||||
new G4UIcmdWithAString("/opnovice2/surfaceModel", this);
|
||||
fSurfaceModelCmd->SetGuidance("surface model.");
|
||||
fSurfaceModelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSurfaceModelCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSurfaceSigmaAlphaCmd =
|
||||
new G4UIcmdWithADouble("/opnovice2/surfaceSigmaAlpha", this);
|
||||
fSurfaceSigmaAlphaCmd->SetGuidance("surface sigma alpha");
|
||||
fSurfaceSigmaAlphaCmd->SetGuidance(" parameter.");
|
||||
fSurfaceSigmaAlphaCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSurfaceSigmaAlphaCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSurfaceMatPropVectorCmd =
|
||||
new G4UIcmdWithAString("/opnovice2/surfaceProperty", this);
|
||||
fSurfaceMatPropVectorCmd->SetGuidance("Set material property vector");
|
||||
fSurfaceMatPropVectorCmd->SetGuidance(" for the surface.");
|
||||
fSurfaceMatPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSurfaceMatPropVectorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fBoxMatPropVectorCmd = new G4UIcmdWithAString("/opnovice2/boxProperty", this);
|
||||
fBoxMatPropVectorCmd->SetGuidance("Set material property vector for ");
|
||||
fBoxMatPropVectorCmd->SetGuidance("the box.");
|
||||
fBoxMatPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fBoxMatPropVectorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fBoxMatConstPropVectorCmd =
|
||||
new G4UIcmdWithAString("/opnovice2/boxConstProperty", this);
|
||||
fBoxMatConstPropVectorCmd->SetGuidance("Set material constant property ");
|
||||
fBoxMatConstPropVectorCmd->SetGuidance("for the box.");
|
||||
fBoxMatConstPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fBoxMatConstPropVectorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fWorldMatPropVectorCmd =
|
||||
new G4UIcmdWithAString("/opnovice2/worldProperty", this);
|
||||
fWorldMatPropVectorCmd->SetGuidance("Set material property vector ");
|
||||
fWorldMatPropVectorCmd->SetGuidance("for the world.");
|
||||
fWorldMatPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fWorldMatPropVectorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fWorldMatConstPropVectorCmd =
|
||||
new G4UIcmdWithAString("/opnovice2/worldConstProperty", this);
|
||||
fWorldMatConstPropVectorCmd->SetGuidance("Set material constant property");
|
||||
fWorldMatConstPropVectorCmd->SetGuidance(" for the world.");
|
||||
fWorldMatConstPropVectorCmd->
|
||||
AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fWorldMatConstPropVectorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete fSurfaceFinishCmd;
|
||||
delete fSurfaceTypeCmd;
|
||||
delete fSurfaceModelCmd;
|
||||
delete fSurfaceSigmaAlphaCmd;
|
||||
delete fSurfaceMatPropVectorCmd;
|
||||
delete fBoxMatPropVectorCmd;
|
||||
delete fBoxMatConstPropVectorCmd;
|
||||
delete fWorldMatPropVectorCmd;
|
||||
delete fWorldMatConstPropVectorCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
// FINISH
|
||||
if (command == fSurfaceFinishCmd) {
|
||||
if (newValue == "polished") {
|
||||
fDetector->SetSurfaceFinish(polished);
|
||||
}
|
||||
else if (newValue == "polishedfrontpainted") {
|
||||
fDetector->SetSurfaceFinish(polishedfrontpainted);
|
||||
}
|
||||
else if (newValue == "polishedbackpainted") {
|
||||
fDetector->SetSurfaceFinish(polishedbackpainted);
|
||||
}
|
||||
else if (newValue == "ground") {
|
||||
fDetector->SetSurfaceFinish(ground);
|
||||
}
|
||||
else if (newValue == "groundfrontpainted") {
|
||||
fDetector->SetSurfaceFinish(groundfrontpainted);
|
||||
}
|
||||
else if (newValue == "groundbackpainted") {
|
||||
fDetector->SetSurfaceFinish(groundbackpainted);
|
||||
}
|
||||
else if (newValue == "polishedlumirrorair") {
|
||||
fDetector->SetSurfaceFinish(polishedlumirrorair);
|
||||
}
|
||||
else if (newValue == "polishedlumirrorglue") {
|
||||
fDetector->SetSurfaceFinish(polishedlumirrorglue);
|
||||
}
|
||||
else if (newValue == "polishedair") {
|
||||
fDetector->SetSurfaceFinish(polishedair);
|
||||
}
|
||||
else if (newValue == "polishedteflonair") {
|
||||
fDetector->SetSurfaceFinish(polishedteflonair);
|
||||
}
|
||||
else if (newValue == "polishedtioair") {
|
||||
fDetector->SetSurfaceFinish(polishedtioair);
|
||||
}
|
||||
else if (newValue == "polishedtyvekair") {
|
||||
fDetector->SetSurfaceFinish(polishedtyvekair);
|
||||
}
|
||||
else if (newValue == "polishedvm2000air") {
|
||||
fDetector->SetSurfaceFinish(polishedvm2000air);
|
||||
}
|
||||
else if (newValue == "polishedvm2000glue") {
|
||||
fDetector->SetSurfaceFinish(polishedvm2000glue);
|
||||
}
|
||||
else if (newValue == "etchedlumirrorair") {
|
||||
fDetector->SetSurfaceFinish(etchedlumirrorair);
|
||||
}
|
||||
else if (newValue == "etchedlumirrorglue") {
|
||||
fDetector->SetSurfaceFinish(etchedlumirrorglue);
|
||||
}
|
||||
else if (newValue == "etchedair") {
|
||||
fDetector->SetSurfaceFinish(etchedair);
|
||||
}
|
||||
else if (newValue == "etchedteflonair") {
|
||||
fDetector->SetSurfaceFinish(etchedteflonair);
|
||||
}
|
||||
else if (newValue == "etchedtioair") {
|
||||
fDetector->SetSurfaceFinish(etchedtioair);
|
||||
}
|
||||
else if (newValue == "etchedtyvekair") {
|
||||
fDetector->SetSurfaceFinish(etchedtyvekair);
|
||||
}
|
||||
else if (newValue == "etchedvm2000air") {
|
||||
fDetector->SetSurfaceFinish(etchedvm2000air);
|
||||
}
|
||||
else if (newValue == "etchedvm2000glue") {
|
||||
fDetector->SetSurfaceFinish(etchedvm2000glue);
|
||||
}
|
||||
else if (newValue == "groundlumirrorair") {
|
||||
fDetector->SetSurfaceFinish(groundlumirrorair);
|
||||
}
|
||||
else if (newValue == "groundlumirrorglue") {
|
||||
fDetector->SetSurfaceFinish(groundlumirrorglue);
|
||||
}
|
||||
else if (newValue == "groundair") {
|
||||
fDetector->SetSurfaceFinish(groundair);
|
||||
}
|
||||
else if (newValue == "groundteflonair") {
|
||||
fDetector->SetSurfaceFinish(groundteflonair);
|
||||
}
|
||||
else if (newValue == "groundtioair") {
|
||||
fDetector->SetSurfaceFinish(groundtioair);
|
||||
}
|
||||
else if (newValue == "groundtyvekair") {
|
||||
fDetector->SetSurfaceFinish(groundtyvekair);
|
||||
}
|
||||
else if (newValue == "groundvm2000air") {
|
||||
fDetector->SetSurfaceFinish(groundvm2000air);
|
||||
}
|
||||
else if (newValue == "groundvm2000glue") {
|
||||
fDetector->SetSurfaceFinish(groundvm2000glue);
|
||||
}
|
||||
// for Davis model
|
||||
else if (newValue == "Rough_LUT") {
|
||||
fDetector->SetSurfaceFinish(Rough_LUT);
|
||||
}
|
||||
else if (newValue == "RoughTeflon_LUT") {
|
||||
fDetector->SetSurfaceFinish(RoughTeflon_LUT);
|
||||
}
|
||||
else if (newValue == "RoughESR_LUT") {
|
||||
fDetector->SetSurfaceFinish(RoughESR_LUT);
|
||||
}
|
||||
else if (newValue == "RoughESRGrease_LUT") {
|
||||
fDetector->SetSurfaceFinish(RoughESRGrease_LUT);
|
||||
}
|
||||
else if (newValue == "Polished_LUT") {
|
||||
fDetector->SetSurfaceFinish(Polished_LUT);
|
||||
}
|
||||
else if (newValue == "PolishedTeflon_LUT") {
|
||||
fDetector->SetSurfaceFinish(PolishedTeflon_LUT);
|
||||
}
|
||||
else if (newValue == "PolishedESR_LUT") {
|
||||
fDetector->SetSurfaceFinish(PolishedESR_LUT);
|
||||
}
|
||||
else if (newValue == "PolishedESRGrease_LUT") {
|
||||
fDetector->SetSurfaceFinish(PolishedESRGrease_LUT);
|
||||
}
|
||||
else if (newValue == "Detector_LUT") {
|
||||
fDetector->SetSurfaceFinish(Detector_LUT);
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid surface finish: " << newValue;
|
||||
G4Exception("DetectorMessenger", "OpNovice2_003", FatalException,ed);
|
||||
}
|
||||
}
|
||||
|
||||
// MODEL
|
||||
else if (command == fSurfaceModelCmd) {
|
||||
if (newValue == "glisur") {
|
||||
fDetector->SetSurfaceModel(glisur);
|
||||
}
|
||||
else if (newValue == "unified") {
|
||||
fDetector->SetSurfaceModel(unified);
|
||||
}
|
||||
else if (newValue == "LUT") {
|
||||
fDetector->SetSurfaceModel(LUT);
|
||||
}
|
||||
else if (newValue == "DAVIS") {
|
||||
fDetector->SetSurfaceModel(DAVIS);
|
||||
}
|
||||
else if (newValue == "dichroic") {
|
||||
fDetector->SetSurfaceModel(dichroic);
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid surface model: " << newValue;
|
||||
G4Exception("DetectorMessenger", "ONovice2_001",
|
||||
FatalException,ed);
|
||||
}
|
||||
}
|
||||
|
||||
// TYPE
|
||||
else if (command == fSurfaceTypeCmd) {
|
||||
if (newValue == "dielectric_metal") {
|
||||
fDetector->SetSurfaceType(dielectric_metal);
|
||||
}
|
||||
else if (newValue == "dielectric_dielectric") {
|
||||
fDetector->SetSurfaceType(dielectric_dielectric);
|
||||
}
|
||||
else if (newValue == "dielectric_LUT") {
|
||||
fDetector->SetSurfaceType(dielectric_LUT);
|
||||
}
|
||||
else if (newValue == "dielectric_LUTDAVIS") {
|
||||
fDetector->SetSurfaceType(dielectric_LUTDAVIS);
|
||||
}
|
||||
else {
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Invalid surface type: " << newValue;
|
||||
G4Exception("DetectorMessenger", "OpNovice2_002", FatalException,ed);
|
||||
}
|
||||
}
|
||||
else if (command == fSurfaceSigmaAlphaCmd) {
|
||||
fDetector->SetSurfaceSigmaAlpha(
|
||||
G4UIcmdWithADouble::GetNewDoubleValue(newValue));
|
||||
}
|
||||
else if (command == fBoxMatPropVectorCmd) {
|
||||
// got a string. need to convert it to physics vector.
|
||||
// string format is property name, then pairs of energy, value
|
||||
// specify units for each value, eg 3.0*eV
|
||||
// space delimited
|
||||
G4MaterialPropertyVector* mpv = new G4MaterialPropertyVector();
|
||||
mpv->SetSpline(true);
|
||||
std::istringstream instring(newValue);
|
||||
G4String prop;
|
||||
instring >> prop;
|
||||
while (instring) {
|
||||
G4String tmp;
|
||||
instring >> tmp;
|
||||
if (tmp == "") { break; }
|
||||
G4double en = G4UIcommand::ConvertToDouble(tmp);
|
||||
instring >> tmp;
|
||||
G4double val;
|
||||
val = G4UIcommand::ConvertToDouble(tmp);
|
||||
mpv->InsertValues(en, val);
|
||||
}
|
||||
const char* c = prop.c_str();
|
||||
|
||||
fDetector->AddBoxMPV(c, mpv);
|
||||
}
|
||||
else if (command == fWorldMatPropVectorCmd) {
|
||||
// Convert string to physics vector
|
||||
// string format is property name, then pairs of energy, value
|
||||
G4MaterialPropertyVector* mpv = new G4MaterialPropertyVector();
|
||||
std::istringstream instring(newValue);
|
||||
G4String prop;
|
||||
instring >> prop;
|
||||
while (instring) {
|
||||
G4String tmp;
|
||||
instring >> tmp;
|
||||
if (tmp == "") { break; }
|
||||
G4double en = G4UIcommand::ConvertToDouble(tmp);
|
||||
instring >> tmp;
|
||||
G4double val;
|
||||
val = G4UIcommand::ConvertToDouble(tmp);
|
||||
mpv->InsertValues(en, val);
|
||||
}
|
||||
const char* c = prop.c_str();
|
||||
fDetector->AddWorldMPV(c, mpv);
|
||||
}
|
||||
else if (command == fSurfaceMatPropVectorCmd) {
|
||||
// Convert string to physics vector
|
||||
// string format is property name, then pairs of energy, value
|
||||
// space delimited
|
||||
G4MaterialPropertyVector* mpv = new G4MaterialPropertyVector();
|
||||
G4cout << newValue << G4endl;
|
||||
std::istringstream instring(newValue);
|
||||
G4String prop;
|
||||
instring >> prop;
|
||||
while (instring) {
|
||||
G4String tmp;
|
||||
instring >> tmp;
|
||||
if (tmp == "") { break; }
|
||||
G4double en = G4UIcommand::ConvertToDouble(tmp);
|
||||
instring >> tmp;
|
||||
G4double val;
|
||||
val = G4UIcommand::ConvertToDouble(tmp);
|
||||
mpv->InsertValues(en, val);
|
||||
}
|
||||
const char* c = prop.c_str();
|
||||
fDetector->AddSurfaceMPV(c, mpv);
|
||||
}
|
||||
|
||||
else if (command == fBoxMatConstPropVectorCmd) {
|
||||
// Convert string to physics vector
|
||||
// string format is property name, then value
|
||||
// space delimited
|
||||
std::istringstream instring(newValue);
|
||||
G4String prop;
|
||||
G4String tmp;
|
||||
instring >> prop;
|
||||
instring >> tmp;
|
||||
G4double val = G4UIcommand::ConvertToDouble(tmp);
|
||||
const char* c = prop.c_str();
|
||||
fDetector->AddBoxMPCV(c, val);
|
||||
}
|
||||
else if (command == fWorldMatConstPropVectorCmd) {
|
||||
// Convert string to physics vector
|
||||
// string format is property name, then value
|
||||
// space delimited
|
||||
std::istringstream instring(newValue);
|
||||
G4String prop;
|
||||
G4String tmp;
|
||||
instring >> prop;
|
||||
instring >> tmp;
|
||||
G4double val = G4UIcommand::ConvertToDouble(tmp);
|
||||
const char* c = prop.c_str();
|
||||
fDetector->AddBoxMPCV(c, val);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/HistoManager.cc
|
||||
/// \brief Implementation of the HistoManager class
|
||||
//
|
||||
//
|
||||
// $Id: HistoManager.cc 104417 2017-05-30 08:30:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "HistoManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::HistoManager()
|
||||
: fFileName("opnovice2")
|
||||
{
|
||||
Book();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
HistoManager::~HistoManager()
|
||||
{
|
||||
delete G4AnalysisManager::Instance();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void HistoManager::Book()
|
||||
{
|
||||
// Create or get analysis manager
|
||||
// The choice of analysis technology is done via selection of a namespace
|
||||
// in HistoManager.hh
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
analysisManager->SetFileName(fFileName);
|
||||
analysisManager->SetVerboseLevel(1);
|
||||
analysisManager->SetActivation(true); // enable inactivation of histograms
|
||||
|
||||
// Define histogram indices, titles
|
||||
G4int maxHisto = 12;
|
||||
G4String id[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
|
||||
"10","11","12" };
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
// Default values (to be reset via /analysis/h1/set command)
|
||||
G4int nbins = 100;
|
||||
G4double vmin = 0.;
|
||||
G4double vmax = 100.;
|
||||
|
||||
// Create all histograms as inactivated
|
||||
for (G4int k=0; k <= maxHisto; ++k) {
|
||||
G4int ih = analysisManager->CreateH1(id[k], title[k], nbins, vmin, vmax);
|
||||
analysisManager->SetH1Activation(ih, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
//create a messenger for this class
|
||||
fGunMessenger = new PrimaryGeneratorMessenger(this);
|
||||
|
||||
//default kinematic
|
||||
//
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("e+");
|
||||
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleTime(0.0*ns);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.0*cm,0.0*cm,0.0*cm));
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(500.0*keV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
delete fGunMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::SetOptPhotonPolar()
|
||||
{
|
||||
G4double angle = G4UniformRand() * 360.0*deg;
|
||||
SetOptPhotonPolar(angle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorAction::SetOptPhotonPolar(G4double angle)
|
||||
{
|
||||
if (fParticleGun->GetParticleDefinition()->GetParticleName()!="opticalphoton")
|
||||
{
|
||||
G4cout << "--> warning from PrimaryGeneratorAction::SetOptPhotonPolar() :"
|
||||
"the particleGun is not an opticalphoton" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4ThreeVector normal (1., 0., 0.);
|
||||
G4ThreeVector kphoton = fParticleGun->GetParticleMomentumDirection();
|
||||
G4ThreeVector product = normal.cross(kphoton);
|
||||
G4double modul2 = product*product;
|
||||
|
||||
G4ThreeVector e_perpend (0., 0., 1.);
|
||||
if (modul2 > 0.) e_perpend = (1./std::sqrt(modul2))*product;
|
||||
G4ThreeVector e_paralle = e_perpend.cross(kphoton);
|
||||
|
||||
G4ThreeVector polar = std::cos(angle)*e_paralle + std::sin(angle)*e_perpend;
|
||||
fParticleGun->SetParticlePolarization(polar);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/PrimaryGeneratorMessenger.cc
|
||||
/// \brief Implementation of the PrimaryGeneratorMessenger class
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorMessenger::
|
||||
PrimaryGeneratorMessenger(PrimaryGeneratorAction* Gun)
|
||||
: G4UImessenger(),
|
||||
fPrimaryAction(Gun)
|
||||
{
|
||||
fGunDir = new G4UIdirectory("/opnovice2/gun/");
|
||||
fGunDir->SetGuidance("PrimaryGenerator control");
|
||||
|
||||
fPolarCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/opnovice2/gun/optPhotonPolar",this);
|
||||
fPolarCmd->SetGuidance("Set linear polarization");
|
||||
fPolarCmd->SetGuidance(" angle w.r.t. (k,n) plane");
|
||||
fPolarCmd->SetParameterName("angle",true);
|
||||
fPolarCmd->SetUnitCategory("Angle");
|
||||
fPolarCmd->SetDefaultValue(-360.0);
|
||||
fPolarCmd->SetDefaultUnit("deg");
|
||||
fPolarCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
|
||||
{
|
||||
delete fPolarCmd;
|
||||
delete fGunDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PrimaryGeneratorMessenger::SetNewValue(
|
||||
G4UIcommand* command, G4String newValue)
|
||||
{
|
||||
if (command == fPolarCmd) {
|
||||
G4double angle = fPolarCmd->GetNewDoubleValue(newValue);
|
||||
if (angle == -360.0*deg) {
|
||||
fPrimaryAction->SetOptPhotonPolar();
|
||||
} else {
|
||||
fPrimaryAction->SetOptPhotonPolar(angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/Run.cc
|
||||
/// \brief Implementation of the Run class
|
||||
//
|
||||
// $Id: Run.cc 71376 2013-06-14 07:44:50Z maire $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include <numeric>
|
||||
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4OpBoundaryProcess.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Run::Run()
|
||||
: G4Run()
|
||||
{
|
||||
fParticle = nullptr;
|
||||
fEkin = -1.;
|
||||
|
||||
fCerenkovEnergy = 0.0;
|
||||
fScintEnergy = 0.0;
|
||||
|
||||
fCerenkovCount = 0;
|
||||
fScintCount = 0;
|
||||
fRayleighCount = 0;
|
||||
|
||||
fOpAbsorption = 0;
|
||||
fOpAbsorptionPrior = 0;
|
||||
|
||||
fTotalSurface = 0;
|
||||
|
||||
fBoundaryProcs.clear();
|
||||
fBoundaryProcs.resize(40);
|
||||
for (G4int i = 0; i < 40; ++i) {
|
||||
fBoundaryProcs[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
Run::~Run()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void Run::SetPrimary(G4ParticleDefinition* particle, G4double energy)
|
||||
{
|
||||
fParticle = particle;
|
||||
fEkin = energy;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void Run::Merge(const G4Run* run)
|
||||
{
|
||||
const Run* localRun = static_cast<const Run*>(run);
|
||||
|
||||
// pass information about primary particle
|
||||
fParticle = localRun->fParticle;
|
||||
fEkin = localRun->fEkin;
|
||||
|
||||
fCerenkovEnergy += localRun->fCerenkovEnergy;
|
||||
fScintEnergy += localRun->fScintEnergy;
|
||||
|
||||
fCerenkovCount += localRun->fCerenkovCount;
|
||||
fScintCount += localRun->fScintCount;
|
||||
fRayleighCount += localRun->fRayleighCount;
|
||||
|
||||
fTotalSurface += localRun->fTotalSurface;
|
||||
|
||||
fOpAbsorption += localRun->fOpAbsorption;
|
||||
fOpAbsorptionPrior += localRun->fOpAbsorptionPrior;
|
||||
|
||||
for (size_t i = 0; i < fBoundaryProcs.size(); ++i) {
|
||||
fBoundaryProcs[i] += localRun->fBoundaryProcs[i];
|
||||
}
|
||||
|
||||
G4Run::Merge(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void Run::EndOfRun()
|
||||
{
|
||||
G4int TotNbofEvents = numberOfEvent;
|
||||
if (TotNbofEvents == 0) return;
|
||||
|
||||
std::ios::fmtflags mode = G4cout.flags();
|
||||
G4int prec = G4cout.precision(2);
|
||||
|
||||
G4cout << "\n Run Summary\n";
|
||||
G4cout << "---------------------------------\n";
|
||||
G4cout << "Primary particle was: " << fParticle->GetParticleName()
|
||||
<< " with energy " << G4BestUnit(fEkin, "Energy") << "." << G4endl;
|
||||
|
||||
if (fParticle->GetParticleName() != "opticalphoton") {
|
||||
G4cout << "Average energy of Cerenkov photons created per event: "
|
||||
<< (fCerenkovEnergy/eV)/TotNbofEvents << " eV." << G4endl;
|
||||
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 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 number of OpRayleigh scatters per event: "
|
||||
<< fRayleighCount/TotNbofEvents << G4endl;
|
||||
G4cout << "\n";
|
||||
}
|
||||
G4cout << "OpAbsorption per event: " << fOpAbsorption/TotNbofEvents
|
||||
<< G4endl;
|
||||
G4cout << "\nSurface events (on +X surface) this run:" << G4endl;
|
||||
G4cout << "# of primary particles: " << std::setw(8) << TotNbofEvents
|
||||
<< G4endl;
|
||||
G4cout << "OpAbsorption before surface: " << std::setw(8)
|
||||
<< fOpAbsorptionPrior << G4endl;
|
||||
G4cout << "Total # of surface events: " << std::setw(8) << fTotalSurface
|
||||
<< G4endl;
|
||||
if (fParticle->GetParticleName() == "opticalphoton") {
|
||||
G4cout << "Unaccounted for: " << std::setw(8)
|
||||
<< fTotalSurface + fOpAbsorptionPrior - TotNbofEvents << G4endl;
|
||||
}
|
||||
G4cout << "\nSurface events by process:" << G4endl;
|
||||
if (fBoundaryProcs[Transmission] > 0) {
|
||||
G4cout << " Transmission: " << std::setw(8)
|
||||
<< fBoundaryProcs[Transmission] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[FresnelRefraction] > 0) {
|
||||
G4cout << " Fresnel refraction: " << std::setw(8)
|
||||
<< fBoundaryProcs[FresnelRefraction] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[FresnelReflection] > 0) {
|
||||
G4cout << " Fresnel reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[FresnelReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[TotalInternalReflection] > 0) {
|
||||
G4cout << " Total internal reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[TotalInternalReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[LambertianReflection] > 0) {
|
||||
G4cout << " Lambertian reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[LambertianReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[LobeReflection] > 0) {
|
||||
G4cout << " Lobe reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[LobeReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[SpikeReflection] > 0) {
|
||||
G4cout << " Spike reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[SpikeReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[BackScattering] > 0) {
|
||||
G4cout << " Backscattering: " << std::setw(8)
|
||||
<< fBoundaryProcs[BackScattering] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[Absorption] > 0) {
|
||||
G4cout << " Absorption: " << std::setw(8)
|
||||
<< fBoundaryProcs[Absorption] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[Detection] > 0) {
|
||||
G4cout << " Detection: " << std::setw(8)
|
||||
<< fBoundaryProcs[Detection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[NotAtBoundary] > 0) {
|
||||
G4cout << " Not at boundary: " << std::setw(8)
|
||||
<< fBoundaryProcs[NotAtBoundary] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[SameMaterial] > 0) {
|
||||
G4cout << " Same material: " << std::setw(8)
|
||||
<< fBoundaryProcs[SameMaterial] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[StepTooSmall] > 0) {
|
||||
G4cout << " Step too small: " << std::setw(8)
|
||||
<< fBoundaryProcs[StepTooSmall] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[NoRINDEX] > 0) {
|
||||
G4cout << " No RINDEX: " << std::setw(8)
|
||||
<< fBoundaryProcs[NoRINDEX] << G4endl;
|
||||
}
|
||||
// LBNL polished
|
||||
if (fBoundaryProcs[PolishedLumirrorAirReflection] > 0) {
|
||||
G4cout << " Polished Lumirror Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedLumirrorAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedLumirrorGlueReflection] > 0) {
|
||||
G4cout << " Polished Lumirror Glue reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedLumirrorGlueReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedAirReflection] > 0) {
|
||||
G4cout << " Polished Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedTeflonAirReflection] > 0) {
|
||||
G4cout << " Polished Teflon Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedTeflonAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedTiOAirReflection] > 0) {
|
||||
G4cout << " Polished TiO Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedTiOAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedTyvekAirReflection] > 0) {
|
||||
G4cout << " Polished Tyvek Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedTyvekAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedVM2000AirReflection] > 0) {
|
||||
G4cout << " Polished VM2000 Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedVM2000AirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[PolishedVM2000GlueReflection] > 0) {
|
||||
G4cout << " Polished VM2000 Glue reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[PolishedVM2000GlueReflection] << G4endl;
|
||||
}
|
||||
// LBNL etched
|
||||
if (fBoundaryProcs[EtchedLumirrorAirReflection] > 0) {
|
||||
G4cout << " Etched Lumirror Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedLumirrorAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedLumirrorGlueReflection] > 0) {
|
||||
G4cout << " Etched Lumirror Glue reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedLumirrorGlueReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedAirReflection] > 0) {
|
||||
G4cout << " Etched Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedTeflonAirReflection] > 0) {
|
||||
G4cout << " Etched Teflon Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedTeflonAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedTiOAirReflection] > 0) {
|
||||
G4cout << " Etched TiO Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedTiOAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedTyvekAirReflection] > 0) {
|
||||
G4cout << " Etched Tyvek Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedTyvekAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedVM2000AirReflection] > 0) {
|
||||
G4cout << " Etched VM2000 Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedVM2000AirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[EtchedVM2000GlueReflection] > 0) {
|
||||
G4cout << " Etched VM2000 Glue reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[EtchedVM2000GlueReflection] << G4endl;
|
||||
}
|
||||
// LBNL ground
|
||||
if (fBoundaryProcs[GroundLumirrorAirReflection] > 0) {
|
||||
G4cout << " Ground Lumirror Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundLumirrorAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundLumirrorGlueReflection] > 0) {
|
||||
G4cout << " Ground Lumirror Glue reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundLumirrorGlueReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundAirReflection] > 0) {
|
||||
G4cout << " Ground Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundTeflonAirReflection] > 0) {
|
||||
G4cout << " Ground Teflon Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundTeflonAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundTiOAirReflection] > 0) {
|
||||
G4cout << " Ground TiO Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundTiOAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundTyvekAirReflection] > 0) {
|
||||
G4cout << " Ground Tyvek Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundTyvekAirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundVM2000AirReflection] > 0) {
|
||||
G4cout << " Ground VM2000 Air reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundVM2000AirReflection] << G4endl;
|
||||
}
|
||||
if (fBoundaryProcs[GroundVM2000GlueReflection] > 0) {
|
||||
G4cout << " Ground VM2000 Glue reflection: " << std::setw(8)
|
||||
<< fBoundaryProcs[GroundVM2000GlueReflection] << G4endl;
|
||||
}
|
||||
|
||||
G4int sum = std::accumulate(fBoundaryProcs.begin(), fBoundaryProcs.end(), 0);
|
||||
G4cout << " Sum: " << std::setw(8) << sum << G4endl;
|
||||
G4cout << " Unaccounted for: " << std::setw(8)
|
||||
<< fTotalSurface - sum << G4endl;
|
||||
|
||||
G4cout << "---------------------------------\n";
|
||||
|
||||
G4cout.setf(mode, std::ios::floatfield);
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Make this appear first!
|
||||
#include "G4Timer.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "Run.hh"
|
||||
#include "G4Run.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(PrimaryGeneratorAction* prim)
|
||||
: G4UserRunAction(),
|
||||
fTimer(nullptr),
|
||||
fRun(nullptr),
|
||||
fHistoManager(nullptr),
|
||||
fPrimary(prim)
|
||||
{
|
||||
fTimer = new G4Timer;
|
||||
fHistoManager = new HistoManager();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::~RunAction()
|
||||
{
|
||||
delete fTimer;
|
||||
delete fHistoManager;
|
||||
}
|
||||
|
||||
G4Run* RunAction::GenerateRun()
|
||||
{
|
||||
fRun = new Run();
|
||||
return fRun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
if (fPrimary) {
|
||||
G4ParticleDefinition* particle =
|
||||
fPrimary->GetParticleGun()->GetParticleDefinition();
|
||||
G4double energy = fPrimary->GetParticleGun()->GetParticleEnergy();
|
||||
fRun->SetPrimary(particle, energy);
|
||||
}
|
||||
|
||||
//histograms
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if (analysisManager->IsActive()) {
|
||||
analysisManager->OpenFile();
|
||||
}
|
||||
|
||||
fTimer->Start();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
fTimer->Stop();
|
||||
G4cout << "number of event = " << aRun->GetNumberOfEvent()
|
||||
<< " " << *fTimer << G4endl;
|
||||
|
||||
if (isMaster) fRun->EndOfRun();
|
||||
|
||||
// save histograms
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
if (analysisManager->IsActive()) {
|
||||
analysisManager->Write();
|
||||
analysisManager->CloseFile();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,298 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: SteppingAction.cc 71007 2013-06-09 16:14:59Z maire $
|
||||
//
|
||||
/// \file optical/OpNovice2/src/SteppingAction.cc
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
//#include "EventAction.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "TrackInformation.hh"
|
||||
#include "Run.hh"
|
||||
|
||||
#include "G4Cerenkov.hh"
|
||||
#include "G4Scintillation.hh"
|
||||
#include "G4OpBoundaryProcess.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
SteppingAction::SteppingAction()
|
||||
: G4UserSteppingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
SteppingAction::~SteppingAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void SteppingAction::UserSteppingAction(const G4Step* step)
|
||||
{
|
||||
static G4ParticleDefinition* opticalphoton =
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
static G4AnalysisManager* analysisMan = G4AnalysisManager::Instance();
|
||||
Run* run = static_cast<Run*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
G4Track* track = step->GetTrack();
|
||||
G4StepPoint* endPoint = step->GetPostStepPoint();
|
||||
G4StepPoint* startPoint = step->GetPreStepPoint();
|
||||
|
||||
G4String particleName = track->GetDynamicParticle()->
|
||||
GetParticleDefinition()->GetParticleName();
|
||||
|
||||
TrackInformation* trackInfo =
|
||||
(TrackInformation*)(track->GetUserInformation());
|
||||
|
||||
if (particleName == "opticalphoton") {
|
||||
const G4VProcess* pds = endPoint->GetProcessDefinedStep();
|
||||
if (pds->GetProcessName() == "OpAbsorption") {
|
||||
run->AddOpAbsorption();
|
||||
if (trackInfo->GetIsFirstTankX()) {
|
||||
run->AddOpAbsorptionPrior();
|
||||
}
|
||||
}
|
||||
else if (pds->GetProcessName() == "OpRayleigh") {
|
||||
run->AddRayleigh();
|
||||
}
|
||||
|
||||
// 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();
|
||||
G4int MAXofPostStepLoops =
|
||||
OpManager->GetPostStepProcessVector()->entries();
|
||||
G4ProcessVector* postStepDoItVector =
|
||||
OpManager->GetPostStepProcessVector(typeDoIt);
|
||||
|
||||
if (trackInfo->GetIsFirstTankX()) {
|
||||
G4ThreeVector momdir = endPoint->GetMomentumDirection();
|
||||
G4double px1 = momdir.x();
|
||||
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);
|
||||
}
|
||||
|
||||
trackInfo->SetIsFirstTankX(false);
|
||||
run->AddTotalSurface();
|
||||
|
||||
for (G4int i=0; i<MAXofPostStepLoops; ++i) {
|
||||
G4VProcess* currentProcess = (*postStepDoItVector)[i];
|
||||
|
||||
G4OpBoundaryProcess* opProc =
|
||||
dynamic_cast<G4OpBoundaryProcess*>(currentProcess);
|
||||
if (opProc) {
|
||||
theStatus = opProc->GetStatus();
|
||||
analysisMan->FillH1(3, theStatus);
|
||||
if (theStatus == Transmission) {
|
||||
run->AddTransmission();
|
||||
}
|
||||
else if (theStatus == FresnelRefraction) {
|
||||
run->AddFresnelRefraction();
|
||||
analysisMan->FillH1(10, px1);
|
||||
analysisMan->FillH1(11, py1);
|
||||
analysisMan->FillH1(12, pz1);
|
||||
}
|
||||
else if (theStatus == FresnelReflection) {
|
||||
run->AddFresnelReflection();
|
||||
}
|
||||
else if (theStatus == TotalInternalReflection) {
|
||||
run->AddTotalInternalReflection();
|
||||
}
|
||||
else if (theStatus == LambertianReflection) {
|
||||
run->AddLambertianReflection();
|
||||
}
|
||||
else if (theStatus == LobeReflection) {
|
||||
run->AddLobeReflection();
|
||||
}
|
||||
else if (theStatus == SpikeReflection) {
|
||||
run->AddSpikeReflection();
|
||||
}
|
||||
else if (theStatus == BackScattering) {
|
||||
run->AddBackScattering();
|
||||
}
|
||||
else if (theStatus == Absorption) {
|
||||
run->AddAbsorption();
|
||||
}
|
||||
else if (theStatus == Detection) {
|
||||
run->AddDetection();
|
||||
}
|
||||
else if (theStatus == NotAtBoundary) {
|
||||
run->AddNotAtBoundary();
|
||||
}
|
||||
else if (theStatus == SameMaterial) {
|
||||
run->AddSameMaterial();
|
||||
}
|
||||
else if (theStatus == StepTooSmall) {
|
||||
run->AddStepTooSmall();
|
||||
}
|
||||
else if (theStatus == NoRINDEX) {
|
||||
run->AddNoRINDEX();
|
||||
}
|
||||
else if (theStatus == PolishedLumirrorAirReflection) {
|
||||
run->AddPolishedLumirrorAirReflection();
|
||||
}
|
||||
else if (theStatus == PolishedLumirrorGlueReflection) {
|
||||
run->AddPolishedLumirrorGlueReflection();
|
||||
}
|
||||
else if (theStatus == PolishedAirReflection) {
|
||||
run->AddPolishedAirReflection();
|
||||
}
|
||||
else if (theStatus == PolishedTeflonAirReflection) {
|
||||
run->AddPolishedTeflonAirReflection();
|
||||
}
|
||||
else if (theStatus == PolishedTiOAirReflection) {
|
||||
run->AddPolishedTiOAirReflection();
|
||||
}
|
||||
else if (theStatus == PolishedTyvekAirReflection) {
|
||||
run->AddPolishedTyvekAirReflection();
|
||||
}
|
||||
else if (theStatus == PolishedVM2000AirReflection) {
|
||||
run->AddPolishedVM2000AirReflection();
|
||||
}
|
||||
else if (theStatus == PolishedVM2000GlueReflection) {
|
||||
run->AddPolishedVM2000AirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedLumirrorAirReflection) {
|
||||
run->AddEtchedLumirrorAirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedLumirrorGlueReflection) {
|
||||
run->AddEtchedLumirrorGlueReflection();
|
||||
}
|
||||
else if (theStatus == EtchedAirReflection) {
|
||||
run->AddEtchedAirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedTeflonAirReflection) {
|
||||
run->AddEtchedTeflonAirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedTiOAirReflection) {
|
||||
run->AddEtchedTiOAirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedTyvekAirReflection) {
|
||||
run->AddEtchedTyvekAirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedVM2000AirReflection) {
|
||||
run->AddEtchedVM2000AirReflection();
|
||||
}
|
||||
else if (theStatus == EtchedVM2000GlueReflection) {
|
||||
run->AddEtchedVM2000AirReflection();
|
||||
}
|
||||
else if (theStatus == GroundLumirrorAirReflection) {
|
||||
run->AddGroundLumirrorAirReflection();
|
||||
}
|
||||
else if (theStatus == GroundLumirrorGlueReflection) {
|
||||
run->AddGroundLumirrorGlueReflection();
|
||||
}
|
||||
else if (theStatus == GroundAirReflection) {
|
||||
run->AddGroundAirReflection();
|
||||
}
|
||||
else if (theStatus == GroundTeflonAirReflection) {
|
||||
run->AddGroundTeflonAirReflection();
|
||||
}
|
||||
else if (theStatus == GroundTiOAirReflection) {
|
||||
run->AddGroundTiOAirReflection();
|
||||
}
|
||||
else if (theStatus == GroundTyvekAirReflection) {
|
||||
run->AddGroundTyvekAirReflection();
|
||||
}
|
||||
else if (theStatus == GroundVM2000AirReflection) {
|
||||
run->AddGroundVM2000AirReflection();
|
||||
}
|
||||
else if (theStatus == GroundVM2000GlueReflection) {
|
||||
run->AddGroundVM2000AirReflection();
|
||||
}
|
||||
else if (theStatus == Dichroic) {
|
||||
run->AddDichroic();
|
||||
}
|
||||
|
||||
else {
|
||||
G4cout << "theStatus: " << theStatus
|
||||
<< " was none of the above." << G4endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else { // particle != opticalphoton
|
||||
const std::vector<const G4Track*>* secondaries =
|
||||
step->GetSecondaryInCurrentStep();
|
||||
|
||||
for (auto sec : *secondaries) {
|
||||
if (sec->GetDynamicParticle()->GetParticleDefinition() == opticalphoton){
|
||||
if (sec->GetCreatorProcess()->GetProcessName().compare("Cerenkov")==0){
|
||||
G4double en = sec->GetKineticEnergy();
|
||||
run->AddCerenkovEnergy(en);
|
||||
run->AddCerenkov();
|
||||
G4AnalysisManager::Instance()->FillH1(1, en);
|
||||
}
|
||||
else if (sec->GetCreatorProcess()
|
||||
->GetProcessName().compare("Scintillation") == 0) {
|
||||
G4double en = sec->GetKineticEnergy();
|
||||
run->AddScintillationEnergy(en);
|
||||
run->AddScintillation();
|
||||
G4AnalysisManager::Instance()->FillH1(2, en);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/TrackInformation.cc
|
||||
/// \brief Implementation of the TrackInformation class
|
||||
//
|
||||
//
|
||||
// $Id: TrackInformation.cc 97671 2016-06-07 08:25:00Z gcosmo $
|
||||
//
|
||||
|
||||
#include "TrackInformation.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<TrackInformation> *
|
||||
aTrackInformationAllocator = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
TrackInformation::TrackInformation()
|
||||
: G4VUserTrackInformation()
|
||||
{
|
||||
fFirstTankX = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
TrackInformation::TrackInformation(const G4Track*)
|
||||
: G4VUserTrackInformation()
|
||||
{
|
||||
fFirstTankX = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
TrackInformation ::TrackInformation(const TrackInformation* aTrackInfo)
|
||||
: G4VUserTrackInformation()
|
||||
{
|
||||
fFirstTankX = aTrackInfo->fFirstTankX;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
TrackInformation::~TrackInformation()
|
||||
{;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
TrackInformation& TrackInformation::operator=
|
||||
(const TrackInformation& aTrackInfo)
|
||||
{
|
||||
fFirstTankX = aTrackInfo.fFirstTankX;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void TrackInformation::SetSourceTrackInformation(const G4Track*)
|
||||
{
|
||||
fFirstTankX = true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void TrackInformation::Print() const
|
||||
{
|
||||
G4cout
|
||||
<< "first time track incident on X: " << fFirstTankX << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
/// \file optical/OpNovice2/src/TrackingAction.cc
|
||||
/// \brief Implementation of the TrackingAction class
|
||||
//
|
||||
// $Id: TrackingAction.cc 66379 2012-12-18 09:46:33Z gcosmo $
|
||||
//
|
||||
|
||||
#include "TrackingAction.hh"
|
||||
#include "TrackInformation.hh"
|
||||
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
TrackingAction::TrackingAction()
|
||||
:G4UserTrackingAction()
|
||||
{;}
|
||||
|
||||
void TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
// Create trajectory only for track in tracking region
|
||||
TrackInformation* trackInfo =
|
||||
(TrackInformation*)(aTrack->GetUserInformation());
|
||||
|
||||
if (!trackInfo) {
|
||||
trackInfo = new TrackInformation(aTrack);
|
||||
trackInfo->SetIsFirstTankX(true);
|
||||
aTrack->SetUserInformation(trackInfo);
|
||||
}
|
||||
|
||||
trackInfo->SetIsFirstTankX(true);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void TrackingAction::PostUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
G4TrackVector* secondaries = fpTrackingManager->GimmeSecondaries();
|
||||
if (secondaries)
|
||||
{
|
||||
TrackInformation* info =
|
||||
(TrackInformation*)(aTrack->GetUserInformation());
|
||||
size_t nSeco = secondaries->size();
|
||||
if (nSeco > 0)
|
||||
{
|
||||
for(size_t i=0; i < nSeco; i++)
|
||||
{
|
||||
TrackInformation* infoNew = new TrackInformation(info);
|
||||
(*secondaries)[i]->SetUserInformation(infoNew);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user