How to use VecGeomNavigator during the simulation with ROOT Geometry through VMC with Geant4 runconfiguration

@agheata Could you please guide here on how to make use of VecGeomNavigator with ROOT Geometry during simulation when the run configuration is done through Geant4 VMC? For example, the g4config.C file described how to set the different navigators.

/// - geomVMCtoGeant4 - geometry defined via VMC, G4 native navigation
/// - geomVMCtoRoot - geometry defined via VMC, Root navigation
// - geomRoot - geometry defined via Root, Root navigation
/// - geomRootToGeant4 - geometry defined via Root, G4 native navigation
// - geomGeant4 - geometry defined via Geant4, G4 native navigation

TG4RunConfiguration* runConfiguration =
new TG4RunConfiguration(“geomRoot”, “QGSP_BERT_EMV+optical”, “stepLimiter+specialCuts”);
/// Create the G4 VMC
TGeant4* geant4 = new TGeant4(“TGeant4”, “The Geant4 Monte Carlo”, runConfiguration);
cout << “Geant4 has been created.” << endl;

I do not have an idea for the VecGeomNavigator. How to use it.

Is it required to compile the ROOT, GEANT4 and VMC with VecGeomNavigator?

Could you please help here with how can It be done?

g4Config.C (3.4 KB)

Hi,

Thanks for the post.
Could you please be a bit more specific about what you are trying to achieve exactly?

Best,
Danilo

@Danilo

TG4RunConfiguration* runConfiguration =
new TG4RunConfiguration(“geomRoot”, “QGSP_BERT_EMV+optical”, “stepLimiter+specialCuts”);

So in this code line “geomRoot” is set in the TG4RunConfiguration which uses the default Root navigator during the run transport of let’s say UrQMD model-based events and processes the different Electromagnetic and Hadronic processes etc… by changing the default ROOT navigator to VecGeomNavigator I wanted to check the simulation run time for the tessellated solid based geometry and also wanted to check how the changing the navigator different physics processes in Geant4 varies or are they doing the same performance or not.

For Example, for the moment I have prepared the geometry from the gdml file using GDMLParser Root function based on Tessellated Solids and converted to VGsolids using auto convertor = TVirtualGeoConverter::Instance(gGeoMan);
if(!convertor){
printf(“Raytracing a tessellated shape without VecGeom support will just draw a box\n”);
}else {
convertor->ConvertGeometry();
}

Geometry you can see :

and some comparison was done between different geometry versions where we can see some differences in EM processes between the Geometry prepared using ROOT Solids from TGeo class and the geometry based on tessellated solids.

Geant_Processes.pdf (16.5 KB)

We do see these differences because some of the complicated volume structures are not included in v24a /ROOTTGeo-based geo. which is known and understood.

However, I need to check and prove in our CBM(Compressed Baryonic Matter Experiment) collaboration, software/ STS group that if we keep the two geometry with the same volumes in their volume assemblies and even change the navigator it will not affect the physics performance. it will be the same. Also, I have to check how much simulation run-time it takes with two different navigators.

Hi, you can put the geometry conversion code to VecGeom inside the method InitGeometry() of the class in your framework that derives from TVirtualMCApplication

@agheata Yes, right the below conversion code I am already using

TVirtualGeoConverter::Instance(gGeoMan);
if(!convertor){
printf(“Raytracing a tessellated shape without VecGeom support will just draw a box\n”);
}else {
convertor->ConvertGeometry();
}

and this will convert the geometry into the VecGeom ones.

What I wanted to know is to make use of VecGeomNavigator, not the default ROOT Navigator.
for example;
// make the G4VecGeomNavigator
auto nav = new G4VecGeomNavigator(g4geometry);

// hooking the navigator into G4
auto trMgr = G4TransportationManager::GetTransportationManager();

trMgr->SetNavigatorForTracking(nav);

Therefore, I wanted to know how that can be done or set. during event transportation? We are using VMC not direct use of GEANT4. During the simulation transport, the geometry is imported to

[14:01:23.297906][INFO][FairMCApplication.cxx:841:ConstructGeometry] TGeometry will be imported to VMC

and then set the navigator

Info in TObject::SetNavigator: TG4RootNavigator created and registered to G4TransportationManager

as per

TG4RunConfiguration* runConfiguration =
new TG4RunConfiguration(“geomRoot”, “QGSP_BERT_EMV+optical”, “stepLimiter+specialCuts”);
/// Create the G4 VMC
TGeant4* geant4 = new TGeant4(“TGeant4”, “The Geant4 Monte Carlo”, runConfiguration);
cout << “Geant4 has been created.” << endl;

based on which one from the below is used in the TG4RunConfiguration setting.

geomVMCtoGeant4 - geometry defined via VMC, G4 native navigation
geomVMCtoRoot - geometry defined via VMC, Root navigation
geomRoot - geometry defined via Root, Root navigation
geomRootToGeant4 - geometry defined via Root, G4 native navigation
geomGeant4 - geometry defined via Geant4, G4 native navigation

You cannot use a VecGeom navigator with Geant4 yet. This will likely be implemented at some point in Geant4, but will not work with ROOT geometry behind the scene, converted to VecGeom or not. The current converter in ROOT only makes use of VecGeom solids, not of VecGeom navigation, and it is going to stay like that.

@agheata That means the G4VecGeomNav ( https://gitlab.cern.ch/VecGeom/g4vecgeomnav), is still not integrated into Geant4 or Geant4_vmc as it is under development. if I understood correctly from your comment.

many thanks :smiley:

This is correct. Cheers