AlongStepDoIt (after all invocations):
++List of invoked processes
1) CoupledTransportation
++G4Step Information
Address of G4Track : 0x7f87f26e1470
Step Length (mm) : 2256.179710119461
Energy Deposit (MeV) : 0
-----------------------------------------------------------------------
StepPoint Information PreStep PostStep
-----------------------------------------------------------------------
Position - x (mm) : 0 507.6507772455736
Position - y (mm) : 0 1395.593722444087
Position - z (mm) : 1698.515744581532 0
Global Time (ns) : 0.03835567841198741 7.564161114516256
Local Time (ns) : 0 7.525805436104268
Proper Time (ns) : 0 0
Momentum Direct - x : 0.2250045840624524 0.2250045840624524
Momentum Direct - y : 0.6185649645657849 0.6185649645657849
Momentum Direct - z : -0.7528282153071921 -0.7528282153071921
Momentum - x (MeV/c): 8.137314257714439e-078.137314257714439e-07
Momentum - y (MeV/c): 2.237046647941492e-062.237046647941492e-06
Momentum - z (MeV/c): -2.722611095038221e-06-2.722611095038221e-06
Total Energy (MeV) : 3.616510433163372e-063.616510433163372e-06
Kinetic Energy (MeV): 3.616510433163372e-063.616510433163372e-06
Velocity (mm/ns) : 299.792458 299.792458
Volume Name : WCD_10010 WCD_10010
Safety (mm) : 0 5e-10
Polarization - x : 0.2573464190273144 0.2573464190273144
Polarization - y : 0.7074766019992675 0.7074766019992675
Polarization - Z : 0.6582170449307644 0.6582170449307644
I generated Cerenkov photons using extended example OpNovice2, the macro below, and Geant4 version 10.7, and find
fVelocity = 225.40786315789472
which is correct.
Hi,
Many thanks for the feedback. I ran the OpNovice2 example with Geant4 version 10.5 and your macro and indeed found the correct velocity ! What’s puzzling in my code is how can the muons emit the Cherenkov photons at the correct angle (I checked that), meaning that the water refractive index is properly assigned, but these propagate at c ? Any hint ?
Indeed the GROUPVEL was not present. I found it had to do the way I was inserting the RINDEX values. I was doing this way,
MPT->AddProperty(“RINDEX”, new G4MaterialPropertyVector());
for (int ie=0; ie<nEntries; ie++) {
MPT->AddEntry(“RINDEX”, e[ie],RINDEX);
}
which apparently does not work.
Now, if I do :
G4MaterialPropertyVector* mpv = new G4MaterialPropertyVector();
for (int ie=0; ie<nEntries; ++ie) {
mpv->InsertValues(e[ie], RINDEX);
}
MPT->AddProperty("RINDEX", mpv);
I can now see that the material has the GROUPVEL parameter present (and the speed of optical photons in water is indeed c/1.33 !).
So, I would guess that the GROUPVEL is computed when AddProperty is called. In the first case the MPV is still empty at that stage…
But isn’t the syntax
MPT->AddEntry(“PROPERTY”, energy, value)
generally correct ? At least I was able to properly set the index of refraction …
Looking at the code (G4MaterialPropertiesTable.cc) I find that the parameter GROUPVEL is indeed computed when AddProperty is called :
void G4MaterialPropertiesTable::
AddProperty(const char *key, G4MaterialPropertyVector *mpv)
{
// Provides a way of adding a property to the Material Properties
// Table given an G4MaterialPropertyVector Reference and a key
G4String k(key);
// if the key doesn’t exist, add it
if (std::find(G4MaterialPropertyName.begin(),
G4MaterialPropertyName.end(), k) ==
G4MaterialPropertyName.end()) {
G4MaterialPropertyName.push_back(k);
}
G4int index = GetPropertyIndex(k);
MP[ index ] = mpv;
// if key is RINDEX, we calculate GROUPVEL -
// contribution from Tao Lin (IHEP, the JUNO experiment)
if (k==“RINDEX”) {
CalculateGROUPVEL();
}
}
So, calling
MPT->AddProperty(“RINDEX”, new G4MaterialPropertyVector());
and then inserting the RINDEX values, with
MPT->AddEntry(“RINDEX”, e[ie],RINDEX);
will not compute the GROUPVEL because the method CalculateGROUPVEL() returns 0 if the RINDEX MPV exists but has no entries.
Maybe this should be handled in a different way ?..