Closed Mekhpar closed 9 months ago
Hi, I do not know how this can be done, because I also do not know what has to be done with this information when setting up Geant4. I am pretty convinced such functionality is (not yet) present in DD4hep. If you could please point me to a appropriate example in Geant4, I can investigate a possible solution for DD4hep.
Cheers, Markus
Here is an example: G4OpticalSurface * MakeS_Polished() {
static const unsigned nentries = flatentries; static double phoE[nentries] = {minenergy, maxenergy}; static double specularlobe[nentries] = {1.0, 1.0};
////////////////////////////////// // Realistic polished surface ////////////////////////////////// G4OpticalSurface surface = new G4OpticalSurface("PolishedOpSurface"); surface->SetType(dielectric_dielectric); surface->SetModel(unified); surface->SetFinish(ground); // necessary even for polished surfaces to enable UNIFIED code surface->SetSigmaAlpha(1.3 degree);
G4MaterialPropertiesTable *table = new G4MaterialPropertiesTable();
table->AddProperty( "SPECULARLOBECONSTANT", phoE, specularlobe, nentries); surface->SetMaterialPropertiesTable(table);
return surface; }
Is this what you are looking for? Thanks, Mekhala
Thanks! This already helps. My question was more: is there an existing example in the Geant4 release, which shows this usage? These must be somwhere in the Geant4 installation:
Soooo. when you create an optical surface in dd4hep you use this constructor:
/// Initializing constructor.
OpticalSurface(Detector& detector,
const std::string& name,
EModel model = Model::kMglisur,
EFinish finish = Finish::kFpolished,
EType type = Type::kTdielectric_dielectric,
double value = 1.0);
Here you give all the properties needed and which can be found in the ROOT header TGeoOpticalSurface.h
.
These then get automatically propagated to Geant4 in the Geant4Converter.cpp (lines 1384 +):
G4SurfaceType type = geant4_surface_type(optSurf->GetType());
G4OpticalSurfaceModel model = geant4_surface_model(optSurf->GetModel());
G4OpticalSurfaceFinish finish = geant4_surface_finish(optSurf->GetFinish());
string name = make_NCName(optSurf->GetName());
g4 = new G4OpticalSurface(name, model, finish, type, optSurf->GetValue());
together with the tabulated properties and the const-properties like e.g. SPECULARLOBECONSTANT. From all I can see, it should work out of the box provided you construct the surfaces correctly in dd4hep.
Yes but in Geant4Converter.cpp we also have https://github.com/AIDASoft/DD4hep/blob/ff4c726c90084b378cd9dc413ae2114e829002a7/DDG4/src/Geant4Converter.cpp#L1389
so if I could get the object representing the optical surface I could set it like g4->SetSigmaAlpha(argument_value) that would be great - as far as I know I cannot do that in the above constructor (unless the 'value' parameter has something to do with it)
So how do I do that?
g4->SetSigmaAlpha(argument_value)
OOps. I completely missed this one. I will have a look at the issue.
Are there more values one possibly want to set ?
I have to correct myself: It is all there. When you construct the surface in dd4hep, use the arrrow operator to set sigma_alphs directly to the TGeoOptical surface.
OpticalSurface os = surfMgr.opticalSurface(...);
os->SetSigmaAlpha(xxx);
That's it.
What is not there is the propagation of the polish
, because it is not supported by older versions of Geant4.
If you need, you have to uncomment in Geant4Converter.cpp
I think this answer solves your issue. If so, please close the issue to avoid too many dangling and resolved issues.
Assumed fixed and explained. Closed due to no reaction.
Hi,
I am a grad student working with Dr Sarah Eno on a dual readout single crystal calorimeter. I have used a ground dielectric metal surface as a rough reflector for my crystal, but cannot figure out where to put in the roughness parameter sigma_alpha for specular lobe reflection. My surface is defined here: https://github.com/Mekhpar/SingleCrystal_cosmic_ray/blob/5b24f471869cdc46d3e9bdf5b98e5db9378cf62c/compact/DRJunk.xml#L747 Could you please advise on how to change the surface roughness?
Thanks, Mekhala