I am following the Geant4 tutorials by Physics Matters on YouTube, and tutorial 10: user-defined messengers goes through how to implement a messenger to edit the parameters of the detector(s).
However, i keep getting weird errors, and i am not sure where i am going wrong…
i am getting errors like these:
This is my code for the messenger:
MyDetectorConstruction::MyDetectorConstruction() : nCols(0), nRows(0) {
fMessenger = new G4GenericMessenger(this, "/detector/", "Detector Construction");
fMessenger->DeclareProperty("nCols", nCols, "Number of columns");
fMessenger->DeclareProperty("nRows", nRows, "Number of rows");
DefineMaterials();
}
MyDetectorConstruction::~MyDetectorConstruction()
{
delete fMessenger;
}
class MyDetectorConstruction : public G4VUserDetectorConstruction
{
public:
MyDetectorConstruction();
~MyDetectorConstruction();
virtual G4VPhysicalVolume *Construct();
private:
G4int nRows, nCols;
G4Box *solidWorld, *solidRadiator, solidDetector;
G4LogicalVolume *logicWorld, *logicRadiator, logicDetector;
G4VPhysicalVolume *physWorld, *physRadiator, *physDetector;
G4Material *SiO2, *H2O, *Aerogel, *worldMat;
G4Element *C;
G4GenericMessenger *fMessenger;
void DefineMaterials();
virtual void ConstructSDandField();
};
/detector/nCols 10
/detector/nCols 10
/run/reinitializeGeometry
/run/beamOn 100