Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02ChamberParameterisation.cc
|
||||
/// \brief Implementation of the ExN02ChamberParameterisation class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02ChamberParameterisation.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02ChamberParameterisation.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Box.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02ChamberParameterisation::ExN02ChamberParameterisation(
|
||||
G4int NoChambers,
|
||||
G4double startZ, // Z of center of first
|
||||
G4double spacingZ, // Z spacing of centers
|
||||
G4double widthChamber,
|
||||
G4double lengthInitial,
|
||||
G4double lengthFinal )
|
||||
{
|
||||
fNoChambers = NoChambers;
|
||||
fStartZ = startZ;
|
||||
fHalfWidth = widthChamber*0.5;
|
||||
fSpacing = spacingZ;
|
||||
fHalfLengthFirst = 0.5 * lengthInitial;
|
||||
// fHalfLengthLast = lengthFinal;
|
||||
if( NoChambers > 0 ){
|
||||
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
|
||||
if (spacingZ < widthChamber) {
|
||||
G4Exception("ExN02ChamberParameterisation::ExN02ChamberParameterisation()",
|
||||
"InvalidSetup", FatalException,
|
||||
"Width>Spacing");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02ChamberParameterisation::~ExN02ChamberParameterisation()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02ChamberParameterisation::ComputeTransformation
|
||||
(const G4int copyNo, G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4double Zposition= fStartZ + (copyNo+1) * fSpacing;
|
||||
G4ThreeVector origin(0,0,Zposition);
|
||||
physVol->SetTranslation(origin);
|
||||
physVol->SetRotation(0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02ChamberParameterisation::ComputeDimensions
|
||||
(G4Box& trackerChamber, const G4int copyNo, const G4VPhysicalVolume*) const
|
||||
{
|
||||
G4double halfLength= fHalfLengthFirst + copyNo * fHalfLengthIncr;
|
||||
trackerChamber.SetXHalfLength(halfLength);
|
||||
trackerChamber.SetYHalfLength(halfLength);
|
||||
trackerChamber.SetZHalfLength(fHalfWidth);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,315 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02DetectorConstruction.cc
|
||||
/// \brief Implementation of the ExN02DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02DetectorConstruction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
#include "ExN02DetectorMessenger.hh"
|
||||
#include "ExN02ChamberParameterisation.hh"
|
||||
#include "ExN02MagneticField.hh"
|
||||
#include "ExN02TrackerSD.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4GeometryTolerance.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorConstruction::ExN02DetectorConstruction()
|
||||
:solidWorld(0), logicWorld(0), physiWorld(0),
|
||||
solidTarget(0), logicTarget(0), physiTarget(0),
|
||||
solidTracker(0),logicTracker(0),physiTracker(0),
|
||||
solidChamber(0),logicChamber(0),physiChamber(0),
|
||||
TargetMater(0), ChamberMater(0),chamberParam(0),
|
||||
stepLimit(0), fpMagField(0),
|
||||
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
|
||||
NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
|
||||
{
|
||||
fpMagField = new ExN02MagneticField();
|
||||
detectorMessenger = new ExN02DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorConstruction::~ExN02DetectorConstruction()
|
||||
{
|
||||
delete fpMagField;
|
||||
delete stepLimit;
|
||||
delete chamberParam;
|
||||
delete detectorMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
|
||||
{
|
||||
//--------- Material definition ---------
|
||||
|
||||
G4double a, z;
|
||||
G4double density, temperature, pressure;
|
||||
G4int nel;
|
||||
|
||||
//Air
|
||||
G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);
|
||||
G4Element* O = new G4Element("Oxygen" , "O", z=8., a= 16.00*g/mole);
|
||||
|
||||
G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);
|
||||
Air->AddElement(N, 70*perCent);
|
||||
Air->AddElement(O, 30*perCent);
|
||||
|
||||
//Lead
|
||||
G4Material* Pb =
|
||||
new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
|
||||
|
||||
//Xenon gas
|
||||
G4Material* Xenon =
|
||||
new G4Material("XenonGas", z=54., a=131.29*g/mole, density= 5.458*mg/cm3,
|
||||
kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere);
|
||||
|
||||
// Print all the materials defined.
|
||||
//
|
||||
G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
|
||||
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
//--------- Sizes of the principal geometrical components (solids) ---------
|
||||
|
||||
NbOfChambers = 5;
|
||||
ChamberWidth = 20*cm;
|
||||
ChamberSpacing = 80*cm;
|
||||
|
||||
fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker
|
||||
fTargetLength = 5.0 * cm; // Full length of Target
|
||||
|
||||
TargetMater = Pb;
|
||||
ChamberMater = Xenon;
|
||||
|
||||
fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
|
||||
|
||||
G4double targetSize = 0.5*fTargetLength; // Half length of the Target
|
||||
G4double trackerSize = 0.5*fTrackerLength; // Half length of the Tracker
|
||||
|
||||
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
|
||||
|
||||
//------------------------------
|
||||
// World
|
||||
//------------------------------
|
||||
|
||||
G4double HalfWorldLength = 0.5*fWorldLength;
|
||||
|
||||
G4GeometryManager::GetInstance()->SetWorldMaximumExtent(fWorldLength);
|
||||
G4cout << "Computed tolerance = "
|
||||
<< G4GeometryTolerance::GetInstance()->GetSurfaceTolerance()/mm
|
||||
<< " mm" << G4endl;
|
||||
|
||||
solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
|
||||
logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0);
|
||||
|
||||
// Must place the World Physical volume unrotated at (0,0,0).
|
||||
//
|
||||
physiWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
//------------------------------
|
||||
// Target
|
||||
//------------------------------
|
||||
|
||||
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
|
||||
|
||||
solidTarget = new G4Box("target",targetSize,targetSize,targetSize);
|
||||
logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"Target",0,0,0);
|
||||
physiTarget = new G4PVPlacement(0, // no rotation
|
||||
positionTarget, // at (x,y,z)
|
||||
logicTarget, // its logical volume
|
||||
"Target", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
G4cout << "Target is " << fTargetLength/cm << " cm of "
|
||||
<< TargetMater->GetName() << G4endl;
|
||||
|
||||
//------------------------------
|
||||
// Tracker
|
||||
//------------------------------
|
||||
|
||||
G4ThreeVector positionTracker = G4ThreeVector(0,0,0);
|
||||
|
||||
solidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
|
||||
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
|
||||
physiTracker = new G4PVPlacement(0, // no rotation
|
||||
positionTracker, // at (x,y,z)
|
||||
logicTracker, // its logical volume
|
||||
"Tracker", // its name
|
||||
logicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
//------------------------------
|
||||
// Tracker segments
|
||||
//------------------------------
|
||||
//
|
||||
// An example of Parameterised volumes
|
||||
// dummy values for G4Box -- modified by parameterised volume
|
||||
|
||||
solidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
|
||||
logicChamber = new G4LogicalVolume(solidChamber,ChamberMater,"Chamber",0,0,0);
|
||||
|
||||
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
|
||||
G4double firstLength = fTrackerLength/10;
|
||||
G4double lastLength = fTrackerLength;
|
||||
|
||||
chamberParam = new ExN02ChamberParameterisation(
|
||||
NbOfChambers, // NoChambers
|
||||
firstPosition, // Z of center of first
|
||||
ChamberSpacing, // Z spacing of centers
|
||||
ChamberWidth, // Width Chamber
|
||||
firstLength, // lengthInitial
|
||||
lastLength); // lengthFinal
|
||||
|
||||
// dummy value : kZAxis -- modified by parameterised volume
|
||||
//
|
||||
physiChamber = new G4PVParameterised(
|
||||
"Chamber", // their name
|
||||
logicChamber, // their logical volume
|
||||
logicTracker, // Mother logical volume
|
||||
kZAxis, // Are placed along this axis
|
||||
NbOfChambers, // Number of chambers
|
||||
chamberParam); // The parametrisation
|
||||
|
||||
G4cout << "There are " << NbOfChambers << " chambers in the tracker region. "
|
||||
<< "The chambers are " << ChamberWidth/mm << " mm of "
|
||||
<< ChamberMater->GetName() << "\n The distance between chamber is "
|
||||
<< ChamberSpacing/cm << " cm" << G4endl;
|
||||
|
||||
//------------------------------------------------
|
||||
// Sensitive detectors
|
||||
//------------------------------------------------
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
|
||||
G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
|
||||
ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
|
||||
SDman->AddNewDetector( aTrackerSD );
|
||||
logicChamber->SetSensitiveDetector( aTrackerSD );
|
||||
|
||||
//--------- Visualization attributes -------------------------------
|
||||
|
||||
G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
logicWorld ->SetVisAttributes(BoxVisAtt);
|
||||
logicTarget ->SetVisAttributes(BoxVisAtt);
|
||||
logicTracker->SetVisAttributes(BoxVisAtt);
|
||||
|
||||
G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
|
||||
logicChamber->SetVisAttributes(ChamberVisAtt);
|
||||
|
||||
//--------- example of User Limits -------------------------------
|
||||
|
||||
// below is an example of how to set tracking constraints in a given
|
||||
// logical volume(see also in N02PhysicsList how to setup the processes
|
||||
// G4StepLimiter or G4UserSpecialCuts).
|
||||
|
||||
// Sets a max Step length in the tracker region, with G4StepLimiter
|
||||
//
|
||||
G4double maxStep = 0.5*ChamberWidth;
|
||||
stepLimit = new G4UserLimits(maxStep);
|
||||
logicTracker->SetUserLimits(stepLimit);
|
||||
|
||||
// Set additional contraints on the track, with G4UserSpecialCuts
|
||||
//
|
||||
// G4double maxLength = 2*fTrackerLength, maxTime = 0.1*ns, minEkin = 10*MeV;
|
||||
// logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
|
||||
// minEkin));
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::setTargetMaterial(G4String materialName)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
|
||||
if (pttoMaterial)
|
||||
{TargetMater = pttoMaterial;
|
||||
logicTarget->SetMaterial(pttoMaterial);
|
||||
G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
|
||||
<< materialName << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::setChamberMaterial(G4String materialName)
|
||||
{
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
|
||||
if (pttoMaterial)
|
||||
{ChamberMater = pttoMaterial;
|
||||
logicChamber->SetMaterial(pttoMaterial);
|
||||
G4cout << "\n----> The chambers are " << ChamberWidth/cm << " cm of "
|
||||
<< materialName << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::SetMagField(G4double fieldValue)
|
||||
{
|
||||
fpMagField->SetMagFieldValue(fieldValue);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorConstruction::SetMaxStep(G4double maxStep)
|
||||
{
|
||||
if ((stepLimit)&&(maxStep>0.)) stepLimit->SetMaxAllowedStep(maxStep);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02DetectorMessenger.cc
|
||||
/// \brief Implementation of the ExN02DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02DetectorMessenger.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02DetectorMessenger.hh"
|
||||
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorMessenger::ExN02DetectorMessenger(ExN02DetectorConstruction* myDet)
|
||||
:myDetector(myDet)
|
||||
{
|
||||
N02Dir = new G4UIdirectory("/N02/");
|
||||
N02Dir->SetGuidance("UI commands specific to this example.");
|
||||
|
||||
detDir = new G4UIdirectory("/N02/det/");
|
||||
detDir->SetGuidance("detector control.");
|
||||
|
||||
TargMatCmd = new G4UIcmdWithAString("/N02/det/setTargetMate",this);
|
||||
TargMatCmd->SetGuidance("Select Material of the Target.");
|
||||
TargMatCmd->SetParameterName("choice",false);
|
||||
TargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
ChamMatCmd = new G4UIcmdWithAString("/N02/det/setChamberMate",this);
|
||||
ChamMatCmd->SetGuidance("Select Material of the Target.");
|
||||
ChamMatCmd->SetParameterName("choice",false);
|
||||
ChamMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
FieldCmd = new G4UIcmdWithADoubleAndUnit("/N02/det/setField",this);
|
||||
FieldCmd->SetGuidance("Define magnetic field.");
|
||||
FieldCmd->SetGuidance("Magnetic field will be in X direction.");
|
||||
FieldCmd->SetParameterName("Bx",false);
|
||||
FieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
FieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
StepMaxCmd = new G4UIcmdWithADoubleAndUnit("/N02/det/stepMax",this);
|
||||
StepMaxCmd->SetGuidance("Define a step max");
|
||||
StepMaxCmd->SetParameterName("stepMax",false);
|
||||
StepMaxCmd->SetUnitCategory("Length");
|
||||
StepMaxCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02DetectorMessenger::~ExN02DetectorMessenger()
|
||||
{
|
||||
delete TargMatCmd;
|
||||
delete ChamMatCmd;
|
||||
delete FieldCmd;
|
||||
delete StepMaxCmd;
|
||||
delete detDir;
|
||||
delete N02Dir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == TargMatCmd )
|
||||
{ myDetector->setTargetMaterial(newValue);}
|
||||
|
||||
if( command == ChamMatCmd )
|
||||
{ myDetector->setChamberMaterial(newValue);}
|
||||
|
||||
if( command == FieldCmd )
|
||||
{ myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == StepMaxCmd )
|
||||
{ myDetector->SetMaxStep(StepMaxCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02EventAction.cc
|
||||
/// \brief Implementation of the ExN02EventAction class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02EventAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02EventAction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02EventAction::ExN02EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02EventAction::~ExN02EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02EventAction::BeginOfEventAction(const G4Event*)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4int event_id = evt->GetEventID();
|
||||
|
||||
// get number of stored trajectories
|
||||
//
|
||||
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
|
||||
|
||||
// periodic printing
|
||||
//
|
||||
if (event_id < 100 || event_id%100 == 0) {
|
||||
G4cout << ">>> Event " << evt->GetEventID() << G4endl;
|
||||
G4cout << " " << n_trajectories
|
||||
<< " trajectories stored in this event." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02MagneticField.cc
|
||||
/// \brief Implementation of the ExN02MagneticField class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02MagneticField.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
// User Field class implementation.
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02MagneticField.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02MagneticField::ExN02MagneticField()
|
||||
: G4UniformMagField(G4ThreeVector())
|
||||
{
|
||||
GetGlobalFieldManager()->SetDetectorField(this);
|
||||
GetGlobalFieldManager()->CreateChordFinder(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02MagneticField::ExN02MagneticField(G4ThreeVector fieldVector)
|
||||
: G4UniformMagField(fieldVector)
|
||||
{
|
||||
GetGlobalFieldManager()->SetDetectorField(this);
|
||||
GetGlobalFieldManager()->CreateChordFinder(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02MagneticField::~ExN02MagneticField()
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Set the value of the Global Field to fieldValue along X
|
||||
//
|
||||
void ExN02MagneticField::SetMagFieldValue(G4double fieldValue)
|
||||
{
|
||||
SetMagFieldValue(G4ThreeVector(fieldValue,0,0));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// Set the value of the Global Field
|
||||
//
|
||||
void ExN02MagneticField::SetMagFieldValue(G4ThreeVector fieldVector)
|
||||
{
|
||||
// Find the Field Manager for the global field
|
||||
G4FieldManager* fieldMgr= GetGlobalFieldManager();
|
||||
|
||||
if(fieldVector!=G4ThreeVector(0.,0.,0.))
|
||||
{
|
||||
SetFieldValue(fieldVector);
|
||||
fieldMgr->SetDetectorField(this);
|
||||
} else {
|
||||
// If the new field's value is Zero, then it is best to
|
||||
// insure that it is not used for propagation.
|
||||
G4MagneticField* magField = 0;
|
||||
fieldMgr->SetDetectorField(magField);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4FieldManager* ExN02MagneticField::GetGlobalFieldManager()
|
||||
{
|
||||
return G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,289 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02PhysicsList.cc
|
||||
/// \brief Implementation of the ExN02PhysicsList class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02PhysicsList.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02PhysicsList.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PhysicsList::ExN02PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1.0*cm;
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PhysicsList::~ExN02PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
ConstructMesons();
|
||||
ConstructBaryons();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructBosons()
|
||||
{
|
||||
// pseudo-particles
|
||||
G4Geantino::GeantinoDefinition();
|
||||
G4ChargedGeantino::ChargedGeantinoDefinition();
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
// e+/-
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
// mu+/-
|
||||
G4MuonPlus::MuonPlusDefinition();
|
||||
G4MuonMinus::MuonMinusDefinition();
|
||||
// nu_e
|
||||
G4NeutrinoE::NeutrinoEDefinition();
|
||||
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
|
||||
// nu_mu
|
||||
G4NeutrinoMu::NeutrinoMuDefinition();
|
||||
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructMesons()
|
||||
{
|
||||
// mesons
|
||||
// light mesons
|
||||
G4PionPlus::PionPlusDefinition();
|
||||
G4PionMinus::PionMinusDefinition();
|
||||
G4PionZero::PionZeroDefinition();
|
||||
G4Eta::EtaDefinition();
|
||||
G4EtaPrime::EtaPrimeDefinition();
|
||||
G4KaonPlus::KaonPlusDefinition();
|
||||
G4KaonMinus::KaonMinusDefinition();
|
||||
G4KaonZero::KaonZeroDefinition();
|
||||
G4AntiKaonZero::AntiKaonZeroDefinition();
|
||||
G4KaonZeroLong::KaonZeroLongDefinition();
|
||||
G4KaonZeroShort::KaonZeroShortDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructBaryons()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
|
||||
G4Neutron::NeutronDefinition();
|
||||
G4AntiNeutron::AntiNeutronDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
AddStepMax();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4MuMultipleScattering.hh"
|
||||
#include "G4MuIonisation.hh"
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4hIonisation.hh"
|
||||
#include "G4hBremsstrahlung.hh"
|
||||
#include "G4hPairProduction.hh"
|
||||
|
||||
#include "G4ionIonisation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::ConstructEM()
|
||||
{
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
// gamma
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
//electron
|
||||
pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
//positron
|
||||
pmanager->AddProcess(new G4eMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
//muon
|
||||
pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);
|
||||
|
||||
} else if( particleName == "proton" ||
|
||||
particleName == "pi-" ||
|
||||
particleName == "pi+" ) {
|
||||
//proton
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4hPairProduction, -1, 4, 4);
|
||||
|
||||
} else if( particleName == "alpha" ||
|
||||
particleName == "He3" ) {
|
||||
//alpha
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
|
||||
|
||||
} else if( particleName == "GenericIon" ) {
|
||||
//Ions
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino
|
||||
pmanager->AddProcess(new G4hMultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Decay.hh"
|
||||
|
||||
void ExN02PhysicsList::ConstructGeneral()
|
||||
{
|
||||
// Add Decay Process
|
||||
G4Decay* theDecayProcess = new G4Decay();
|
||||
theParticleIterator->reset();
|
||||
while( (*theParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
if (theDecayProcess->IsApplicable(*particle)) {
|
||||
pmanager ->AddProcess(theDecayProcess);
|
||||
// set ordering for PostStepDoIt and AtRestDoIt
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
|
||||
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4StepLimiter.hh"
|
||||
#include "G4UserSpecialCuts.hh"
|
||||
|
||||
void ExN02PhysicsList::AddStepMax()
|
||||
{
|
||||
// Step limitation seen as a process
|
||||
G4StepLimiter* stepLimiter = new G4StepLimiter();
|
||||
////G4UserSpecialCuts* userCuts = new G4UserSpecialCuts();
|
||||
|
||||
theParticleIterator->reset();
|
||||
while ((*theParticleIterator)()){
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
|
||||
if (particle->GetPDGCharge() != 0.0)
|
||||
{
|
||||
pmanager ->AddDiscreteProcess(stepLimiter);
|
||||
////pmanager ->AddDiscreteProcess(userCuts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PhysicsList::SetCuts()
|
||||
{
|
||||
//G4VUserPhysicsList::SetCutsWithDefault method sets
|
||||
//the default cut value for all particle types
|
||||
//
|
||||
SetCutsWithDefault();
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02PrimaryGeneratorAction.cc
|
||||
/// \brief Implementation of the ExN02PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02PrimaryGeneratorAction.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02PrimaryGeneratorAction.hh"
|
||||
#include "ExN02DetectorConstruction.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PrimaryGeneratorAction::ExN02PrimaryGeneratorAction(
|
||||
ExN02DetectorConstruction* myDC)
|
||||
:myDetector(myDC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle
|
||||
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle("proton");
|
||||
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
particleGun->SetParticleEnergy(3.0*GeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02PrimaryGeneratorAction::~ExN02PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double position = -0.5*(myDetector->GetWorldFullLength());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02RunAction.cc
|
||||
/// \brief Implementation of the ExN02RunAction class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02RunAction.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02RunAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02RunAction::ExN02RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02RunAction::~ExN02RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02RunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02RunAction::EndOfRunAction(const G4Run*)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02SteppingAction.cc
|
||||
/// \brief Implementation of the ExN02SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02SteppingAction.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02SteppingAction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02SteppingAction::ExN02SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02SteppingAction::UserSteppingAction(const G4Step*)
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02SteppingVerbose.cc
|
||||
/// \brief Implementation of the ExN02SteppingVerbose class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02SteppingVerbose.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02SteppingVerbose.hh"
|
||||
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02SteppingVerbose::ExN02SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02SteppingVerbose::~ExN02SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02SteppingVerbose::StepInfo()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << " "
|
||||
<< std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << " UserLimit";
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << "\n :----- List of secondaries ----------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " "
|
||||
<< std::setw(13)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
|
||||
<< ": energy ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< " time ="
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :------------------------------------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02SteppingVerbose::TrackingStarted()
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "Volume" << " "
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
|
||||
<< " ";
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << std::setw(10) << fTrack->GetVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
G4cout << " initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -0,0 +1,108 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02TrackerHit.cc
|
||||
/// \brief Implementation of the ExN02TrackerHit class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02TrackerHit.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02TrackerHit.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
G4Allocator<ExN02TrackerHit> ExN02TrackerHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerHit::ExN02TrackerHit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerHit::~ExN02TrackerHit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerHit::ExN02TrackerHit(const ExN02TrackerHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const ExN02TrackerHit& ExN02TrackerHit::operator=(const ExN02TrackerHit& right)
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int ExN02TrackerHit::operator==(const ExN02TrackerHit& right) const
|
||||
{
|
||||
return (this==&right) ? 1 : 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerHit::Draw()
|
||||
{
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(pos);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,0.,0.);
|
||||
G4VisAttributes attribs(colour);
|
||||
circle.SetVisAttributes(attribs);
|
||||
pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerHit::Print()
|
||||
{
|
||||
G4cout << " trackID: " << trackID << " chamberNb: " << chamberNb
|
||||
<< " energy deposit: " << G4BestUnit(edep,"Energy")
|
||||
<< " position: " << G4BestUnit(pos,"Length") << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 parallel/ParN02/src/ExN02TrackerSD.cc
|
||||
/// \brief Implementation of the ExN02TrackerSD class
|
||||
//
|
||||
//
|
||||
// $Id: ExN02TrackerSD.cc 66241 2012-12-13 18:34:42Z gunter $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "ExN02TrackerSD.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerSD::ExN02TrackerSD(G4String name)
|
||||
:G4VSensitiveDetector(name)
|
||||
{
|
||||
G4String HCname;
|
||||
collectionName.insert(HCname="trackerCollection");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExN02TrackerSD::~ExN02TrackerSD(){ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
trackerCollection = new ExN02TrackerHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
static G4int HCID = -1;
|
||||
if(HCID<0)
|
||||
{ HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
|
||||
HCE->AddHitsCollection( HCID, trackerCollection );
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool ExN02TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
|
||||
{
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
if(edep==0.) return false;
|
||||
|
||||
ExN02TrackerHit* newHit = new ExN02TrackerHit();
|
||||
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
|
||||
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchableHandle()
|
||||
->GetCopyNumber());
|
||||
newHit->SetEdep (edep);
|
||||
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
|
||||
trackerCollection->insert( newHit );
|
||||
|
||||
//newHit->Print();
|
||||
//newHit->Draw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExN02TrackerSD::EndOfEvent(G4HCofThisEvent*)
|
||||
{
|
||||
if (verboseLevel>0) {
|
||||
G4int NbHits = trackerCollection->entries();
|
||||
G4cout << "\n-------->Hits Collection: in this event they are " << NbHits
|
||||
<< " hits in the tracker chambers: " << G4endl;
|
||||
for (G4int i=0;i<NbHits;i++) (*trackerCollection)[i]->Print();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: ParRunManager.cc 78055 2013-12-03 08:27:48Z gcosmo $
|
||||
//
|
||||
/// \file parallel/ParN02/src/ParRunManager.cc
|
||||
/// \brief Implementation of the ParRunManager class
|
||||
//
|
||||
#ifdef G4USE_TOPC
|
||||
|
||||
#include "G4Timer.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunMessenger.hh"
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ApplicationState.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4VPersistencyManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ProcessTable.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
|
||||
#include "ParRunManager.hh"
|
||||
//include file for marshaling structures
|
||||
#include "MarshaledG4HCofThisEvent.h"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <sstream> // Geant4 8.x and beyond
|
||||
|
||||
using namespace CLHEP;
|
||||
|
||||
/*
|
||||
* The TopC call backs are implemented by using the 5 static data members to store
|
||||
* the data and using the 3 static member functions to point to the corresponding
|
||||
* functions of the singleton class instance.
|
||||
*/
|
||||
G4StateManager* ParRunManager::stateManager;
|
||||
G4int ParRunManager::n_event;
|
||||
G4int ParRunManager::n_select;
|
||||
G4String ParRunManager::msg;
|
||||
ParRunManager* ParRunManager::myRunManager = 0;
|
||||
|
||||
//cross-context variables
|
||||
static long* g_Seeds;
|
||||
|
||||
// TOP-C callbacks functions
|
||||
TOPC_BUF ParRunManager::MyDoEvent( void *input_buf ) {
|
||||
return myRunManager->DoEvent(input_buf);
|
||||
}
|
||||
TOPC_ACTION ParRunManager::MyCheckEventResult( void * input_buf, void *buf ) {
|
||||
return myRunManager->CheckEventResult(input_buf, buf);
|
||||
}
|
||||
|
||||
|
||||
static void trace_event_input( void */*input*/ ) {
|
||||
//G4cout << "Event " << *(G4int *)input << G4endl;
|
||||
}
|
||||
|
||||
/*
|
||||
* DoEventLoop is the most important piece in RunManager class to control the program runs,
|
||||
* this is where we embed the TopC parallelism callbacks.
|
||||
*/
|
||||
void ParRunManager::DoEventLoop( G4int n_event, const char* macroFile, G4int n_select )
|
||||
{
|
||||
TOPC_OPT_trace_input = trace_event_input;
|
||||
|
||||
G4StateManager* stateManager = G4StateManager::GetStateManager();
|
||||
|
||||
#ifdef G4_ORIGINAL
|
||||
cout << "ParRunManager::DoEventLoop" << endl;
|
||||
G4RunManager::DoEventLoop(n_event, macroFile, n_select);
|
||||
return;
|
||||
#endif
|
||||
|
||||
if(verboseLevel>0)
|
||||
{ timer->Start(); }
|
||||
|
||||
G4String msg;
|
||||
if(macroFile!=0)
|
||||
{
|
||||
if(n_select<0) n_select = n_event;
|
||||
msg = "/control/execute ";
|
||||
msg += macroFile;
|
||||
}
|
||||
else
|
||||
{ n_select = -1; }
|
||||
|
||||
|
||||
// BeginOfEventAction() and EndOfEventAction() would normally be
|
||||
// called inside G4EventManager::ProcessOneEvent() in ParRunManager::DoEvent
|
||||
// on slave. Since this is often where hits are collected and where
|
||||
// histogram data is first stored, must do it
|
||||
// on master instead, to process hits. So, set user event action to NULL.
|
||||
// Keep private copy, and execute it in CheckTaskResult().
|
||||
// If user later does: SetUserAction( (G4UserEventAction *)NULL );
|
||||
// we won't notice and copy it to origUserEventAction.
|
||||
if ( eventManager->GetUserEventAction() ) {
|
||||
origUserEventAction = eventManager->GetUserEventAction();
|
||||
SetUserAction( (G4UserEventAction *)0 );
|
||||
}
|
||||
|
||||
// Make these variables accessible to TOP-C callback functions
|
||||
ImportDoEventLoopLocals( stateManager, n_event, n_select, msg );
|
||||
|
||||
|
||||
// Setup random seeds for each slave
|
||||
g_Seeds = (long*)calloc(n_event, sizeof(long));
|
||||
|
||||
for(G4int i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
g_Seeds[i_event] = (long) (100000000L * HepRandom::getTheGenerator()->flat());
|
||||
}
|
||||
|
||||
// This is where all the parallelism occurs
|
||||
TOPC_raw_begin_master_slave(MyDoEvent, MyCheckEventResult, NULL);
|
||||
|
||||
if(TOPC_is_master()){
|
||||
for(G4int i_event=0; i_event<n_event; i_event++ )
|
||||
{
|
||||
TOPC_raw_submit_task_input(TOPC_MSG( &i_event, sizeof(G4int)));
|
||||
if (runAborted) break;
|
||||
}
|
||||
}
|
||||
TOPC_raw_end_master_slave();
|
||||
|
||||
free(g_Seeds);
|
||||
|
||||
if ( verboseLevel > 0 ) {
|
||||
timer->Stop();
|
||||
G4cout << "Run terminated." << G4endl;
|
||||
G4cout << "Run Summary" << G4endl;
|
||||
if ( runAborted ) {
|
||||
G4cout << " Run Aborted." << G4endl;
|
||||
} else {
|
||||
G4cout << " Number of events processed : " << n_event << G4endl;
|
||||
}
|
||||
G4cout << " " << *timer << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
static MarshaledG4HCofThisEvent *aMarshaledObj = NULL;
|
||||
|
||||
TOPC_BUF ParRunManager::DoEvent( void *input_buf )
|
||||
{
|
||||
static
|
||||
G4int i_event;
|
||||
memcpy(&i_event, input_buf, sizeof(G4int));
|
||||
HepRandom::setTheSeed(g_Seeds[i_event]);
|
||||
|
||||
// removed for Geant4.6
|
||||
// stateManager->SetNewState(G4State_EventProc);
|
||||
|
||||
currentEvent = GenerateEvent(i_event);
|
||||
eventManager->ProcessOneEvent(currentEvent);
|
||||
|
||||
G4HCofThisEvent* HCE = currentEvent->GetHCofThisEvent();
|
||||
|
||||
if(aMarshaledObj) delete aMarshaledObj;
|
||||
aMarshaledObj = new MarshaledG4HCofThisEvent(HCE);
|
||||
|
||||
// removed for Geant4.6
|
||||
//stateManager->SetNewState( G4State_GeomClosed );
|
||||
StackPreviousEvent( currentEvent );
|
||||
currentEvent = 0;
|
||||
return TOPC_MSG( aMarshaledObj->getBuffer(), aMarshaledObj->getBufferSize());
|
||||
}
|
||||
|
||||
|
||||
TOPC_ACTION ParRunManager::CheckEventResult( void * input_buf, void *output_buf )
|
||||
{
|
||||
G4int i_event;
|
||||
memcpy(&i_event, input_buf, sizeof(G4int));
|
||||
|
||||
// removed for Geant4.6
|
||||
//stateManager->SetNewState(G4State_EventProc);
|
||||
// Geant4 6.0 requires the state to be G4State_GeomClosed
|
||||
// before calling EventManager::ProcessOneEvent(..)
|
||||
|
||||
if ( !userPrimaryGeneratorAction ) {
|
||||
G4Exception("ParRunManager::CheckEventResult", "InvalidSetup",
|
||||
FatalException,
|
||||
"G4VUserPrimaryGeneratorAction is not defined.");
|
||||
}
|
||||
|
||||
//This creates a trivial event in lieu of GenerateEvent(i_event);
|
||||
currentEvent = new G4Event( i_event );
|
||||
|
||||
//
|
||||
SetUserAction( (G4UserEventAction *)0 );
|
||||
|
||||
// When Geant4 4.0 sees empty event, it still calls userStackingAction.
|
||||
// On master, only trivial events exist, so we delete userStackingAction
|
||||
SetUserAction( (G4UserStackingAction*)0 );
|
||||
eventManager->ProcessOneEvent( currentEvent ); // Processing the trivial event
|
||||
|
||||
// Called with output_buf and no size, creates object for unmarshaling
|
||||
// using marshalgen
|
||||
MarshaledG4HCofThisEvent marshaledObj( output_buf );
|
||||
G4HCofThisEvent* oldCE = currentEvent->GetHCofThisEvent();
|
||||
G4HCofThisEvent* HCE = new G4HCofThisEvent(oldCE->GetNumberOfCollections());
|
||||
|
||||
marshaledObj.unmarshalTo(HCE);
|
||||
if(oldCE) delete(oldCE);
|
||||
|
||||
currentEvent->SetHCofThisEvent(HCE);
|
||||
|
||||
// Original UserEventAction was saved and set to NULL. Do it now on master.
|
||||
HepRandom::setTheSeed(g_Seeds[i_event]);
|
||||
if ( origUserEventAction )
|
||||
origUserEventAction->BeginOfEventAction( currentEvent );
|
||||
|
||||
if ( origUserEventAction )
|
||||
origUserEventAction->EndOfEventAction( currentEvent );
|
||||
|
||||
AnalyzeEvent(currentEvent);
|
||||
|
||||
if (i_event<n_select) G4UImanager::GetUIpointer()->ApplyCommand(msg);
|
||||
// Geant4 6.0 requires the state to be G4State_GeomClosed
|
||||
stateManager->SetNewState( G4State_GeomClosed );
|
||||
StackPreviousEvent(currentEvent);
|
||||
currentEvent = 0;
|
||||
return NO_ACTION;
|
||||
}
|
||||
|
||||
#endif /* G4USE_TOPC */
|
||||
Reference in New Issue
Block a user