Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve physics process store #54

Merged
merged 21 commits into from
Jul 6, 2022
Merged

Conversation

lobis
Copy link
Member

@lobis lobis commented Jun 15, 2022

lobis Large: 352

Related PR: rest-for-physics/restG4#55

Currently Geant4 process names - id relation are being stored in a hardcoded map on TRestGeant4Track.

This PR provides a container class, TRestGeant4PhysicsInfo that stores this information (which can be different across Geant4 versions) without adding noticable overhead.

Additionally this class can be used to print which particles or processes took place in the simulation for a quick overview:

const auto& physicsInfo = (TRestGeant4Metadata*)run.GetMetadataClass("TRestGeant4Metadata")->GetGeant4PhysicsInfo();
physicsInfo.Print(); // Notice how this isn't a pointer! its an immutable reference
Particles:
	11 - e-
	22 - gamma
Processes:
	1091 - Transportation
	2002 - eIoni
	2003 - eBrem
	2010 - msc
	2011 - Rayl
	2012 - phot
	2013 - compt
	7401 - e-Step

Since Geant4 does not provide a way to generate a processID (only provides process name) I created one which should be unique (process->GetProcessType() * 1000 + process->GetProcessSubType()). This breaks compatilibty with old versions of REST where processes where using the manual assignment found on TRestGeant4Track.

This PR also deprecates some methods related to processes, which in my opinion were too specific, redundant, or were not garanteed to work in the current version. Methods such as isPhotoElectric have been replaced by the more generic ContainsProcess

Now also print methods for event or track have access to the corresponding metadata class to access the volume / process names, so now print statements are more user readable, showing volume names instead of IDs and showing the Geant4 process names instead of the hardcoded ones.

inc/TRestGeant4Metadata.h Outdated Show resolved Hide resolved
@lobis lobis requested a review from jgalan July 4, 2022 16:04
@lobis lobis marked this pull request as ready for review July 4, 2022 16:06
@lobis lobis requested review from juanangp and glorialuzon July 4, 2022 16:06
@lobis
Copy link
Member Author

lobis commented Jul 5, 2022

@juanangp could you also please review the related PR? rest-for-physics/restG4#55 ty

@lobis lobis merged commit 213a829 into master Jul 6, 2022
@lobis lobis deleted the lobis-remove-process-hardcoding branch July 6, 2022 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants