Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01ChamberParameterisation class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01ChamberParameterisation.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -47,6 +47,7 @@ ExP01ChamberParameterisation::ExP01ChamberParameterisation(
|
||||
G4double widthChamber,
|
||||
G4double lengthInitial,
|
||||
G4double lengthFinal )
|
||||
: G4VPVParameterisation()
|
||||
{
|
||||
fNoChambers = NoChambers;
|
||||
fStartZ = startZ;
|
||||
@@ -54,6 +55,7 @@ ExP01ChamberParameterisation::ExP01ChamberParameterisation(
|
||||
fSpacing = spacingZ;
|
||||
fHalfLengthFirst = 0.5 * lengthInitial;
|
||||
// fHalfLengthLast = lengthFinal;
|
||||
fHalfLengthIncr = 0;
|
||||
if( NoChambers > 0 ){
|
||||
fHalfLengthIncr = 0.5 * (lengthFinal-lengthInitial)/NoChambers;
|
||||
if (spacingZ < widthChamber) {
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01DetectorConstruction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01DetectorConstruction.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -56,24 +56,25 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01DetectorConstruction::ExP01DetectorConstruction()
|
||||
: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),fpMagField(0),
|
||||
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
|
||||
NbOfChambers(0) , ChamberWidth(0.), ChamberSpacing(0.)
|
||||
:G4VUserDetectorConstruction(),
|
||||
fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
|
||||
fSolidTarget(0), fLogicTarget(0), fPhysiTarget(0),
|
||||
fSolidTracker(0), fLogicTracker(0), fPhysiTracker(0),
|
||||
fSolidChamber(0), fLogicChamber(0), fPhysiChamber(0),
|
||||
fTargetMater(0), fChamberMater(0), fPMagField(0), fDetectorMessenger(0),
|
||||
fWorldLength(0.), fTargetLength(0.), fTrackerLength(0.),
|
||||
fNbOfChambers(0), fChamberWidth(0.), fChamberSpacing(0.)
|
||||
{
|
||||
fpMagField = new ExP01MagneticField();
|
||||
detectorMessenger = new ExP01DetectorMessenger(this);
|
||||
fPMagField = new ExP01MagneticField();
|
||||
fDetectorMessenger = new ExP01DetectorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01DetectorConstruction::~ExP01DetectorConstruction()
|
||||
{
|
||||
delete fpMagField;
|
||||
delete detectorMessenger;
|
||||
delete fPMagField;
|
||||
delete fDetectorMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -101,7 +102,7 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
//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);
|
||||
kStateGas, temperature= 293.15*kelvin, pressure= 1*atmosphere);
|
||||
|
||||
// Print all the materials defined.
|
||||
//
|
||||
@@ -110,15 +111,15 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
|
||||
//--------- Sizes of the principal geometrical components (solids) ---------
|
||||
|
||||
NbOfChambers = 5;
|
||||
ChamberWidth = 20*cm;
|
||||
ChamberSpacing = 80*cm;
|
||||
fNbOfChambers = 5;
|
||||
fChamberWidth = 20*cm;
|
||||
fChamberSpacing = 80*cm;
|
||||
|
||||
fTrackerLength = (NbOfChambers+1)*ChamberSpacing; // Full length of Tracker
|
||||
fTrackerLength = (fNbOfChambers+1)*fChamberSpacing; // Full length of Tracker
|
||||
fTargetLength = 5.0 * cm; // Full length of Target
|
||||
|
||||
TargetMater = Pb;
|
||||
ChamberMater = Xenon;
|
||||
fTargetMater = Pb;
|
||||
fChamberMater = Xenon;
|
||||
|
||||
fWorldLength= 1.2 *(fTargetLength+fTrackerLength);
|
||||
|
||||
@@ -133,14 +134,14 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
|
||||
G4double HalfWorldLength = 0.5*fWorldLength;
|
||||
|
||||
solidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
|
||||
logicWorld= new G4LogicalVolume( solidWorld, Air, "World", 0, 0, 0);
|
||||
fSolidWorld= new G4Box("world",HalfWorldLength,HalfWorldLength,HalfWorldLength);
|
||||
fLogicWorld= new G4LogicalVolume( fSolidWorld, Air, "World", 0, 0, 0);
|
||||
|
||||
// Must place the World Physical volume unrotated at (0,0,0).
|
||||
//
|
||||
physiWorld = new G4PVPlacement(0, // no rotation
|
||||
fPhysiWorld = new G4PVPlacement(0, // no rotation
|
||||
G4ThreeVector(), // at (0,0,0)
|
||||
logicWorld, // its logical volume
|
||||
fLogicWorld, // its logical volume
|
||||
"World", // its name
|
||||
0, // its mother volume
|
||||
false, // no boolean operations
|
||||
@@ -152,18 +153,18 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
|
||||
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
|
||||
fSolidTarget = new G4Box("target",targetSize,targetSize,targetSize);
|
||||
fLogicTarget = new G4LogicalVolume(fSolidTarget,fTargetMater,"Target",0,0,0);
|
||||
fPhysiTarget = new G4PVPlacement(0, // no rotation
|
||||
positionTarget, // at (x,y,z)
|
||||
logicTarget, // its logical volume
|
||||
fLogicTarget, // its logical volume
|
||||
"Target", // its name
|
||||
logicWorld, // its mother volume
|
||||
fLogicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
G4cout << "Target is " << fTargetLength/cm << " cm of "
|
||||
<< TargetMater->GetName() << G4endl;
|
||||
<< fTargetMater->GetName() << G4endl;
|
||||
|
||||
//------------------------------
|
||||
// Tracker
|
||||
@@ -171,13 +172,13 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
|
||||
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
|
||||
fSolidTracker = new G4Box("tracker",trackerSize,trackerSize,trackerSize);
|
||||
fLogicTracker = new G4LogicalVolume(fSolidTracker , Air, "Tracker",0,0,0);
|
||||
fPhysiTracker = new G4PVPlacement(0, // no rotation
|
||||
positionTracker, // at (x,y,z)
|
||||
logicTracker, // its logical volume
|
||||
fLogicTracker, // its logical volume
|
||||
"Tracker", // its name
|
||||
logicWorld, // its mother volume
|
||||
fLogicWorld, // its mother volume
|
||||
false, // no boolean operations
|
||||
0); // copy number
|
||||
|
||||
@@ -188,35 +189,35 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
// 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);
|
||||
fSolidChamber = new G4Box("chamber", 100*cm, 100*cm, 10*cm);
|
||||
fLogicChamber = new G4LogicalVolume(fSolidChamber, fChamberMater,"Chamber",0,0,0);
|
||||
|
||||
G4double firstPosition = -trackerSize + 0.5*ChamberWidth;
|
||||
G4double firstPosition = -trackerSize + 0.5*fChamberWidth;
|
||||
G4double firstLength = fTrackerLength/10;
|
||||
G4double lastLength = fTrackerLength;
|
||||
|
||||
G4VPVParameterisation* chamberParam = new ExP01ChamberParameterisation(
|
||||
NbOfChambers, // NoChambers
|
||||
fNbOfChambers, // NoChambers
|
||||
firstPosition, // Z of center of first
|
||||
ChamberSpacing, // Z spacing of centers
|
||||
ChamberWidth, // Width Chamber
|
||||
fChamberSpacing, // Z spacing of centers
|
||||
fChamberWidth, // Width Chamber
|
||||
firstLength, // lengthInitial
|
||||
lastLength); // lengthFinal
|
||||
|
||||
// dummy value : kZAxis -- modified by parameterised volume
|
||||
//
|
||||
physiChamber = new G4PVParameterised(
|
||||
fPhysiChamber = new G4PVParameterised(
|
||||
"Chamber", // their name
|
||||
logicChamber, // their logical volume
|
||||
logicTracker, // Mother logical volume
|
||||
fLogicChamber, // their logical volume
|
||||
fLogicTracker, // Mother logical volume
|
||||
kZAxis, // Are placed along this axis
|
||||
NbOfChambers, // Number of chambers
|
||||
fNbOfChambers, // 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;
|
||||
G4cout << "There are " << fNbOfChambers << " chambers in the tracker region. "
|
||||
<< "The chambers are " << fChamberWidth/mm << " mm of "
|
||||
<< fChamberMater->GetName() << "\n The distance between chamber is "
|
||||
<< fChamberSpacing/cm << " cm" << G4endl;
|
||||
|
||||
//------------------------------------------------
|
||||
// Sensitive detectors
|
||||
@@ -227,17 +228,17 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
G4String trackerChamberSDname = "ExP01/TrackerChamberSD";
|
||||
ExP01TrackerSD* aTrackerSD = new ExP01TrackerSD( trackerChamberSDname );
|
||||
SDman->AddNewDetector( aTrackerSD );
|
||||
logicChamber->SetSensitiveDetector( aTrackerSD );
|
||||
fLogicChamber->SetSensitiveDetector( aTrackerSD );
|
||||
|
||||
//--------- Visualization attributes -------------------------------
|
||||
|
||||
G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
logicWorld ->SetVisAttributes(BoxVisAtt);
|
||||
logicTarget ->SetVisAttributes(BoxVisAtt);
|
||||
logicTracker->SetVisAttributes(BoxVisAtt);
|
||||
fLogicWorld ->SetVisAttributes(BoxVisAtt);
|
||||
fLogicTarget ->SetVisAttributes(BoxVisAtt);
|
||||
fLogicTracker->SetVisAttributes(BoxVisAtt);
|
||||
|
||||
G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));
|
||||
logicChamber->SetVisAttributes(ChamberVisAtt);
|
||||
fLogicChamber->SetVisAttributes(ChamberVisAtt);
|
||||
|
||||
//--------- example of User Limits -------------------------------
|
||||
|
||||
@@ -247,8 +248,8 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
|
||||
// Sets a max Step length in the tracker region, with G4StepLimiter
|
||||
//
|
||||
G4double maxStep = 0.5*ChamberWidth;
|
||||
logicTracker->SetUserLimits(new G4UserLimits(maxStep));
|
||||
G4double maxStep = 0.5*fChamberWidth;
|
||||
fLogicTracker->SetUserLimits(new G4UserLimits(maxStep));
|
||||
|
||||
// Set additional contraints on the track, with G4UserSpecialCuts
|
||||
//
|
||||
@@ -256,7 +257,7 @@ G4VPhysicalVolume* ExP01DetectorConstruction::Construct()
|
||||
// logicTracker->SetUserLimits(new G4UserLimits(maxStep,maxLength,maxTime,
|
||||
// minEkin));
|
||||
|
||||
return physiWorld;
|
||||
return fPhysiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -266,8 +267,8 @@ void ExP01DetectorConstruction::setTargetMaterial(G4String materialName)
|
||||
// search the material by its name
|
||||
G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
|
||||
if (pttoMaterial)
|
||||
{TargetMater = pttoMaterial;
|
||||
logicTarget->SetMaterial(pttoMaterial);
|
||||
{fTargetMater = pttoMaterial;
|
||||
fLogicTarget->SetMaterial(pttoMaterial);
|
||||
G4cout << "\n----> The target is " << fTargetLength/cm << " cm of "
|
||||
<< materialName << G4endl;
|
||||
}
|
||||
@@ -280,9 +281,9 @@ void ExP01DetectorConstruction::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 "
|
||||
{fChamberMater = pttoMaterial;
|
||||
fLogicChamber->SetMaterial(pttoMaterial);
|
||||
G4cout << "\n----> The chambers are " << fChamberWidth/cm << " cm of "
|
||||
<< materialName << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -291,7 +292,7 @@ void ExP01DetectorConstruction::setChamberMaterial(G4String materialName)
|
||||
|
||||
void ExP01DetectorConstruction::SetMagField(G4double fieldValue)
|
||||
{
|
||||
fpMagField->SetFieldValue(fieldValue);
|
||||
fPMagField->SetFieldValue(fieldValue);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01DetectorMessenger class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01DetectorMessenger.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -43,55 +43,61 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01DetectorMessenger::ExP01DetectorMessenger(ExP01DetectorConstruction* myDet)
|
||||
:myDetector(myDet)
|
||||
: G4UImessenger(),
|
||||
fDetector(myDet),
|
||||
fN02Dir(0),
|
||||
fDetDir(0),
|
||||
fTargMatCmd(0),
|
||||
fChamMatCmd(0),
|
||||
fFieldCmd(0)
|
||||
{
|
||||
N02Dir = new G4UIdirectory("/P01/");
|
||||
N02Dir->SetGuidance("UI commands specific to this example.");
|
||||
fN02Dir = new G4UIdirectory("/P01/");
|
||||
fN02Dir->SetGuidance("UI commands specific to this example.");
|
||||
|
||||
detDir = new G4UIdirectory("/P01/det/");
|
||||
detDir->SetGuidance("detector control.");
|
||||
fDetDir = new G4UIdirectory("/P01/det/");
|
||||
fDetDir->SetGuidance("detector control.");
|
||||
|
||||
TargMatCmd = new G4UIcmdWithAString("/P01/det/setTargetMate",this);
|
||||
TargMatCmd->SetGuidance("Select Material of the Target.");
|
||||
TargMatCmd->SetParameterName("choice",false);
|
||||
TargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fTargMatCmd = new G4UIcmdWithAString("/P01/det/setTargetMate",this);
|
||||
fTargMatCmd->SetGuidance("Select Material of the Target.");
|
||||
fTargMatCmd->SetParameterName("choice",false);
|
||||
fTargMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
ChamMatCmd = new G4UIcmdWithAString("/P01/det/setChamberMate",this);
|
||||
ChamMatCmd->SetGuidance("Select Material of the Target.");
|
||||
ChamMatCmd->SetParameterName("choice",false);
|
||||
ChamMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fChamMatCmd = new G4UIcmdWithAString("/P01/det/setChamberMate",this);
|
||||
fChamMatCmd->SetGuidance("Select Material of the Target.");
|
||||
fChamMatCmd->SetParameterName("choice",false);
|
||||
fChamMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
FieldCmd = new G4UIcmdWithADoubleAndUnit("/P01/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);
|
||||
fFieldCmd = new G4UIcmdWithADoubleAndUnit("/P01/det/setField",this);
|
||||
fFieldCmd->SetGuidance("Define magnetic field.");
|
||||
fFieldCmd->SetGuidance("Magnetic field will be in X direction.");
|
||||
fFieldCmd->SetParameterName("Bx",false);
|
||||
fFieldCmd->SetUnitCategory("Magnetic flux density");
|
||||
fFieldCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01DetectorMessenger::~ExP01DetectorMessenger()
|
||||
{
|
||||
delete TargMatCmd;
|
||||
delete ChamMatCmd;
|
||||
delete FieldCmd;
|
||||
delete detDir;
|
||||
delete N02Dir;
|
||||
delete fTargMatCmd;
|
||||
delete fChamMatCmd;
|
||||
delete fFieldCmd;
|
||||
delete fDetDir;
|
||||
delete fN02Dir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExP01DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == TargMatCmd )
|
||||
{ myDetector->setTargetMaterial(newValue);}
|
||||
if( command == fTargMatCmd )
|
||||
{ fDetector->setTargetMaterial(newValue);}
|
||||
|
||||
if( command == ChamMatCmd )
|
||||
{ myDetector->setChamberMaterial(newValue);}
|
||||
if( command == fChamMatCmd )
|
||||
{ fDetector->setChamberMaterial(newValue);}
|
||||
|
||||
if( command == FieldCmd )
|
||||
{ myDetector->SetMagField(FieldCmd->GetNewDoubleValue(newValue));}
|
||||
if( command == fFieldCmd )
|
||||
{ fDetector->SetMagField(fFieldCmd->GetNewDoubleValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01EventAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01EventAction.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -43,6 +43,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01EventAction::ExP01EventAction()
|
||||
: G4UserEventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01MagneticField class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01MagneticField.cc 68025 2013-03-13 13:43:46Z gcosmo $
|
||||
//
|
||||
// User Field class implementation.
|
||||
//
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
/// \file persistency/P01/src/ExP01PhysicsList.cc
|
||||
/// \brief Implementation of the ExP01PhysicsList class
|
||||
//
|
||||
// $Id: ExP01PhysicsList.cc 68025 2013-03-13 13:43:46Z gcosmo $
|
||||
//
|
||||
//
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01PrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01PrimaryGeneratorAction.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -46,36 +46,37 @@
|
||||
|
||||
ExP01PrimaryGeneratorAction::ExP01PrimaryGeneratorAction(
|
||||
ExP01DetectorConstruction* myDC)
|
||||
:myDetector(myDC)
|
||||
:G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0), fMyDetector(myDC)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
fParticleGun = 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);
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
fParticleGun->SetParticleEnergy(3.0*GeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01PrimaryGeneratorAction::~ExP01PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete fParticleGun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void ExP01PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double position = -0.5*(myDetector->GetWorldFullLength());
|
||||
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
|
||||
G4double position = -0.5*(fMyDetector->GetWorldFullLength());
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01RunAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01RunAction.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -39,6 +39,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01RunAction::ExP01RunAction()
|
||||
: G4UserRunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01SteppingAction class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01SteppingAction.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -38,6 +38,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01SteppingAction::ExP01SteppingAction()
|
||||
: G4UserSteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01SteppingVerbose class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01SteppingVerbose.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -40,6 +40,7 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01SteppingVerbose::ExP01SteppingVerbose()
|
||||
: G4SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01TrackerHit class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01TrackerHit.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -43,7 +43,8 @@ G4Allocator<ExP01TrackerHit> ExP01TrackerHitAllocator;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01TrackerHit::ExP01TrackerHit() {}
|
||||
ExP01TrackerHit::ExP01TrackerHit()
|
||||
: G4VHit(), fTrackID(0), fChamberNb(0), fEdep(0), fPos(0,0,0) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -54,20 +55,20 @@ ExP01TrackerHit::~ExP01TrackerHit() {}
|
||||
ExP01TrackerHit::ExP01TrackerHit(const ExP01TrackerHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
fTrackID = right.fTrackID;
|
||||
fChamberNb = right.fChamberNb;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const ExP01TrackerHit& ExP01TrackerHit::operator=(const ExP01TrackerHit& right)
|
||||
{
|
||||
trackID = right.trackID;
|
||||
chamberNb = right.chamberNb;
|
||||
edep = right.edep;
|
||||
pos = right.pos;
|
||||
fTrackID = right.fTrackID;
|
||||
fChamberNb = right.fChamberNb;
|
||||
fEdep = right.fEdep;
|
||||
fPos = right.fPos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -85,7 +86,7 @@ void ExP01TrackerHit::Draw()
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if(pVVisManager)
|
||||
{
|
||||
G4Circle circle(pos);
|
||||
G4Circle circle(fPos);
|
||||
circle.SetScreenSize(2.);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colour(1.,0.,0.);
|
||||
@@ -99,9 +100,9 @@ void ExP01TrackerHit::Draw()
|
||||
|
||||
void ExP01TrackerHit::Print()
|
||||
{
|
||||
G4cout << " trackID: " << trackID << " chamberNb: " << chamberNb
|
||||
<< " energy deposit[MeV]: " << edep
|
||||
<< " position[mm]: " << pos << G4endl;
|
||||
G4cout << " trackID: " << fTrackID << " chamberNb: " << fChamberNb
|
||||
<< " energy deposit[MeV]: " << fEdep
|
||||
<< " position[mm]: " << fPos << G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// \brief Implementation of the ExP01TrackerSD class
|
||||
//
|
||||
//
|
||||
// $Id$
|
||||
// $Id: ExP01TrackerSD.cc 71111 2013-06-11 10:51:02Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -44,11 +44,12 @@
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ExP01TrackerSD::ExP01TrackerSD(G4String name)
|
||||
:G4VSensitiveDetector(name)
|
||||
:G4VSensitiveDetector(name), fTrackerCollection(0), fHCID(0)
|
||||
{
|
||||
G4String HCname = name + "_HC";
|
||||
collectionName.insert(HCname);
|
||||
G4cout << collectionName.size() << " CalorimeterSD name: " << name << " collection Name: " << HCname << G4endl;
|
||||
G4cout << collectionName.size() << " CalorimeterSD name: " << name << " collection Name: "
|
||||
<< HCname << G4endl;
|
||||
fHCID = -1;
|
||||
}
|
||||
|
||||
@@ -66,7 +67,8 @@ void ExP01TrackerSD::Initialize(G4HCofThisEvent* HCE)
|
||||
fTrackerCollection = new ExP01TrackerHitsCollection
|
||||
(SensitiveDetectorName,collectionName[0]);
|
||||
if (fHCID < 0) {
|
||||
G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " " << collectionName[0] << G4endl;
|
||||
G4cout << "CalorimeterSD::Initialize: " << SensitiveDetectorName << " "
|
||||
<< collectionName[0] << G4endl;
|
||||
fHCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
/// \file persistency/P01/src/RootIO.cc
|
||||
/// \brief Implementation of the RootIO class
|
||||
//
|
||||
// $Id: RootIO.cc 71791 2013-06-24 14:08:28Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "RootIO.hh"
|
||||
@@ -37,9 +42,13 @@
|
||||
#include "G4Event.hh"
|
||||
//
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
static RootIO* instance = 0;
|
||||
|
||||
RootIO::RootIO():Nevents(0)
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RootIO::RootIO():fNevents(0)
|
||||
{
|
||||
// initialize ROOT
|
||||
TSystem ts;
|
||||
@@ -49,12 +58,16 @@ RootIO::RootIO():Nevents(0)
|
||||
ROOT::Cintex::Cintex::Enable();
|
||||
//gDebug = 1;
|
||||
|
||||
fo = new TFile("hits.root","RECREATE");
|
||||
fFile = new TFile("hits.root","RECREATE");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RootIO::~RootIO()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
RootIO* RootIO::GetInstance()
|
||||
{
|
||||
if (instance == 0 )
|
||||
@@ -64,23 +77,29 @@ RootIO* RootIO::GetInstance()
|
||||
return instance;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RootIO::Write(std::vector<ExP01TrackerHit*>* hcont)
|
||||
{
|
||||
Nevents++;
|
||||
fNevents++;
|
||||
|
||||
std::ostringstream os;
|
||||
os << Nevents;
|
||||
os << fNevents;
|
||||
std::string stevt = "Event_" + os.str();
|
||||
const char* chevt = stevt.c_str();
|
||||
|
||||
std::cout << "writing " << stevt << std::endl;
|
||||
|
||||
|
||||
fo->WriteObject(hcont, chevt);
|
||||
fFile->WriteObject(hcont, chevt);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void RootIO::Close()
|
||||
{
|
||||
fo->Close();
|
||||
fFile->Close();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user