Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 ActionInitialization.cc
|
||||
/// \brief Implementation of the ActionInitialization class
|
||||
|
||||
#include "ActionInitialization.hh"
|
||||
#include "HistoManager.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::ActionInitialization(DetectorConstruction* detector)
|
||||
: G4VUserActionInitialization(),
|
||||
fDetector(detector)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ActionInitialization::~ActionInitialization()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
// Histo manager
|
||||
HistoManager* histo = new HistoManager();
|
||||
|
||||
// Actions
|
||||
SetUserAction(new RunAction(histo));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ActionInitialization::Build() const
|
||||
{
|
||||
// Histo manager
|
||||
HistoManager* histo = new HistoManager();
|
||||
|
||||
// Actions
|
||||
//
|
||||
SetUserAction(new PrimaryGeneratorAction(fDetector));
|
||||
|
||||
RunAction* runAction = new RunAction(histo);
|
||||
SetUserAction(runAction);
|
||||
|
||||
EventAction* eventAction = new EventAction(runAction, histo);
|
||||
SetUserAction(eventAction);
|
||||
|
||||
SteppingAction* steppingAction = new SteppingAction(fDetector, eventAction);
|
||||
SetUserAction(steppingAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: DetectorConstruction.cc 77256 2013-11-22 10:10:23Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -53,16 +53,19 @@
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
:fAbsorberMaterial(0),fGapMaterial(0),fDefaultMaterial(0),
|
||||
:G4VUserDetectorConstruction(),
|
||||
fAbsorberMaterial(0),fGapMaterial(0),fDefaultMaterial(0),
|
||||
fSolidWorld(0),fLogicWorld(0),fPhysiWorld(0),
|
||||
fSolidCalor(0),fLogicCalor(0),fPhysiCalor(0),
|
||||
fSolidLayer(0),fLogicLayer(0),fPhysiLayer(0),
|
||||
fSolidAbsorber(0),fLogicAbsorber(0),fPhysiAbsorber(0),
|
||||
fSolidGap (0),fLogicGap (0),fPhysiGap (0)
|
||||
fSolidGap (0),fLogicGap (0),fPhysiGap (0),
|
||||
fDetectorMessenger(0)
|
||||
{
|
||||
// default parameter values of the calorimeter
|
||||
fAbsorberThickness = 10.*mm;
|
||||
@@ -135,10 +138,10 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
fPhysiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicWorld, //its logical volume
|
||||
fLogicWorld, //its logical volume
|
||||
"World", //its name
|
||||
0, //its mother volume
|
||||
false, //no boolean operation
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
@@ -149,7 +152,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
if (fCalorThickness > 0.)
|
||||
{ fSolidCalor = new G4Box("Calorimeter", //its name
|
||||
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);//size
|
||||
fCalorThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);//size
|
||||
|
||||
fLogicCalor = new G4LogicalVolume(fSolidCalor, //its solid
|
||||
fDefaultMaterial, //its material
|
||||
@@ -160,7 +163,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
fLogicCalor, //its logical volume
|
||||
"Calorimeter", //its name
|
||||
fLogicWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
//
|
||||
@@ -176,16 +179,16 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
fPhysiLayer = new G4PVReplica("Layer", //its name
|
||||
fLogicLayer, //its logical volume
|
||||
fLogicCalor, //its mother
|
||||
kXAxis, //axis of replication
|
||||
kXAxis, //axis of replication
|
||||
fNbOfLayers, //number of replica
|
||||
fLayerThickness); //witdth of replica
|
||||
else
|
||||
fPhysiLayer = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
fLogicLayer, //its logical volume
|
||||
fLogicLayer, //its logical volume
|
||||
"Layer", //its name
|
||||
fLogicCalor, //its mother volume
|
||||
false, //no boolean operation
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
}
|
||||
|
||||
@@ -199,15 +202,15 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
fAbsorberThickness/2,fCalorSizeYZ/2,fCalorSizeYZ/2);
|
||||
|
||||
fLogicAbsorber = new G4LogicalVolume(fSolidAbsorber, //its solid
|
||||
fAbsorberMaterial, //its material
|
||||
fAbsorberMaterial->GetName()); //name
|
||||
fAbsorberMaterial, //its material
|
||||
fAbsorberMaterial->GetName());//name
|
||||
|
||||
fPhysiAbsorber = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(-fGapThickness/2,0.,0.), //its position
|
||||
fLogicAbsorber, //its logical volume
|
||||
fLogicAbsorber, //its logical volume
|
||||
fAbsorberMaterial->GetName(), //its name
|
||||
fLogicLayer, //its mother
|
||||
false, //no boulean operat
|
||||
false, //no boulean operat
|
||||
0); //copy number
|
||||
|
||||
}
|
||||
@@ -227,7 +230,7 @@ G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
|
||||
|
||||
fPhysiGap = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(fAbsorberThickness/2,0.,0.), //its position
|
||||
fLogicGap, //its logical volume
|
||||
fLogicGap, //its logical volume
|
||||
fGapMaterial->GetName(), //its name
|
||||
fLogicLayer, //its mother
|
||||
false, //no boulean operat
|
||||
@@ -270,7 +273,15 @@ void DetectorConstruction::SetAbsorberMaterial(G4String materialChoice)
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial) fAbsorberMaterial = pttoMaterial;
|
||||
if (pttoMaterial)
|
||||
{
|
||||
fAbsorberMaterial = pttoMaterial;
|
||||
if ( fLogicAbsorber )
|
||||
{
|
||||
fLogicAbsorber->SetMaterial(fAbsorberMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -280,7 +291,15 @@ void DetectorConstruction::SetGapMaterial(G4String materialChoice)
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial =
|
||||
G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
|
||||
if (pttoMaterial) fGapMaterial = pttoMaterial;
|
||||
if (pttoMaterial)
|
||||
{
|
||||
fGapMaterial = pttoMaterial;
|
||||
if ( fLogicGap )
|
||||
{
|
||||
fLogicGap->SetMaterial(fGapMaterial);
|
||||
G4RunManager::GetRunManager()->PhysicsHasBeenModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -289,6 +308,7 @@ void DetectorConstruction::SetAbsorberThickness(G4double val)
|
||||
{
|
||||
// change Absorber thickness and recompute the calorimeter parameters
|
||||
fAbsorberThickness = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -297,6 +317,7 @@ void DetectorConstruction::SetGapThickness(G4double val)
|
||||
{
|
||||
// change Gap thickness and recompute the calorimeter parameters
|
||||
fGapThickness = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -305,6 +326,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
{
|
||||
// change the transverse size and recompute the calorimeter parameters
|
||||
fCalorSizeYZ = val;
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -312,15 +334,7 @@ void DetectorConstruction::SetCalorSizeYZ(G4double val)
|
||||
void DetectorConstruction::SetNbOfLayers(G4int val)
|
||||
{
|
||||
fNbOfLayers = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
|
||||
G4RunManager::GetRunManager()->ReinitializeGeometry();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: DetectorMessenger.cc 77256 2013-11-22 10:10:23Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -46,12 +46,22 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
|
||||
:Detector(Det)
|
||||
: G4UImessenger(),
|
||||
fDetector(Det),
|
||||
fN03Dir(0),
|
||||
fDetDir(0),
|
||||
fAbsMaterCmd(0),
|
||||
fGapMaterCmd(0),
|
||||
fAbsThickCmd(0),
|
||||
fGapThickCmd(0),
|
||||
fSizeYZCmd(0),
|
||||
fNbLayersCmd(0)
|
||||
{
|
||||
fN03Dir = new G4UIdirectory("/N03/");
|
||||
fN03Dir->SetGuidance("UI commands of this example");
|
||||
|
||||
fDetDir = new G4UIdirectory("/N03/det/");
|
||||
G4bool broadcast = false;
|
||||
fDetDir = new G4UIdirectory("/N03/det/",broadcast);
|
||||
fDetDir->SetGuidance("detector control");
|
||||
|
||||
fAbsMaterCmd = new G4UIcmdWithAString("/N03/det/setAbsMat",this);
|
||||
@@ -91,11 +101,6 @@ DetectorMessenger::DetectorMessenger( DetectorConstruction* Det)
|
||||
fNbLayersCmd->SetRange("NbLayers>0 && NbLayers<500");
|
||||
fNbLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fUpdateCmd = new G4UIcmdWithoutParameter("/N03/det/update",this);
|
||||
fUpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
fUpdateCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -105,7 +110,7 @@ DetectorMessenger::~DetectorMessenger()
|
||||
delete fNbLayersCmd;
|
||||
delete fAbsMaterCmd; delete fGapMaterCmd;
|
||||
delete fAbsThickCmd; delete fGapThickCmd;
|
||||
delete fSizeYZCmd; delete fUpdateCmd;
|
||||
delete fSizeYZCmd;
|
||||
delete fDetDir;
|
||||
delete fN03Dir;
|
||||
}
|
||||
@@ -115,26 +120,23 @@ DetectorMessenger::~DetectorMessenger()
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == fAbsMaterCmd )
|
||||
{ Detector->SetAbsorberMaterial(newValue);}
|
||||
{ fDetector->SetAbsorberMaterial(newValue);}
|
||||
|
||||
if( command == fGapMaterCmd )
|
||||
{ Detector->SetGapMaterial(newValue);}
|
||||
{ fDetector->SetGapMaterial(newValue);}
|
||||
|
||||
if( command == fAbsThickCmd )
|
||||
{ Detector->SetAbsorberThickness(fAbsThickCmd
|
||||
{ fDetector->SetAbsorberThickness(fAbsThickCmd
|
||||
->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fGapThickCmd )
|
||||
{ Detector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));}
|
||||
{ fDetector->SetGapThickness(fGapThickCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fSizeYZCmd )
|
||||
{ Detector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
{ fDetector->SetCalorSizeYZ(fSizeYZCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == fNbLayersCmd )
|
||||
{ Detector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == fUpdateCmd )
|
||||
{ Detector->UpdateGeometry(); }
|
||||
{ fDetector->SetNbOfLayers(fNbLayersCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the EventAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: EventAction.cc 68015 2013-03-13 13:27:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -44,7 +44,11 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
EventAction::EventAction(RunAction* run, HistoManager* histo)
|
||||
:fRunAct(run),fHistoManager(histo)
|
||||
:G4UserEventAction(),
|
||||
fRunAct(run),fHistoManager(histo),
|
||||
fEnergyAbs(0.), fEnergyGap(0.),
|
||||
fTrackLAbs(0.), fTrackLGap(0.),
|
||||
fPrintModulo(0)
|
||||
{
|
||||
fPrintModulo = 100; }
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: PhysicsList.cc 68015 2013-03-13 13:27:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: PrimaryGeneratorAction.cc 68015 2013-03-13 13:27:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -46,7 +46,9 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
|
||||
:fDetector(DC)
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0),
|
||||
fDetector(DC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: RunAction.cc 74272 2013-10-02 14:48:50Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -42,7 +42,12 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RunAction::RunAction(HistoManager* histo)
|
||||
:fHistoManager(histo)
|
||||
: G4UserRunAction(),
|
||||
fHistoManager(histo),
|
||||
fSumEAbs(0.), fSum2EAbs(0.),
|
||||
fSumEGap(0.), fSum2EGap(0.),
|
||||
fSumLAbs(0.), fSum2LAbs(0.),
|
||||
fSumLGap(0.), fSum2LGap(0.)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: SteppingAction.cc 68015 2013-03-13 13:27:27Z gcosmo $
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -44,7 +44,8 @@
|
||||
|
||||
SteppingAction::SteppingAction(DetectorConstruction* det,
|
||||
EventAction* evt)
|
||||
:fDetector(det), fEventAction(evt)
|
||||
: G4UserSteppingAction(),
|
||||
fDetector(det), fEventAction(evt)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user