Skip to content
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

PseudoTrap missing a bump/cut #466

Closed
ianna opened this issue Dec 5, 2018 · 15 comments
Closed

PseudoTrap missing a bump/cut #466

ianna opened this issue Dec 5, 2018 · 15 comments

Comments

@ianna
Copy link
Contributor

ianna commented Dec 5, 2018

It looks like a bug: PseudoTrap with a negative radius (a subtraction) is represented as a Trapezoid now:
screenshot 2018-12-05 10 04 24

@MarkusFrankATcernch
Copy link
Contributor

Could you please post the constructor arguments for this shape?
Thanks!

@ianna
Copy link
Contributor Author

ianna commented Dec 5, 2018

PseudoTrap(dx1, dx2, dy1, dy2, dz, r, atMinusZ)
 <PseudoTrap name="YE1_b" dx1="0.293734*m" dx2="1.86356*m" dy1="0.3000*m" dy2="0.3000*m" dz="2.92934*m" radius="-1.1350*m" atMinusZ="true"/>

@MarkusFrankATcernch
Copy link
Contributor

Then I think we have a problem:
On October 29 I made a commit on your request fixing:

36d4b01#diff-7219d47bc4ab7516e0ca6c4f35f2602f

There I implemented the code you gave me:
https://cmssdt.cern.ch/lxr/source/Fireworks/Geometry/src/TGeoMgrFromDdd.cc#0390
This was correct at the time of commit and you closed the issue.

Now the new source how it should be implemented:
https://cmssdt.cern.ch/lxr/source/SimG4Core/Geometry/src/DDG4SolidConverter.cc#0362
This one is different from the above.
The first solution is wrong and only this one is valid.
It happens to be that this was the implementation, which was present PRIOR to October 29th.

I conclude you have a conflict in the CMS code having 2 different translation mechanisms
for the PseudoTrap shape which are incompatible.

You first have to solve this, otherwise we are always in trouble only depending from which side you come.....

@MarkusFrankATcernch
Copy link
Contributor

I convinced myself that the old solution (before October 29th) was correct.
This will also solve this very problem. I am convinced that https://cmssdt.cern.ch/lxr/source/Fireworks/Geometry/src/TGeoMgrFromDdd.cc#0390 is buggy. You will need very good arguments to go back to this one.

@ianna
Copy link
Contributor Author

ianna commented Dec 6, 2018

Yep, the PseudoTrap shape with a positive radius (a union) is also wrong:
screenshot 2018-12-06 10 01 15

@MarkusFrankATcernch
Copy link
Contributor

MarkusFrankATcernch commented Dec 6, 2018

Which version are you using ?
For me it seems to work:
image

@ianna
Copy link
Contributor Author

ianna commented Dec 11, 2018

@MarkusFrankATcernch - sorry to disappoint you, but the bump/cut is along a wrong axis, and also a wrong precision which leaves some debris:

screenshot 2018-12-11 14 13 47
screenshot 2018-12-11 14 10 28

@MarkusFrankATcernch
Copy link
Contributor

Ok. Please send me the XML parameters of the 4 cases together with the corresponding pictures.
Otherwise it is only a try-and-error session.
Thanks!

@ianna
Copy link
Contributor Author

ianna commented Dec 11, 2018

I guess, there is no surprise that we have the same problem with translation to Root - the bite is lower then expected (see red outline) and is leaving a flat surface which is detected by an overlap checker. I need to check what happens in the G4 builder. As you pointed out, that code is different.
screenshot 2018-12-11 15 23 44
screenshot 2018-12-11 15 25 00

  <SolidSection label="testPseudoTrapSolids.xml">
    <PseudoTrap name="ptrap1" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="10*cm" atMinusZ="false"/>
    <PseudoTrap name="ptrap2" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="10*cm" atMinusZ="true"/>
    <PseudoTrap name="ptrap3" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="-10*cm" atMinusZ="false"/>
    <PseudoTrap name="ptrap4" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="-10*cm" atMinusZ="true"/>
  </SolidSection>

@MarkusFrankATcernch
Copy link
Contributor

From left to right:

red:  <PseudoTrap name="ptrap1" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="3*cm" atMinusZ="false"/>
green:<PseudoTrap name="ptrap2" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="10*cm" atMinusZ="true"/>

blue: <PseudoTrap name="ptrap3" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="-3*cm" atMinusZ="false"/>
yellow: <PseudoTrap name="ptrap4" dx1="10*cm" dx2="3*cm" dy1="30*cm" dy2="10*cm" dz="30*cm" radius="-10*cm" atMinusZ="true"/>

image

I reduced for red, blue the radius so that the effect is better visible on the narrow ends.
To my understanding this is correct.

The effect you observe is real and has an easy explanation:
If the radius is such that you cut out a half-cylinder with radius=dx1 (10cm) or dx2 < dx1 (cube-ish trap), then what you cut out of a trap is always wider than the trap. This is pure math: the derivation of the trap side is (2*dz)/(dx1-dx2) whereas for the cylinder's circle it is infinite i.e. the tube at the edges is always outside the trap unless the trap is cube-ish. See the right figure, where the radius is increased so that the trap derivation is smaller than the one of the tube: then the edges hit the surface....

image

@MarkusFrankATcernch
Copy link
Contributor

Hi Yana,
Could you please comment on the above to keep the loop active?
Thanks!

@ianna
Copy link
Contributor Author

ianna commented Dec 18, 2018

The idea is that a circle line goes through the trapezoid vertices.

@MarkusFrankATcernch
Copy link
Contributor

The circle goes through the trap vertices.
In the case that r==x1 and x2<x1 the circle comes from the outside and consequently cuts out this piece.
If I set x1=x2 then the circle comes from the inside due to the above argumentation:
image

@ianna
Copy link
Contributor Author

ianna commented Dec 18, 2018

if x1!=x2 the centre of a circle should be lowered, so that the edges would still touch the plane

@ianna
Copy link
Contributor Author

ianna commented Apr 1, 2019

Close for now - I'll come back to it if the geometry validations reports it as an issue.

@ianna ianna closed this as completed Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants