Dear Experts
I have successfully created the proportional counter of dimension 6m0.1m0.1m, it also has a tungsten wire which is kept at 3000v potential difference. I have to figure out how should i implement an Electric field generated from the tungsten wire which works as an anode.
Thanks
#include “construction.hh”
#include “G4Box.hh”
#include “G4LogicalVolume.hh”
#include “G4NistManager.hh”
#include “G4PVPlacement.hh”
#include “G4SystemOfUnits.hh”
#include “G4VisAttributes.hh”
#include “G4Tubs.hh”
#include “G4SDManager.hh”
MyDetectorConstruction::MyDetectorConstruction()
: G4VUserDetectorConstruction(), LogicDetector(nullptr), LogicAnode(nullptr), fElectricFieldSetup(nullptr)
{
fMessenger = new G4GenericMessenger(this, “/Detector/”, “Detector construction”);
fMessenger->DeclareProperty(“nCols”, nCols, “Number of columns”);
fMessenger->DeclareProperty(“nRows”, nRows, “Number of rows”);
nCols = 80;
nRows = 80;
DefineMaterials();
}
MyDetectorConstruction::~MyDetectorConstruction() {
delete fElectricFieldSetup;
}
void MyDetectorConstruction::DefineMaterials()
{
G4NistManager* nist = G4NistManager::Instance();
air = nist->FindOrBuildMaterial(“G4_AIR”);
tungsten = nist->FindOrBuildMaterial(“G4_W”);
argon = nist->FindOrBuildMaterial("G4_Ar");
methane = nist->FindOrBuildMaterial("G4_METHANE");
P10 = new G4Material("P10", 1.66 * mg/cm3, 2, kStateGas, 298.0 * kelvin, 1.0 * atmosphere);
P10->AddMaterial(argon, 90 * perCent);
P10->AddMaterial(methane, 10 * perCent);
mildSteel = nist->FindOrBuildMaterial("G4_STAINLESS-STEEL");
}
G4VPhysicalVolume* MyDetectorConstruction::Construct()
{
// Define dimensions
G4double world_sizeX = 8.0 * m;
G4double world_sizeY = 2.5 * m;
G4double world_sizeZ = 2.5 * m;
G4double detector_sizeX = 6.0 * m;
G4double detector_sizeY = 0.1 * m;
G4double detector_sizeZ = 0.1 * m;
G4double anode_radius = 100 * um;
G4double anode_length = detector_sizeX;
// Create world volume
solidWorld = new G4Box("World", world_sizeX / 2, world_sizeY / 2, world_sizeZ / 2);
logicWorld = new G4LogicalVolume(solidWorld, air, "World");
physWorld = new G4PVPlacement(0, G4ThreeVector(), logicWorld, "World", 0, false, 0);
// Create primary detector volume (cuboidal)
solidCounter = new G4Box("Counter", detector_sizeX / 2, detector_sizeY / 2, detector_sizeZ / 2);
logicCounter = new G4LogicalVolume(solidCounter, P10, "Counter");
new G4PVPlacement(0, G4ThreeVector(), logicCounter, "Counter", logicWorld, false, 0);
// Set blue color for the detector
G4VisAttributes* detectorVisAttr = new G4VisAttributes(G4Colour(0.0, 0.0, 1.0)); // Blue color
detectorVisAttr->SetVisibility(true);
logicCounter->SetVisAttributes(detectorVisAttr);
// Create mild steel PRC body
solidCounter = new G4Box("CounterBody", detector_sizeX / 2, detector_sizeY / 2, detector_sizeZ / 2);
G4LogicalVolume* logicCounterBody = new G4LogicalVolume(solidCounter, mildSteel, "CounterBody");
new G4PVPlacement(0, G4ThreeVector(), logicCounterBody, "CounterBody", logicWorld, false, 0);
// Set grey color for the PRC body
G4VisAttributes* counterBodyVisAttr = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)); // Grey color
counterBodyVisAttr->SetVisibility(true);
logicCounterBody->SetVisAttributes(counterBodyVisAttr);
// Place the gas volume inside the PRC body
new G4PVPlacement(0, G4ThreeVector(), logicCounter, "Counter", logicCounterBody, false, 0);
// Create tungsten anode (cylindrical) parallel to the detector
solidAnode = new G4Tubs("Anode", 0.0, anode_radius, anode_length / 2, 0.0, 360.0 * deg);
LogicAnode = new G4LogicalVolume(solidAnode, tungsten, "Anode");
// Place the anode at the center of the detector volume
G4ThreeVector anodePosition(0, 0, 0);
G4RotationMatrix *rotationMatrix = new G4RotationMatrix();
rotationMatrix->rotateY(90.0 * deg); // Rotate the anode to align with the X-axis
new G4PVPlacement(rotationMatrix, anodePosition, LogicAnode, "Anode", logicCounter, false, 0);
// Set red color for the anode to see the difference
G4VisAttributes *anodeVisAttr = new G4VisAttributes(G4Colour(1.0, 0.0, 0.0));
anodeVisAttr->SetVisibility(true);
LogicAnode->SetVisAttributes(anodeVisAttr);
fScoringVolume = logicCounter;
return physWorld;
}
void MyDetectorConstruction::ConstructSDandField() {
// Create a sensitive detector and register it
G4String detectorName = “Counter”;
MySensitiveDetector* aDetector = new MySensitiveDetector(detectorName);
G4SDManager::GetSDMpointer()->AddNewDetector(aDetector);
// Assign the sensitive detector to the logical volume
SetSensitiveDetector(logicCounter, aDetector);
}
______________________________________________________________________________________________________________ oooo0000oooo __________________________________
_Geant4 Version:_11.2.1
_Operating System:_Ubuntu 22.04.4 LTS