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

Calculate window values from radius, strip number and open aperture #19

Open
jovoy opened this issue Mar 25, 2022 · 0 comments
Open

Calculate window values from radius, strip number and open aperture #19

jovoy opened this issue Mar 25, 2022 · 0 comments

Comments

@jovoy
Copy link
Contributor

jovoy commented Mar 25, 2022

The following is a method that calculates the X-ray windows strip width and distance from each other, using the radius, number of strips and the open aperture. This is useful as companies give these values and one doesn't have to calculate it by hand. Should be implemented in TRestAxionXrayWindow .

proc calcWindowVals(radiusWindow: MilliMeter,
                    numberOfStrips: int,
                    openApertureRatio: float): tuple[width: MilliMeter,
                                                      dist: MilliMeter] =
  let
    totalArea = π * radiusWindow * radiusWindow
    areaOfStrips = totalArea * (1.0 - openApertureRatio)
    #width and distance between strips per strip;
    #the width on both sides is a whole width
    #(Don't know what to do about the additional string width)
    #not important at high strip number but at low like CAST
    dAndwPerStrip = radiusWindow * 2.0 / (numberOfStrips.float + 1.0)
  var
    lengthStrip: mm
    lengthAllStrips: mm

  for i in 0..(numberOfStrips/2).round.int - 1:
    lengthStrip = sqrt(radiusWindow * radiusWindow -
      (i.float * dAndwPerStrip + 0.5 * dAndwPerStrip) *
        (i.float * dAndwPerStrip + 0.5 * dAndwPerStrip)
    ) * 2.0
    lengthAllStrips = lengthAllStrips + lengthStrip
    echo lengthStrip

  lengthAllStrips = lengthAllStrips * 2.0

  let
    widthStrips = areaOfStrips / lengthAllStrips
    distStrips = dAndwPerStrip - widthStrips
  echo widthStrips
  echo distStrips
  result = (width: widthStrips, dist: distStrips)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant