Hello, I have dome some analysis using this process TRestG4toHitsProcess and I found that the configuration option addVolume does not seem to work in restricting hits to the selected volume. I have used different values and got the same results, which don’t correspond to the hits on the gas volume (id 0) but to all the experiment.
my processes configuration is the following:
<TRestG4toHitsProcess name="G4ToHits" title="G4Hits to Hits process">
<!-- We can re-define the volume considered for hits , default is "0"-->
<parameter name="hitVolume" value="0" />
<!-- <parameter name="hitStartVolume" value="0" /> -->
<!--First volume =="0" (gasVolume) by default -->
<!-- <parameter name="hitEndVolume" value="0" /> -->
<!--Last volume =="0" (gasVolume) by default -->
</TRestG4toHitsProcess>
first, lets verify the content of your TRestG4Event. The volume id should appear in each hit.
So, could you dump here the output of TRestG4Event::PrintEvent? On one of those events?
Second, the parameter hitVolume does not exist, did you coded in your local version?
Third, could you also output the contents of fVolumeSelection and fVolumeIds inside InitProcess method?
Right after this …
68 for (unsigned int n = 0; n < fVolumeSelection.size(); n++) {
69 if (fG4Metadata->GetActiveVolumeID(fVolumeSelection[n]) >= 0)
70 fVolumeId.push_back(fG4Metadata->GetActiveVolumeID(fVolumeSelection[n]));
71 else if (GetVerboseLevel() >= REST_Warning)
72 cout << "TRestG4ToHitsProcess. volume name : " << fVolumeSelection[n]
73 << " not found and will not be added." << endl;
74 }
fVolumeSelection should contain all the volumes you added using the addVolume key definition.
IMPORTANT. If there is no volumes added. All volumes will be added to the TRestHitsEvent structure.
Yes, I don’t think it exists either, I found it in a supposedly updated processes file, I also tried replacing hitVolume with addVolume both having no effect. I will try to get those outputs you requested. do you think it could be a good idea to add another variable to the hits so that we can know the volume id of said hit by looking at the tree?.
I am trying to print those outputs you request using the root console, by loading the run and restG4metadata but don’t know how to access the TRestG4Event
Of course, accessing to TRestG4Metadata contents will allow you to know the names of activeVolumes stored.
From TRestG4Metatada.h
358 /// Returns the number of active volumes, or geometry volumes that have been
359 /// selected for data storage.
360 Int_t GetNumberOfActiveVolumes() { return fActiveVolumes.size(); }
361
362 /// Returns a string with the name of the active volume with index n
363 TString GetActiveVolumeName(Int_t n) { return fActiveVolumes[n]; }
I thought it would be convenient to add few debug output lines directly on the process to be able to check volumes that have been selected, and volumes that are available in the event/metadata.
They will print out when we set verboseLevel="debug".
Additionally I added the possibility to print out the input G4Event when setting the process into verboseLevel="extreme".
It would be easier if you copy paste the code as text, so that I can quote the text and in future we can search for in the forum for related issues.
The GetKEYDefinition( "addVolume", position ) call will retrieve a definition such as:
<addVolume .... >
Then, using GetFieldValue("name", addVolumeDefinition) will retrieve the name from the volume to be pushed into fVolumeSelection (which is a string with the name of the volume, and not the id).
where gas, vessel and shielding are valid active volume names.
Notice that we use the special key <addVolume in order to search inside InitFromConfigFile iteratively for all the entries defined inside the process definition.
If you run the process in debug mode, now after the commits I pushed, it should print out the active volume names in your ROOT file (i.e. inside TRestG4Metadata).
I am surprised, it is this “updated” file available in the repository?
well the IAXO git repository uses 2.1 REST so yes. I am traying to update it to 2.2 manually updating files and using files from other people’s folders that I know have been recently used like this one.
However, the way processes are defined in 2.2 with respect to 2.1 should not change. Except if the process was modified. But TRestG4toHitsProcess has not changed since a long time ago.