I get a value of 19.42 mm/us from GetDriftVelocity(). However, if I read it from the plot, I get 34.2 mm/us.
If I use the gas in my RML configuration file and then print the metadata, I find that the value that is used in the analysis matches that of the plot:
Good, in fact I was going to ask about the units because I was confused. And just to make sure, in the case of the drift velocity, if one inputs the value manually in the RML, it must also be done in mm/us, right?
It should, those are the standard units, it will be the case if you do not specify units. Because you could write it as β3cm/usβ to say that the value is written in cm/us
It seems that TRestDetectorGas is computing the drift velocity for pressure of 1bar instead of 10bar.
I chekced that if I generate the TRestDetectorGas object by hand as you suggested @jgalan everything works fine.
So I guess the issue is in the inicialization of TRestDetectorGas through the instance <TRestDetectorGas name="Neon-Isobutane 2Pct 10-10E3Vcm" pressure="10" file="server" /> in the TRestRun section of the rml.
PD: I noted that when parameters are defined as a global variable is better not to set units in its definition and do it on each specific section they are used.
Instead of <variable name="DRIFT_FIELD" value="16V/mm" /> better <variable name="DRIFT_FIELD" value="16" /> and then
I imagine the GetDriftVelocity method there should be called without arguments, and then you will get 6.41mm/us out on screen which I guess is the right one.
So, I bet the one used by the process is the good one, and the one printed by TRestDetectorGas is the bad one.
Perhaps it is an initialisation problem inside TRestDetectorGas, I believe the problem dissapears when we call TRestDetectorGas::SetPressure. But this probably never happened the time you call PrintMetadata. So if you introduce in the first line inside PrintGasInfo the line this->SetPressure(fPressureInAtm) does it solve the problem?
The problem does not appear in the process or in restRoot because you call SetPressure method.
You could also try : md0_xyz_frt->SetPressure(10) and call again GetDriftVelocity.