-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Geant4Converter bug in dd4hep::Polyhedra #578
Comments
Another message that looks like from G4:
|
This printout here:
looks very strange. 1 edge should be impossible. There should be 3 or more to span a plane - no? |
well, I'm not inventing it :-) |
Bad argument: The problem must be more subtle. |
This is a good candidate for the problem. I agree. |
Here is produced GDML: <polyhedra aunit="deg" deltaphi="10" lunit="mm" name="hcalbarrelalgo_HBLayer0InSide_shape_0x7f5e06777d800x7f5e01857400" numsides="1" startphi="350">
<zplane rmax="1787" rmin="1775" z="0"/>
<zplane rmax="1787" rmin="1775" z="3082.38960788158"/>
<zplane rmax="1787" rmin="1787" z="3103.25824748416"/>
</polyhedra>
<box lunit="mm" name="hcalbarrelalgo_HBLayer0In1_shape_0x7f5e01df3e800x7f5e01807680" x="12" y="157.68801299901" z="3082.38960788158"/>
<volume name="hcalbarrelalgo_HBLayer0In10x7f5e01506480">
<materialref ref="materials_Air0x7f5e0a642100"/>
<solidref ref="hcalbarrelalgo_HBLayer0In1_shape_0x7f5e01df3e800x7f5e01807680"/>
<physvol copynumber="1" name="hcalbarrelalgo_HBLayer0In1Plastic_1_10x7f5e00fb89c0">
<volumeref ref="hcalbarrelalgo_HBLayer0In1Plastic_10x7f5e014ea2a0"/>
<position name="hcalbarrelalgo_HBLayer0In1Plastic_1_10x7f5e00fb89c0_pos" unit="mm" x="-5" y="0" z="0"/>
</physvol>
<physvol name="hcalbarrelalgo_HBScintillatorLayer0In1_00x7f5e00fb8a10">
<volumeref ref="hcalbarrelalgo_HBScintillatorLayer0In10x7f5e014ea340"/>
<position name="hcalbarrelalgo_HBScintillatorLayer0In1_00x7f5e00fb8a10_pos" unit="mm" x="0.499999999999999" y="0" z="0"/>
</physvol>
<physvol copynumber="1" name="hcalbarrelalgo_HBLayer0In1Plastic_2_10x7f5e00fb8a60">
<volumeref ref="hcalbarrelalgo_HBLayer0In1Plastic_20x7f5e014ea3e0"/>
<position name="hcalbarrelalgo_HBLayer0In1Plastic_2_10x7f5e00fb8a60_pos" unit="mm" x="5.5" y="0" z="0"/>
</physvol>
</volume>
<volume name="hcalbarrelalgo_HBLayer0InSide0x7f5e01559b80">
<materialref ref="materials_Air0x7f5e0a642100"/>
<solidref ref="hcalbarrelalgo_HBLayer0InSide_shape_0x7f5e06777d800x7f5e01857400"/>
<physvol copynumber="1" name="hcalbarrelalgo_HBLayer0InSideSpacer_10x7f5e01007260">
<volumeref ref="hcalbarrelalgo_HBLayer0InSideSpacer0x7f5e015063e0"/>
</physvol>
<physvol copynumber="3001" name="hcalbarrelalgo_HBLayer0In1_30010x7f5e010072b0">
<volumeref ref="hcalbarrelalgo_HBLayer0In10x7f5e01506480"/>
<position name="hcalbarrelalgo_HBLayer0In1_30010x7f5e010072b0_pos" unit="mm" x="1781" y="234.13638425802" z="1541.19480394079"/>
</physvol>
<physvol copynumber="3002" name="hcalbarrelalgo_HBLayer0In1_30020x7f5e01007300">
<volumeref ref="hcalbarrelalgo_HBLayer0In10x7f5e01506480"/>
<position name="hcalbarrelalgo_HBLayer0In1_30020x7f5e01007300_pos" unit="mm" x="1781" y="-234.13638425802" z="1541.19480394079"/>
<rotation name="hcalbarrelalgo_HBLayer0In1_30020x7f5e01007300_rot" unit="deg" x="-180" y="0" z="0"/>
</physvol>
</volume>
|
OK, here is what ROOT to G4 converter should produce as a G4 geometry. The HBLayer0In1_3002 rotation should be different: note the sign of x="180" <volume name="HBLayer0InSide0x7f732daaf1a0">
<materialref ref="Air0x7f733243d3c0"/>
<solidref ref="HBLayer0InSide0x7f732dbfed00"/>
<physvol copynumber="1" name="HBLayer0InSideSpacer0x7f732dbf4b20">
<volumeref ref="HBLayer0InSideSpacer0x7f732dab7780"/>
</physvol>
<physvol copynumber="3001" name="HBLayer0In10x7f732dbf4bc0">
<volumeref ref="HBLayer0In10x7f732dab7820"/>
<position name="HBLayer0In10x7f732dbf4bc0_pos" unit="mm" x="1781" y="234.13638425802" z="1541.19480394079"/>
</physvol>
<physvol copynumber="3002" name="HBLayer0In10x7f732dbf4c60">
<volumeref ref="HBLayer0In10x7f732dab7820"/>
<position name="HBLayer0In10x7f732dbf4c60_pos" unit="mm" x="1781" y="-234.13638425802" z="1541.19480394079"/>
<rotation name="HBLayer0In10x7f732dbf4c60_rot" unit="deg" x="180" y="-3.2461146750243e-14" z="2.32458640765866e-14"/>
</physvol>
<auxiliary auxtype="gammaECut" auxunit="MeV" auxvalue="0.00099"/>
<auxiliary auxtype="electronECut" auxunit="MeV" auxvalue="0.00099"/>
<auxiliary auxtype="positronECut" auxunit="MeV" auxvalue="0.00099"/>
<auxiliary auxtype="protonECut" auxunit="MeV" auxvalue="0.1"/>
</volume> |
ROOT printout of the shape:
|
GDML:
|
I think this is it -- insert for GetPhi1() "-10" degrees....: template <> G4VSolid* convertShape<TGeoPgon>(const TGeoShape* shape) {
const TGeoPgon* sh = (const TGeoPgon*) shape;
double phi_start = sh->GetPhi1() * DEGREE_2_RAD;
double phi_total = (sh->GetDphi() + sh->GetPhi1()) * DEGREE_2_RAD;
vector<double> rmin, rmax, z;
for (Int_t i = 0; i < sh->GetNz(); ++i) {
rmin.emplace_back(sh->GetRmin(i) * CM_2_MM);
rmax.emplace_back(sh->GetRmax(i) * CM_2_MM);
z.emplace_back(sh->GetZ(i) * CM_2_MM);
}
return new G4Polyhedra(sh->GetName(), phi_start, phi_total, sh->GetNedges(), sh->GetNz(), &z[0], &rmin[0], &rmax[0]);
} But I will verify this suspicion. |
Hi Yana, |
@MarkusFrankATcernch you have used |
fixed, thanks! |
Having Geant4Converter successfully converted geometry to Geant4:
a run-time error is reported by G4:
Looking at Root geometry, the shape in question (in green) is not outside of its mother (in blue):
The text was updated successfully, but these errors were encountered: