Problem 2528 - photonNuclear and gamma fail
Summary: photonNuclear and gamma fail
Status: RESOLVED FIXED
Alias: None
Product: Geant4
Classification: Unclassified
Component: processes/hadronic (show other problems)
Version: 11.1
Hardware: All All
: P4 minor
Assignee: Vladimir.Ivantchenko
URL:
Depends on:
Blocks:
 
Reported: 2023-02-01 21:30 CET by John.Allison
Modified: 2023-04-01 20:31 CEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description John.Allison 2023-02-01 21:30:23 CET
When I
  G4HadronicParameters::Instance()->SetVerboseLevel(0);
I get, in each thread
G4WT0 > G4HadronicProcess::BuildPhysicsTable: for photonNuclear and gamma fail due to undefined pointer to the master process
Comment 1 Vladimir.Ivantchenko 2023-02-03 08:55:46 CET
Hi, John,

in what application? Or as minimum with which Physics List?

Vladimir
Comment 2 John.Allison 2023-02-03 11:32:30 CET
Hi Vladimir

In a very simple application firing 4 MeV gammas into a block of Lutetium.

  // Physics list
  const auto physList = G4PhysListFactory().GetReferencePhysList("FTFP_BERT_EMZ");
  physList->SetVerboseLevel(0);
  runManager->SetUserInitialization(physList);
  G4HadronicParameters::Instance()->SetVerboseLevel(0);

It's not a big problem for me. The message appears only once per thread independent of number of events. The relevant bit of code seems to be G4HadronicProcess.cc:220:

    if(nullptr == masterProcess) {
      masterProcess = 
	dynamic_cast<const G4HadronicProcess*>(GetMasterProcess());
    }
    if(nullptr == masterProcess) {
      G4cout << "G4HadronicProcess::BuildPhysicsTable: for "
	     << GetProcessName() << " and " << p.GetParticleName()
	     << " fail due to undefined pointer to the master process" 
	     << G4endl;
    } else {
      // initialisation in worker threads
      fXSType = masterProcess->CrossSectionType();
      fXSpeaks = masterProcess->TwoPeaksXS();
      theEnergyOfCrossSectionMax = 
	masterProcess->EnergyOfCrossSectionMax();
    }

If I do not "G4HadronicParameters::Instance()->SetVerboseLevel(0)", the message does not appear but, of course, I get lots of output that I wish to suppress.

Cheers, John
Comment 3 John.Allison 2023-02-03 11:38:05 CET
P.S. I'm guessing that if param->GetVerboseLevel()>0, masterProcess is instantiated somewhere else, whereas if param->GetVerboseLevel()==0, it triggers the warning message, but gets instantiated in the "else" clause anyway, so all's well. It's just annoying message.
Comment 4 Vladimir.Ivantchenko 2023-02-03 16:50:21 CET
Hi John,

at Lunux I have added lines to the main of Hadr00.cc example:

  runManager->SetUserInitialization(phys);
  phys->SetVerboseLevel(0);
  det->SetPhysicsList(phys);
  G4HadronicParameters::Instance()->SetVerboseLevel(0);

use modified hadr00.in macro - comment out the first line limiting printout in threads and use the command:

 $G4BWORK/Hadr00 hadr00.in FTFP_BERT_EMZ 2

No problem is observed. It well may be that the problem is seen at MAC  and not at Linux. To avoid misunderstanding can you, please, reproduce the problem in Hadr00?

Vladimir
Comment 5 Vladimir.Ivantchenko 2023-02-03 19:12:00 CET
Hi John,

Lines of code in G4HadronicProcess, which you have shown, has relation to threading and not to verbosity level, so we need to reproduce this problem locally, because not clear how verbosity level connect to instantiation of processes per thread. May be there is a difference in MAC and Linux. Have you tried the same job for the case of 1 thread?

Vladimir
Comment 6 Vladimir.Ivantchenko 2023-04-01 20:31:23 CEST
Hi John,

the problem was due to specifics of G4GammaGeneralProcess in the MT mode. It is fixed and the fix may be back-ported to the patch.

Cheers,
Vladimir