Messenger file, command not found

Hello, I created a messenger file, that should set the position of a surface by the command line

/Chamber20nep/DummySurfacePos 0 0 10 mm

I don’t get errors during the compiling, but when I run the simulation I get

***** COMMAND NOT FOUND </Chamber20nep/DummySurfacePos 0 0 10 mm> *****

I don’t understand what I’m wrong

Chamber20nepMessenger.cc (1.7 KB)
Chamber20nepMessenger.hh (576 Bytes)

Thanks

Do you instantiate the Chamber20nepMessenger class?

Hi @mkelsey
how and where should I instantiate it?

I call it in the Chamber20nep.cc

Chamber20nep::Chamber20nep()
{
chamber20NepMessenger = new Chamber20nepMessenger(this);
}


Chamber20nep::~Chamber20nep()
{

delete chamber20NepMessenger;
}

Chamber20nep.cc (3.4 KB)
Chamber20nep.hh (752 Bytes)

and when i compile, I see Chamber20nepMessenger files are processed

[ 10%] Building CXX object CMakeFiles/SimLuna.dir/src/Chamber20nepMessenger.cc.o

should I do something more to instantiate the class?

That’s exactly right. I guess that Chamber20nep is your detector construction class? Do you start running your macro commands before the DetectorConstruction has been created?

Hello @mkelsey
Chambe20nep is a piece of the full setup and it is called in the DetectorConstruction. Thanks to your suggestion to run the macro before detectorconstruction is created, I understood the problem. I had to get istance in the detector construction to make working the chamber messenger

DetectorConstruction::DetectorConstruction():G4VUserDetectorConstruction()
{
  detectorConstructionMessenger = new DetectorConstructionMessenger(this);
  materials = Materials::GetInstance();
  AGePD = GePD::GetInstance();
  AGeDD = GeDD::GetInstance();
  AChamber20nep = Chamber20nep::GetInstance();
}

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.