Coming back to fElectricField units at TRestDetectorGas and TRestDetectorDriftVolume

Hi @nkx,

I have a bit of confusion again with the units used at TRestDetectorDriftVolume and TRestDetectorGas.

Obviously, TRestDetectorDriftVolume is using standard REST units, i.e. V/mm. So, when I do pointer->SetElectricField(x) x is in V/mm and therefore it is directly assigned to fElectricField. The TRestDetectorDriftVolume::fElectricField is measured then in V/mm.

So, if I want to get the drift velocity at 10bar and 100V/cm, I believe I should do:

gas->SetPressure(10);
gas->SetElectricField(1000);

since I assume I must give the field in V/mm. Is this right?

If I look at the code, it is a bit misleading if the result will be returned in mm/us or cm/us. From the code I believe the result will be returned in cm/us, although the comment says //in standard unit mm/us.

If I use the standard PandaX-III gas mixture that I know well the result, and test this code:

TRestDetectorGas *gg = new TRestDetectorGas("server", "Xenon-TMA 1Pct 0.1-10E3Vcm");
gg->SetPressure(10);
gg->SetElectricField(1000);
gg->GetDriftVelocity()
(double) 11.425579

I believe I do not get the right result. But I do if I set

gg->SetElectricField(100);
root [10] gg->GetDriftVelocity()
(double) 1.8736602

That is, as if I would give the argument in V/cm and returned value in cm/us. But from the code I deduce the argument of SetElectricField should be in V/mm.

Where I am getting it wrong?

It’s right.

The code is also correct. TRestDetectorGas::GetDriftVelocity() returns in standard unit mm/us.

You should SetElectricField(100) to set 100V/mm, which is 1kV/cm as in PandaX-III gas mixture. If you don’t look into the code, it will be simple to comprehend that we always input a number in REST unit, and get the returned result in REST unit.

Indeed the code to multiply and divide the REST unit object is confusing: multiply means convert the value with REST unit to this unit. For example, 1*units("V/cm") = 10, which means 1V/mm = 10V/cm. On the other hand, divide means to strip the custom unit and make it become REST unit. 0.18/units("cm/us") = 1.8, which means 0.18cm/us is converted to 1.8mm/us in REST units.

Ok, then in PandaX-III 1kV/cm at 10bar is 1.87mm/us.

Where are the standard REST units defined? I’m sometimes also confused with units, so knowing this would be very helpful.

They are defined at the TRestSystemOfUnits header.

The default unit is the one that implements a conversion factor of 1. I.e. for distance it is mm because I read 1 at the third argument at the following line:

AddUnit(mm, REST_Units::Distance, 1.);
1 Like