Message: Update Sensitive detector volumes after DetectorMessenger command Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Update Sensitive detector volumes after DetectorMessenger command 

Forum: Run Management
Date: 03 Sep, 2014
From: filippo <filippo>

Hello!

I'm using Detector messenger to change geometry in my simulation:

In my DetectorMessenger source I've defined my custom command like:

/folder/my_category/my_command (a UIcmdWithString), this command changes a (global) variable in my DetectorConstruction and consequently in my DetectorConstruction::Construct method

then I've implemented my UpdateGeometry:

void DetectorConstruction::UpdateGeometry() {

  G4RunManager::GetRunManager()->DefineWorldVolume(Construct());

}

And in my DetectorConstruction::Construct i've added:

G4GeometryManager::GetInstance()->OpenGeometry(); G4PhysicalVolumeStore::GetInstance()->Clean(); G4LogicalVolumeStore::GetInstance()->Clean(); G4SolidStore::GetInstance()->Clean();

The result of my implementation is that the application changes the geometry, update the visualization and so on...

The problem is that when I /run/beamOn the app crashes because it can't find a CellHitCollection.

The reason for this is that:
 DetectorConstruction::ConstructSDandField()

is not "updated" after my custom command.

My command simply create a solid stored inside an IF statement in my DetectorConstruction:Construct, the same statement is placed in ConstructSDandField():

    if (geometry_status=="water_phantom"){

    SetSensitiveDetector("sens_lb_Phantom", aTrackerSD, true);

}

So my question is: How can I fix the problem, making geant "re-run" ConstructSDandField as it "re-run" the Construct method? I mean: how can I update the SDManager?

Thank you very much!

Filippo

 Add Message Add Message
to: "Update Sensitive detector volumes after DetectorMessenger command"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]