Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -5,9 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02ChamberParameterisation.cc,v 1.2 1999/12/15 14:49:21 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02ChamberParameterisation.cc,v 1.3 2000/12/04 16:24:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02ChamberParameterisation.hh"
@@ -15,6 +17,8 @@
#include "G4ThreeVector.hh"
#include "G4Box.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02ChamberParameterisation::ExN02ChamberParameterisation(
G4int NoChambers,
G4double startZ, // Z of center of first
@@ -23,14 +27,14 @@ ExN02ChamberParameterisation::ExN02ChamberParameterisation(
G4double lengthInitial,
G4double lengthFinal )
{
fNoChambers= NoChambers;
fStartZ= startZ;
fHalfWidth= widthChamber*0.5;
fSpacing= spacingZ;
fHalfLengthFirst= 0.5 * lengthInitial;
// fHalfLengthLast= lengthFinal;
fNoChambers = NoChambers;
fStartZ = startZ;
fHalfWidth = widthChamber*0.5;
fSpacing = spacingZ;
fHalfLengthFirst = 0.5 * lengthInitial;
// fHalfLengthLast = lengthFinal;
if( NoChambers > 1 ){
fHalfLengthIncr= 0.5 * (lengthFinal-lengthInitial)/(NoChambers-1);
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/(NoChambers-1);
if( spacingZ < widthChamber ) {
G4Exception( "ExN02ChamberParameterisation construction: Width > Spacing" );
@@ -39,9 +43,13 @@ ExN02ChamberParameterisation::ExN02ChamberParameterisation(
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02ChamberParameterisation::~ExN02ChamberParameterisation()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02ChamberParameterisation::ComputeTransformation
(const G4int copyNo,G4VPhysicalVolume *physVol) const
{
@@ -51,6 +59,8 @@ void ExN02ChamberParameterisation::ComputeTransformation
physVol->SetRotation(0);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02ChamberParameterisation::ComputeDimensions
(G4Box & trackerChamber, const G4int copyNo,
const G4VPhysicalVolume * physVol) const
@@ -60,3 +70,5 @@ void ExN02ChamberParameterisation::ComputeDimensions
trackerChamber.SetYHalfLength(halfLength);
trackerChamber.SetZHalfLength(fHalfWidth);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -5,53 +5,57 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02DetectorConstruction.cc,v 1.4 2000/05/15 14:02:10 japost Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02DetectorConstruction.cc,v 1.5 2000/12/04 16:24:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....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 "G4MaterialTable.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4GeometryManager.hh"
#include "ExN02MagneticField.hh"
#include "G4PVParameterised.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
///#include "G4UserLimits.hh"
#include "G4SDManager.hh"
#include "ExN02TrackerSD.hh"
///#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02DetectorConstruction::ExN02DetectorConstruction()
:solidWorld(NULL),logicWorld(NULL),physiWorld(NULL),
:solidWorld(NULL), logicWorld(NULL), physiWorld(NULL),
solidTarget(NULL), logicTarget(NULL), physiTarget(NULL),
solidTracker(NULL),logicTracker(NULL),physiTracker(NULL),
solidTarget(NULL),logicTarget(NULL),physiTarget(NULL),
solidChamber(NULL),logicChamber(NULL),physiChamber(NULL),
myMaterial(NULL), fDetectorLength(0.),fWorldLength(0.)
TargetMater(NULL), ChamberMater(NULL),fpMagField(NULL),
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
{
fpMagField = new ExN02MagneticField();
detectorMessenger = new ExN02DetectorMessenger(this);
fpMagField = new ExN02MagneticField(); // G4FieldManager();
// magFieldManager = new G4FieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02DetectorConstruction::~ExN02DetectorConstruction()
{
delete detectorMessenger;
delete fpMagField;
// delete magFieldManager;
delete fpMagField;
delete detectorMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
{
//--------- Material definition ---------
@@ -81,13 +85,12 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
density = 11.35*g/cm3;
G4Material* Pb = new G4Material(name="Pb", z=82., a, density);
//Vacuum
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material* Vacuum =
new G4Material(name="Vacuum", z=1., a=1.01*g/mole, density,
kStateGas,temperature,pressure);
//Xenon gas
density = 5.458*mg/cm3;
pressure = 1*atmosphere;
temperature = 293.15*kelvin;
G4Material* Xenon = new G4Material(name="XenonGas", z=54., a=131.29*g/mole,
density, kStateGas,temperature,pressure);
// Print all the materials defined.
//
@@ -96,22 +99,27 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
//--------- Sizes of the principal geometrical components (solids) ---------
fDetectorLength = 1250.*cm ; // Full length of the detector
fTrackerLength = 500. * cm; // Full length of the Tracker
fTargetLength = 5.0 * cm; // Full length of the Target
NbOfChambers = 6;
ChamberWidth = 20*cm;
ChamberSpacing = 80*cm;
G4double detectorSize = 0.5*fDetectorLength;
G4double trackerSize = fTrackerLength * 0.5; // Half length of the Tracker
G4double targetSize = fTargetLength * 0.5; // Half length of the Target
fTrackerLength = NbOfChambers*ChamberSpacing; // Full length of the Tracker
fTargetLength = 5.0 * cm; // Full length of the 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 ---------
myMaterial = Aluminium;
//------------------------------
// World
//------------------------------
fWorldLength= 1.2 * fDetectorLength;
G4double HalfWorldLength = 0.5*fWorldLength;
solidWorld= new G4Box("World",HalfWorldLength,HalfWorldLength,HalfWorldLength);
@@ -126,32 +134,36 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
0, // its mother volume
false, // no boolean operations
0); // no field specific to volume
//------------------------------
// Target
//------------------------------
//------------------------------
G4ThreeVector positionTarget = G4ThreeVector(0,0,-(targetSize+trackerSize));
solidTarget = new G4Box("TargetSolid",targetSize,targetSize,targetSize);
logicTarget = new G4LogicalVolume(solidTarget ,myMaterial,"TargetLV",0,0,0);
logicTarget = new G4LogicalVolume(solidTarget,TargetMater,"TargetLV",0,0,0);
physiTarget = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
positionTarget, // at (x,y,z)
"TargetPV", // its name
logicTarget, // its logical volume
physiWorld, // its mother volume
false, // no boolean operations
0); // no particular field
G4cout << "Target is " << 2*targetSize/cm << " cm of Al " << G4endl;
G4cout << "Target is " << fTargetLength/cm << " cm of "
<< TargetMater->GetName() << G4endl;
//------------------------------
// Tracker
//------------------------------
G4ThreeVector positionTracker;
solidTracker = new G4Box("Tracker",trackerSize,trackerSize,trackerSize);
logicTracker = new G4LogicalVolume(solidTracker , Air, "Tracker",0,0,0);
positionTracker= G4ThreeVector(0,0,trackerSize+targetSize);
//------------------------------
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 (0,0,0)
positionTracker, // at (x,y,z)
"Tracker", // its name
logicTracker, // its logical volume
physiWorld, // its mother volume
@@ -160,35 +172,41 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
//------------------------------
// Tracker segments
//------------------------------
//------------------------------
//
// An example of Parameterised volumes
// dummy values for G4Box -- modified by parameterised volume
G4VSolid * solidChamber
= new G4Box("chamberBox", 100*cm, 100*cm, 10*cm);
// chamberWidth, chamberWidth, chamberDepth);
G4LogicalVolume * trackerChamberLV
= new G4LogicalVolume(solidChamber, Aluminium, "trackerChamberLV",0,0,0);
G4VPVParameterisation * chamberParam
= new ExN02ChamberParameterisation(
6, // NoChambers,
-240.*cm, // Z of center of first
80*cm, // Z spacing of centers
20*cm, // Width Chamber,
50*cm, // lengthInitial,
trackerSize*2.); // lengthFinal
// dummy value : kXAxis -- modified by parameterised volume
G4VPhysicalVolume *trackerChamber_phys
= new G4PVParameterised("trkChamber", // TrackerChamber parameterised
trackerChamberLV, // Its logical volume
physiTracker, // Mother physical volume
kZAxis, // Are placed along this axis
6, // Number of chambers
chamberParam); // The parametrisation
G4VisAttributes* trackerChamber_logVisAtt
= new G4VisAttributes(G4Colour(0.5,0.0,1.0));
trackerChamberLV->SetVisAttributes(trackerChamber_logVisAtt);
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;
G4VPVParameterisation* 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
physiTracker, // Mother physical 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
//------------------------------------------------
@@ -198,68 +216,65 @@ G4VPhysicalVolume* ExN02DetectorConstruction::Construct()
G4String trackerChamberSDname = "ExN02/TrackerChamberSD";
ExN02TrackerSD* aTrackerSD = new ExN02TrackerSD( trackerChamberSDname );
SDman->AddNewDetector( aTrackerSD );
trackerChamberLV->SetSensitiveDetector( aTrackerSD );
logicChamber->SetSensitiveDetector( aTrackerSD );
//--------- Visualization attributes -------------------------------
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
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 -------------------------------
G4VisAttributes * simpleBoxVisAtt
= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
simpleBoxVisAtt->SetVisibility(true);
logicTracker->SetVisAttributes(simpleBoxVisAtt);
//set a max Step length in the absorber
///G4double maxStep = fDetectorLength/0.7, maxLength=fDetectorLength/0.7;
//below is an example of how to set tracking constraints in a given
//logical volume(see also in N02PhysicsList how to setup the process
//G4UserSpecialCuts).
//set a max Step length in the tracker region
///G4double maxStep = 0.5*ChamberWidth, maxLength = 2*fTrackerLength;
///G4double maxTime = 0.1*ns, minEkin = 10*MeV;
///logicAbsorber->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
///logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
/// minEkin));
return physiWorld;
}
#if 0
void ExN02DetectorConstruction::setMaterial(G4String materialChoice)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02DetectorConstruction::setTargetMaterial(G4String materialName)
{
const G4MaterialTable*
theMaterialTable = G4Material::GetMaterialTable();
G4Material* pttoMaterial;
for (G4int J=0 ; J<theMaterialTable->length() ; J++)
{ pttoMaterial = (*theMaterialTable)(J);
if(pttoMaterial->GetName() == materialChoice)
{myMaterial = pttoMaterial;
logicTracker->SetMaterial(pttoMaterial);
G4cout << "Absorber is " << fDetectorLength/cm << " cm of " << materialChoice
<< G4endl;}
}
// 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;
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02DetectorConstruction::SetDetectorLength(G4double length)
void ExN02DetectorConstruction::setChamberMaterial(G4String materialName)
{
G4GeometryManager::GetInstance()->OpenGeometry();
fDetectorLength = length;
fWorldLength = 1.2*fDetectorLength;
G4double halfSize = 0.5 * fDetectorLength;
G4double halfWorldLength = 0.5*fWorldLength;
solidWorld -> SetXHalfLength(halfWorldLength);
solidWorld -> SetYHalfLength(halfWorldLength);
solidWorld -> SetZHalfLength(halfWorldLength);
solidTracker -> SetXHalfLength(halfSize);
solidTracker -> SetYHalfLength(halfSize);
solidTracker -> SetZHalfLength(halfSize);
G4cout << "Absorber is " << fDetectorLength/cm << " cm of " << myMaterial->GetName()
<< G4endl;
}
// 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->SetFieldValue(fieldValue);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -5,10 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02DetectorMessenger.cc,v 1.2 1999/12/15 14:49:21 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// $Id: ExN02DetectorMessenger.cc,v 1.3 2000/12/04 16:24:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02DetectorMessenger.hh"
@@ -18,6 +19,8 @@
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02DetectorMessenger::ExN02DetectorMessenger(ExN02DetectorConstruction * myDet)
:myDetector(myDet)
{
@@ -25,47 +28,47 @@ ExN02DetectorMessenger::ExN02DetectorMessenger(ExN02DetectorConstruction * myDet
mydetDir = new G4UIdirectory("/mydet/");
mydetDir->SetGuidance("ExN02 detector control.");
MatCmd = new G4UIcmdWithAString("/mydet/setMaterial",this);
MatCmd->SetGuidance("Select Material of the SimpleBox.");
MatCmd->SetGuidance(" Choice : Air, Al(default), Pb, Vacuum");
MatCmd->SetParameterName("choice",true);
MatCmd->SetDefaultValue("Al");
MatCmd->SetCandidates("Air Al Pb Vacuum");
MatCmd->AvailableForStates(PreInit,Idle);
TargMatCmd = new G4UIcmdWithAString("/mydet/setTargetMate",this);
TargMatCmd->SetGuidance("Select Material of the Target.");
TargMatCmd->SetParameterName("choice",false);
TargMatCmd->AvailableForStates(PreInit,Idle);
SizeCmd = new G4UIcmdWithADoubleAndUnit("/mydet/setSize",this);
SizeCmd->SetGuidance("Set full Size of the Box");
SizeCmd->SetParameterName("Size",false,false);
SizeCmd->SetDefaultUnit("cm");
SizeCmd->SetUnitCategory("Length");
SizeCmd->AvailableForStates(PreInit,Idle);
ChamMatCmd = new G4UIcmdWithAString("/mydet/setChamberMate",this);
ChamMatCmd->SetGuidance("Select Material of the Target.");
ChamMatCmd->SetParameterName("choice",false);
ChamMatCmd->AvailableForStates(PreInit,Idle);
FieldCmd = new G4UIcmdWithADoubleAndUnit("/mydet/setField",this);
FieldCmd->SetGuidance("Define magnetic field.");
FieldCmd->SetGuidance("Magnetic field will be in Z direction.");
FieldCmd->SetParameterName("Bz",false,false);
FieldCmd->SetParameterName("Bz",false);
FieldCmd->SetDefaultUnit("tesla");
FieldCmd->SetUnitCategory("Magnetic flux density");
FieldCmd->AvailableForStates(PreInit,Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02DetectorMessenger::~ExN02DetectorMessenger()
{
delete MatCmd;
delete SizeCmd;
delete TargMatCmd;
delete ChamMatCmd;
delete FieldCmd;
delete mydetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02DetectorMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
// if( command == MatCmd )
// { myDetector->setMaterial(newValues);}
if( command == SizeCmd )
{ myDetector->SetDetectorLength(SizeCmd->GetNewDoubleValue(newValues));}
if( command == TargMatCmd )
{ myDetector->setTargetMaterial(newValues);}
if( command == ChamMatCmd )
{ myDetector->setChamberMaterial(newValues);}
if( command == FieldCmd )
{ myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValues));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+15 -15
View File
@@ -5,31 +5,37 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02EventAction.cc,v 1.4 2000/01/24 14:45:51 stesting Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02EventAction.cc,v 1.5 2000/12/04 16:24:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02EventAction.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4UImanager.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();
@@ -45,12 +51,6 @@ void ExN02EventAction::EndOfEventAction(const G4Event* evt)
G4cout << " " << n_trajectories
<< " trajectories stored in this event." << G4endl;
}
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
for(G4int i=0; i<n_trajectories; i++)
{ (*(evt->GetTrajectoryContainer()))[i]->DrawTrajectory(50); }
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+23 -11
View File
@@ -5,36 +5,46 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02MagneticField.cc,v 1.2 1999/12/15 14:49:21 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// $Id: ExN02MagneticField.cc,v 1.4 2000/12/04 16:24:07 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// User Field class implementation.
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02MagneticField.hh"
#include "G4FieldManager.hh"
// Constructors:
//....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);
}
// Set the value of the Global Field to fieldValue along Z
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
// Set the value of the Global Field to fieldValue along X
//
void ExN02MagneticField::SetFieldValue(G4double fieldValue)
{
G4UniformMagField::SetFieldValue(G4ThreeVector(0,0,fieldValue));
G4UniformMagField::SetFieldValue(G4ThreeVector(fieldValue,0,0));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
// Set the value of the Global Field
//
void ExN02MagneticField::SetFieldValue(G4ThreeVector fieldVector)
@@ -54,17 +64,19 @@ void ExN02MagneticField::SetFieldValue(G4ThreeVector fieldVector)
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02MagneticField::~ExN02MagneticField()
{
// GetGlobalFieldManager()->SetDetectorField(0);
}
// Utility method
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "G4TransportationManager.hh"
G4FieldManager* ExN02MagneticField::GetGlobalFieldManager()
{
return G4TransportationManager::GetTransportationManager()
->GetFieldManager();
return G4TransportationManager::GetTransportationManager()->GetFieldManager();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+106 -81
View File
@@ -5,15 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02PhysicsList.cc,v 1.7 2000/02/29 12:03:30 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02PhysicsList.cc,v 1.8 2000/12/04 16:24:08 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
//
// This is a version for maximum particle set
// ------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "globals.hh"
#include "ExN02PhysicsList.hh"
@@ -25,27 +21,23 @@
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include "g4std/iomanip"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
ExN02PhysicsList::ExN02PhysicsList(): G4VUserPhysicsList(),
thePhotoElectricEffect(NULL),theComptonScattering(NULL),
theGammaConversion(NULL),
theeminusMultipleScattering(NULL),theeminusIonisation(NULL),
theeminusBremsstrahlung(NULL),
theeplusMultipleScattering(NULL),theeplusIonisation(NULL),
theeplusBremsstrahlung(NULL),
theeplusAnnihilation(NULL)
ExN02PhysicsList::ExN02PhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 2.0*mm;
defaultCutValue = 1.0*cm;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
ExN02PhysicsList::~ExN02PhysicsList()
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructParticle()
{
@@ -61,6 +53,8 @@ void ExN02PhysicsList::ConstructParticle()
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructBosons()
{
// pseudo-particles
@@ -71,6 +65,8 @@ void ExN02PhysicsList::ConstructBosons()
G4Gamma::GammaDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructLeptons()
{
// leptons
@@ -88,6 +84,8 @@ void ExN02PhysicsList::ConstructLeptons()
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructMesons()
{
// mesons
@@ -105,6 +103,8 @@ void ExN02PhysicsList::ConstructMesons()
G4KaonZeroShort::KaonZeroShortDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructBaryons()
{
// barions
@@ -115,6 +115,7 @@ void ExN02PhysicsList::ConstructBaryons()
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructProcess()
{
@@ -123,6 +124,8 @@ void ExN02PhysicsList::ConstructProcess()
ConstructGeneral();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
@@ -138,7 +141,10 @@ void ExN02PhysicsList::ConstructProcess()
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
///#include "G4UserSpecialCuts.hh"
////#include "G4UserSpecialCuts.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::ConstructEM()
{
@@ -150,101 +156,116 @@ void ExN02PhysicsList::ConstructEM()
if (particleName == "gamma") {
// gamma
thePhotoElectricEffect = new G4PhotoElectricEffect();
theComptonScattering = new G4ComptonScattering();
theGammaConversion = new G4GammaConversion();
// add processes
pmanager->AddDiscreteProcess(thePhotoElectricEffect);
pmanager->AddDiscreteProcess(theComptonScattering);
pmanager->AddDiscreteProcess(theGammaConversion);
pmanager->AddDiscreteProcess(new G4GammaConversion());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
} else if (particleName == "e-") {
//electron
// Construct processes for electron
theeminusMultipleScattering = new G4MultipleScattering();
theeminusIonisation = new G4eIonisation();
theeminusBremsstrahlung = new G4eBremsstrahlung();
G4VProcess* theeminusMultipleScattering = new G4MultipleScattering();
G4VProcess* theeminusIonisation = new G4eIonisation();
G4VProcess* theeminusBremsstrahlung = new G4eBremsstrahlung();
//
// add processes
pmanager->AddProcess(theeminusMultipleScattering);
pmanager->AddProcess(theeminusIonisation);
pmanager->AddProcess(theeminusBremsstrahlung);
pmanager->AddProcess(theeminusBremsstrahlung);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep, 2);
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(theeminusIonisation, idxAlongStep,2);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep, 2);
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep, 3);
pmanager->SetProcessOrdering(theeminusMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(theeminusIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(theeminusBremsstrahlung, idxPostStep,3);
} else if (particleName == "e+") {
//positron
// Construct processes for positron
theeplusMultipleScattering = new G4MultipleScattering();
theeplusIonisation = new G4eIonisation();
theeplusBremsstrahlung = new G4eBremsstrahlung();
theeplusAnnihilation = new G4eplusAnnihilation();
G4VProcess* theeplusMultipleScattering = new G4MultipleScattering();
G4VProcess* theeplusIonisation = new G4eIonisation();
G4VProcess* theeplusBremsstrahlung = new G4eBremsstrahlung();
G4VProcess* theeplusAnnihilation = new G4eplusAnnihilation();
//
// add processes
pmanager->AddProcess(theeplusMultipleScattering);
pmanager->AddProcess(theeplusIonisation);
pmanager->AddProcess(theeplusBremsstrahlung);
pmanager->AddProcess(theeplusAnnihilation);
//
// set ordering for AtRestDoIt
pmanager->SetProcessOrderingToFirst(theeplusAnnihilation, idxAtRest);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep, 2);
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(theeplusIonisation, idxAlongStep,2);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep, 2);
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep, 3);
pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep, 4);
pmanager->SetProcessOrdering(theeplusMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(theeplusIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(theeplusBremsstrahlung, idxPostStep,3);
pmanager->SetProcessOrdering(theeplusAnnihilation, idxPostStep,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
// Construct processes for muon+
G4VProcess* aMultipleScattering = new G4MultipleScattering();
G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
G4VProcess* aPairProduction = new G4MuPairProduction();
G4VProcess* anIonisation = new G4MuIonisation();
G4VProcess* aMultipleScattering = new G4MultipleScattering();
G4VProcess* aBremsstrahlung = new G4MuBremsstrahlung();
G4VProcess* aPairProduction = new G4MuPairProduction();
G4VProcess* anIonisation = new G4MuIonisation();
//
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
pmanager->AddProcess(aBremsstrahlung);
pmanager->AddProcess(aPairProduction);
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
pmanager->AddProcess(aBremsstrahlung);
pmanager->AddProcess(aPairProduction);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep, 3);
pmanager->SetProcessOrdering(aPairProduction, idxPostStep, 4);
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
pmanager->SetProcessOrdering(aBremsstrahlung, idxPostStep,3);
pmanager->SetProcessOrdering(aPairProduction, idxPostStep,4);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
// all others charged particles except geantino
G4VProcess* aMultipleScattering = new G4MultipleScattering();
G4VProcess* anIonisation = new G4hIonisation();
//>>G4VProcess* theUserSpecialCuts = new G4UserSpecialCuts();
G4VProcess* anIonisation = new G4hIonisation();
////G4VProcess* theUserCuts = new G4UserSpecialCuts();
//
// add processes
pmanager->AddProcess(anIonisation);
pmanager->AddProcess(aMultipleScattering);
/// pmanager->AddProcess(theUserSpecialCuts);
/// pmanager->AddProcess(theUserCuts);
//
// set ordering for AtRestDoIt
//>>pmanager->SetProcessOrderingToFirst(theUserSpecialCuts, idxAtRest);
////pmanager->SetProcessOrderingToFirst(theUserCuts,idxAtRest);
//
// set ordering for AlongStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep, 2);
pmanager->SetProcessOrdering(aMultipleScattering, idxAlongStep,1);
pmanager->SetProcessOrdering(anIonisation, idxAlongStep,2);
//
// set ordering for PostStepDoIt
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep, 1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep, 2);
//>>pmanager->SetProcessOrdering(theUserSpecialCuts, idxPostStep, 3);
pmanager->SetProcessOrdering(aMultipleScattering, idxPostStep,1);
pmanager->SetProcessOrdering(anIonisation, idxPostStep,2);
////pmanager->SetProcessOrdering(theUserCuts, idxPostStep,3);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4Decay.hh"
void ExN02PhysicsList::ConstructGeneral()
{
@@ -263,13 +284,17 @@ void ExN02PhysicsList::ConstructGeneral()
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void ExN02PhysicsList::SetCuts()
{
if (verboseLevel >1){
G4cout << "ExN02PhysicsList::SetCuts:";
}
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
//G4VUserPhysicsList::SetCutsWithDefault method sets
//the default cut value for all particle types
//
SetCutsWithDefault();
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -5,66 +5,55 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02PrimaryGeneratorAction.cc,v 1.2 1999/12/15 14:49:21 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02PrimaryGeneratorAction.cc,v 1.3 2000/12/04 16:24:08 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// $ Id: $
//
// From exampleEmPhys2/MyPrimaryGeneratorAction.cc,v 1.1 1998/02/06 maire
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02PrimaryGeneratorAction.hh"
#include "ExN02DetectorConstruction.hh"
#include "ExN02PrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02PrimaryGeneratorAction::ExN02PrimaryGeneratorAction(ExN02DetectorConstruction* myDC)
:myDetector(myDC),rndmFlag("off")
:myDetector(myDC)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
gunMessenger = new ExN02PrimaryGeneratorMessenger(this);
// default particle
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="proton");
G4ParticleDefinition* particle = particleTable->FindParticle("proton");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
particleGun->SetParticleEnergy(3.0*GeV);
G4double position = -0.5*(myDetector->GetWorldFullLength());
particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02PrimaryGeneratorAction::~ExN02PrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
// The Target is a box placed at (0,0,0)
//
G4double x0 = -0.5*(myDetector->GetTargetFullLength());
G4double y0 = 0.*cm, z0 = 0.*cm;
if (rndmFlag == "on")
{y0 = (myDetector->GetTargetFullLength())*(G4UniformRand()-0.5);
z0 = (myDetector->GetTargetFullLength())*(G4UniformRand()-0.5);
}
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
G4double position = -0.5*(myDetector->GetWorldFullLength());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -1,42 +0,0 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02PrimaryGeneratorMessenger.cc,v 1.2 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
#include "ExN02PrimaryGeneratorMessenger.hh"
#include "ExN02PrimaryGeneratorAction.hh"
#include "G4UIcmdWithAString.hh"
#include "globals.hh"
ExN02PrimaryGeneratorMessenger::ExN02PrimaryGeneratorMessenger(ExN02PrimaryGeneratorAction* myGun)
:myAction(myGun)
{
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
RndmCmd->SetGuidance(" Choice : on, off(default)");
RndmCmd->SetParameterName("choice",true);
RndmCmd->SetDefaultValue("off");
RndmCmd->SetCandidates("on off");
RndmCmd->AvailableForStates(PreInit,Idle);
}
ExN02PrimaryGeneratorMessenger::~ExN02PrimaryGeneratorMessenger()
{
delete RndmCmd;
}
void ExN02PrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
{
if( command == RndmCmd )
{ myAction->SetRndmFlag(newValues);}
}
+21 -23
View File
@@ -5,10 +5,11 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02RunAction.cc,v 1.3 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// $Id: ExN02RunAction.cc,v 1.4 2000/12/04 16:24:08 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02RunAction.hh"
@@ -17,45 +18,42 @@
#include "G4VVisManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02RunAction::ExN02RunAction()
{
runIDcounter = 0;
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02RunAction::~ExN02RunAction()
{
}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02RunAction::BeginOfRunAction(const G4Run* aRun)
{
((G4Run *)(aRun))->SetRunID(runIDcounter++);
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/tracking/storeTrajectory 1");
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
{
UI->ApplyCommand("/vis~/clear/view");
UI->ApplyCommand("/vis~/draw/current");
}
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/scene/notifyHandlers");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02RunAction::EndOfRunAction(const G4Run*)
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager)
if(G4VVisManager::GetConcreteInstance())
{
G4UImanager::GetUIpointer()->ApplyCommand("/vis~/show/view");
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+13 -21
View File
@@ -5,35 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02SteppingAction.cc,v 1.3 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// $Id: ExN02SteppingAction.cc,v 1.4 2000/12/04 16:24:08 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02SteppingAction.hh"
#include "ExN02DetectorConstruction.hh"
#include "ExN02EventAction.hh"
#include "G4SteppingManager.hh"
ExN02SteppingAction::ExN02SteppingAction(ExN02DetectorConstruction* myDC, ExN02EventAction* myEA)
:myDetector(myDC), eventAction(myEA)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02SteppingAction::ExN02SteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02SteppingAction::UserSteppingAction(const G4Step* aStep)
{
// collect the energy deposited in the absorber
const G4VPhysicalVolume* currentVolume = aStep->GetPreStepPoint()-> GetPhysicalVolume();
#if 0
const G4VPhysicalVolume* absorber = myDetector->getAbsorber();
if (currentVolume == absorber)
{
G4double EdepStep = aStep->GetTotalEnergyDeposit();
eventAction->addEdep(EdepStep);
}
#endif
{
const G4VPhysicalVolume* currentVolume =
aStep->GetPreStepPoint()->GetPhysicalVolume();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+17 -24
View File
@@ -5,39 +5,30 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02SteppingVerbose.cc,v 1.3 2000/02/28 17:58:50 maire Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02SteppingVerbose.cc,v 1.4 2000/12/04 16:24:08 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//---------------------------------------------------------------
//
// ExN02SteppingVerbose.cc
//
// Description:
// Implementation of the ExN02SteppingVerbose class
//
//---------------------------------------------------------------
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02SteppingVerbose.hh"
#include "G4SteppingManager.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();
@@ -126,9 +117,9 @@ void ExN02SteppingVerbose::StepInfo()
G4cout.precision(prec);
}
////////////////////////////////////////////////
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02SteppingVerbose::TrackingStarted()
////////////////////////////////////////////////
{
CopyState();
@@ -164,3 +155,5 @@ G4int prec = G4cout.precision(3);
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+36 -23
View File
@@ -5,43 +5,59 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02TrackerHit.cc,v 1.2 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02TrackerHit.cc,v 1.4 2000/12/06 07:54:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//....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;
ExN02TrackerHit::ExN02TrackerHit()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02TrackerHit::~ExN02TrackerHit()
{;}
ExN02TrackerHit::ExN02TrackerHit() {}
ExN02TrackerHit::ExN02TrackerHit(const ExN02TrackerHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02TrackerHit::~ExN02TrackerHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02TrackerHit::ExN02TrackerHit(const ExN02TrackerHit& right)
{
edep = right.edep;
pos = right.pos;
trackID = right.trackID;
chamberNb = right.chamberNb;
edep = right.edep;
pos = right.pos;
}
const ExN02TrackerHit& ExN02TrackerHit::operator=(const ExN02TrackerHit &right)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
const ExN02TrackerHit& ExN02TrackerHit::operator=(const ExN02TrackerHit& right)
{
edep = right.edep;
pos = right.pos;
trackID = right.trackID;
chamberNb = right.chamberNb;
edep = right.edep;
pos = right.pos;
return *this;
}
int ExN02TrackerHit::operator==(const ExN02TrackerHit &right) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
int ExN02TrackerHit::operator==(const ExN02TrackerHit& right) const
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02TrackerHit::Draw()
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
@@ -57,17 +73,14 @@ void ExN02TrackerHit::Draw()
}
}
//....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.....
// This is a forward declarations of an instantiated G4Allocator<Type> object.
// It has been added in order to make code portable for the GNU g++
// (release 2.7.2) compiler.
// Whenever a new Type is instantiated via G4Allocator, it has to be forward
// declared to make object code (compiled with GNU g++) link successfully.
//
#ifdef GNU_GCC
template class G4Allocator<ExN02TrackerHit>;
#endif
+35 -24
View File
@@ -5,18 +5,21 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: ExN02TrackerSD.cc,v 1.2 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: ExN02TrackerSD.cc,v 1.3 2000/12/04 16:24:09 maire Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
#include "ExN02TrackerSD.hh"
#include "ExN02TrackerHit.hh"
#include "G4Step.hh"
#include "G4HCofThisEvent.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
ExN02TrackerSD::ExN02TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
@@ -24,9 +27,13 @@ ExN02TrackerSD::ExN02TrackerSD(G4String name)
collectionName.insert(HCname="trackerCollection");
}
ExN02TrackerSD::~ExN02TrackerSD(){;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02TrackerSD::Initialize(G4HCofThisEvent*HCE)
ExN02TrackerSD::~ExN02TrackerSD(){ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
trackerCollection = new ExN02TrackerHitsCollection
(SensitiveDetectorName,collectionName[0]);
@@ -36,34 +43,38 @@ void ExN02TrackerSD::Initialize(G4HCofThisEvent*HCE)
HCE->AddHitsCollection( HCID, trackerCollection );
}
G4bool ExN02TrackerSD::ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4bool ExN02TrackerSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
G4Track* aTrack = aStep->GetTrack();
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return true;
if(edep==0.) return false;
ExN02TrackerHit* newHit = new ExN02TrackerHit();
newHit->SetEdep( edep );
newHit->SetPos( aStep->GetPreStepPoint()->GetPosition() );
newHit->SetTrackID (aStep->GetTrack()->GetTrackID());
newHit->SetChamberNb(aStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber());
newHit->SetEdep (edep);
newHit->SetPos (aStep->GetPostStepPoint()->GetPosition());
trackerCollection->insert( newHit );
//newHit->Print();
//newHit->Draw();
return true;
}
void ExN02TrackerSD::EndOfEvent(G4HCofThisEvent*HCE)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void ExN02TrackerSD::EndOfEvent(G4HCofThisEvent* HCE)
{
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();
}
}
void ExN02TrackerSD::clear()
{
}
void ExN02TrackerSD::DrawAll()
{
}
void ExN02TrackerSD::PrintAll()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: ExN02VisManager.cc,v 1.3 1999/12/15 14:49:22 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// John Allison 24th January 1998.