A question about absorbed dose

I recently needed to calculate dose when extracting data, and I got the Mass of SD through the GetMass() function.

i added a variable named boxmass and a function named Getboxmass to DetectorConstruction. In DetectorConstruction::DefineVolumes. I use the GetMass() function by using it on the TinyboxLV logical body and assign the obtained value to boxmass. here is my code.

 auto TinyboxS = new G4Box("TinyBoxS",0.5*cm,0.5*cm,0.5*cm);
  auto TinyboxLV = new G4LogicalVolume(TinyboxS,Water_mat,"TinyboxLV");
  G4VPVParameterisation* cellParam = new CellParameterisation();
  new G4PVParameterised("Tinybox",TinyboxLV,waterboxLV,kZAxis,kNofTinybox,cellParam);
  boxmass = TinyboxLV->GetMass();
  G4double Getboxmass(){
      return boxmass;

Because I am in EventAction: : EndOfEventAction will fill data into tuples, so I need to get the probe’s molar mass . Here is my code.

void EventAction::EndOfEventAction(const G4Event* event){
  DetectorConstruction*dect = new DetectorConstruction;
  mass = dect->Getboxmass();

But I found a strange problem when running it. When I got the mole mass through GetMass() in DetectorConstruction, I output it once, and the value is 6.24151e+21. When I get the molar mass from the Getboxmass I wrote in EndOfEventAction and output it, I find that the value is 0. Also, when I filled the tuple, I expected to get an error become mass=0, but it didn’t. I did the math based on the output and got mass=0.0078.

The object I’m probing is made of water, which seems strange, and I don’t know what’s wrong with me. Thank you for your messages.