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

Common MDI #381

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open

Common MDI #381

wants to merge 44 commits into from

Conversation

aciarma
Copy link
Contributor

@aciarma aciarma commented Aug 26, 2024

Added Lumical, quadrupoles and magnetic fields to the common MDI folder for FCCee.

  • [OK] Move LumiCal (from CLD_o2_v07) to common folder
  • [OK] Add file with dimensions/materials related to MDI elements
  • [OK] Add solenoids Fieldmap
  • [OK] Add simple quadrupoles (these will change with the lattice, both field and position/dimension)
  • [OK] Add a standalone master for MDI elements only (mainly for debug processes and tracking in LumiCal)
  • Change detectors master xml to point to the common MDI files, and remove old MDI files from the detector folders
    - CLD (which version?)
    - [OK] IDEA_o1_v03
    - [OK] ALLEGRO_o1_v03

@aciarma
Copy link
Contributor Author

aciarma commented Sep 3, 2024

I've changed the master compact file for IDEA_o1_v03 and ALLEGRO_o1_v03 to point to the common MDI folder for all the related elements, removed the files for LumiCal/beam pipe/beam instrumentation from the experiment folders and modified accordingly the DectDimensions.xml files.

Should I do the same for CLD? If yes, which version?

@aciarma
Copy link
Contributor Author

aciarma commented Sep 5, 2024

the file FFQuads_v01 (default include) now is not a sensitive element anymore. If for specific needs the hits in the quadrupoles need to be studied, FFQuads_v01_sens.xml is the sensitive version to be used instead.

@danieljeans
Copy link
Contributor

danieljeans commented Sep 9, 2024

are these MDI models expected to be overlap-free yet? @Victor-Schwan and I think we are seeing several overlaps when using the overlap.mac macros in ddsim on both the MDI_standalone_o1_v01 and MDI_standalone_o1_v00 models.

I attach the output of the overlap checker for the two standalone models. (search for "detected" and you'll see the overlaps).

overlap_MDI_standalone_o1_v00.log
-> looks like up to ~2 cm overlaps around HOMabsorber

overlap_MDI_standalone_o1_v01.log
-> many 10~1000 micron overlaps between CAD elements

@danieljeans
Copy link
Contributor

I propose applying g4 step limits to the interior of the beampipe, and the whole MDI region (in my experience this helps achieve accurate simulation of beamstrahlung (ie low pT charged particles) in non-uniform fields).
Adding something like:

<limitset name="mdi_limits">
   <limit name="step_length_max" particles="*" value="5.0" unit="mm" />
</limitset>

and adding the limits to the different MDI detectors, e.g. changing

<detector name="BeBeampipe" type="DD4hep_Beampipe_o1_v01" insideTrackingVolume="true" nocore="true" vis="BeamPipeVis">

to

<detector name="BeBeampipe" type="DD4hep_Beampipe_o1_v01" insideTrackingVolume="true" limits="mdi_limits" nocore="true" vis="BeamPipeVis">

should work OK, I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this map contains only the fields from the anti-solenoid and assume a 0 detector field when produced? Otherwise we will "double count" the detector field there. By the way, "fieldMap" is very generic, can you find a more descriptive name for this file.

@atolosadelgado
Copy link
Collaborator

Hi @aciarma ,

Thank you for making this very complete PR!

Here are few comments:
v00:

  1. Overlaps are found with the HOM absorber. However, CLD has no overlaps in its MDI, how is it possible?
          Overlap is detected for volume AV_4!BeamPipeShield_assembly_3#3!tube_TaShield_0_0#0:4 (G4SubtractionSolid) with HOMAbsorber_envelope_11:11 (G4UnionSolid)
          overlap at local point (38.0487,-33.0895,1241.63) by 4.41048 mm  (max of 124 cases)
--
          Overlap is detected for volume AV_4!BeamPipeShield_assembly_3#3!tube_TaShield_1_1#1:5 (G4SubtractionSolid) with HOMAbsorber_envelope_11:11 (G4UnionSolid)
          overlap at local point (-37.5385,-32.9308,-1209.05) by 4.5692 mm  (max of 94 cases)
--
          Overlap is detected for volume HOMAbsorber_envelope_11:11 (G4UnionSolid) with AV_4!BeamPipeShield_assembly_3#3!tube_TaShield_0_0#0:4 (G4SubtractionSolid)
          overlap at local point (-12.5365,34.1472,-389.019) by 1.48998 cm  (max of 4272 cases)
--
          Overlap is detected for volume AV_8!HOMAbsorbers_PunchThrough_assembly_12#12!tube_HOM1_0_0#0:13 (G4SubtractionSolid) with AV_4!BeamPipeShield_assembly_3#3!tube_TaShield_0_0#0:4 (G4SubtractionSolid)
          overlap at local point (0.553117,-31.1543,-388.835) by 1.96526 cm  (max of 5628 cases)
--
          Overlap is detected for volume AV_8!HOMAbsorbers_PunchThrough_assembly_12#12!tube_HOM1_1_1#1:14 (G4SubtractionSolid) with AV_4!BeamPipeShield_assembly_3#3!tube_TaShield_1_1#1:5 (G4SubtractionSolid)
          overlap at local point (0.785344,-31.6609,-388.835) by 1.96071 cm  (max of 5595 cases)
  1. Variable QD0 min/max are defined twice, can we centralize it into the Dimensions and material compact file?
  2. These variables QD0 have a comment that says potentially outdated, do you know if it means that the value is not valid anymore?
  3. Centralize size variables from solenoid and antisolenoid in Dimensions and Materials compact file?
  4. Move the definition of magnetic field of FFQ to another file, to be coherent with the solenoid/antisolenoid elements?

v01:
6. CAD design corresponding to water and AlBeMet volumes seem to have at least 1 facet with the wrong orientation, as reported during initializing the geometry:

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1001
      issued by : G4TessellatedSolid::SetSolidClosed()
Defects in solid: "Componente1"_shape_0xd5bd950 - some facets have wrong orientation!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------


-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1001
      issued by : G4TessellatedSolid::SetSolidClosed()
Defects in solid: "Componente1"_shape_0xe064510 - some facets have wrong orientation!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
  1. I am not sure if it is related to the previous point, but the Geant4 navigator reports error around point r~25, z=+/-1111 (I think the units are mm). Please see the the attached file named MDI_v01_error_points.txt
    MDI_v01_error_points.txt

  2. Regarding Daniel comment about region limits, I can take care of it in a future PR.

  3. Regarding your question if CLD should be modified, we can leave it as it is for the moment, and let the CLD responsibles change to the central MDI.

Please, let me know if I can help somehow.

@aciarma
Copy link
Contributor Author

aciarma commented Feb 11, 2025

New CAD models now have the latest description for elliptoconical chamber cooling manifolds, and the flange at the end of the albemet part
image

Added preliminar model for Bellows
image

Central chamber from ±90mm is now made using DD4hep_Mask instead of CAD to remove issues due to mismatch of facets of the different volumes

Added "beam" volume fitting the CAD beam pipe model to fix air in beam pipe
image

Tungsten SR mask reworked, and the notch on the other side of the beam pipe has been removed.

How can I upload the STL files for the new CAD models?

@atolosadelgado
Copy link
Collaborator

New CAD models now have the latest description for elliptoconical chamber cooling manifolds, and the flange at the end of the albemet part image

Added preliminar model for Bellows image

Central chamber from ±90mm is now made using DD4hep_Mask instead of CAD to remove issues due to mismatch of facets of the different volumes

Added "beam" volume fitting the CAD beam pipe model to fix air in beam pipe image

Tungsten SR mask reworked, and the notch on the other side of the beam pipe has been removed.

How can I upload the STL files for the new CAD models?

Thank @aciarma for this PR. I am checking your files before moving them to www-eos. I have some questions about the new model:

  1. Can you fix this error?
Evaluator        WARN  +++ Overwriting variable: name=QD0_min_z value=2000*mm  Evaluator::Object : existing variable [setVariable error]
Detector         WARN  +++ Object 'QD0_min_z' is already defined. New value will be ignored
Evaluator        WARN  +++ Overwriting variable: name=QD0_max_z value=5400*mm  Evaluator::Object : existing variable [setVariable error]
Detector         WARN  +++ Object 'QD0_max_z' is already defined. New value will be ignored
  1. Can you confirm that the placement of 4 lumicals is expected?
dd4hep::Ref_t create_detector(dd4hep::Detector&, xml_h, dd4hep::SensitiveDetector)
Here is my LumiCal
 and this is the sensitive detector: 0x7ffdf517f868
 The crossing angle is: 0.03 radian
Total Length 11.25 cm
Layer Thickness 0.45 cm
Compact          INFO  ++ Converted subdetector:LumiCal of type LumiCal_o1_v01 [calorimeter]
dd4hep::Ref_t create_detector(dd4hep::Detector&, xml_h, dd4hep::SensitiveDetector)
Here is my LumiCal
 and this is the sensitive detector: 0x7ffdf517f868
 The crossing angle is: 0.03 radian
Total Length 11.25 cm
Layer Thickness 0.45 cm
Compact          INFO  ++ Converted subdetector:LumiCalInstrumentation of type LumiCal_o1_v01 [calorimeter]
dd4hep::Ref_t create_detector(dd4hep::Detector&, xml_h, dd4hep::SensitiveDetector)
Here is my LumiCal
 and this is the sensitive detector: 0x7ffdf517f868
 The crossing angle is: 0.03 radian
Total Length 11.25 cm
Layer Thickness 0.45 cm
Compact          INFO  ++ Converted subdetector:LumiCalCooling of type LumiCal_o1_v01 [calorimeter]
dd4hep::Ref_t create_detector(dd4hep::Detector&, xml_h, dd4hep::SensitiveDetector)
Here is my LumiCal
 and this is the sensitive detector: 0x7ffdf517f868
 The crossing angle is: 0.03 radian
Total Length 0.35 cm
Layer Thickness 0.35 cm
Compact          INFO  ++ Converted subdetector:LumiCalBackShield of type LumiCal_o1_v01 [calorimeter]
  1. I noticed that there are some overlaps, up to 9mm, could you please take a look to it?
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_8!Beampipe_STL_0#0!ASCII_0#0:0 (G4TessellatedSolid) with AV_14!Beam_STL_6#6!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (14.0421,-8.71044,659.727) by 3.37392 mm  (max of 1115 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_14!Beam_STL_6#6!ASCII_0#0:0 (G4TessellatedSolid) with AV_8!Beampipe_STL_0#0!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (14.6671,-12.8952,862.223) by 2.16673 mm  (max of 2759 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_15!Paraffin_STL_7#7!ASCII_0#0:0 (G4TessellatedSolid) with AV_8!Beampipe_STL_0#0!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (12.416,-3.81531,117.483) by 506.795 um  (max of 4403 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_16!Water_STL_8#8!ASCII_0#0:0 (G4TessellatedSolid) with AV_8!Beampipe_STL_0#0!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (-18.312,11.0271,681.066) by 36.7902 um  (max of 2395 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_17!Bellows_STL_9#9!ASCII_0#0:0 (G4TessellatedSolid) with AV_8!Beampipe_STL_0#0!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (8.8925,-47.5236,1225.23) by 8.56756 mm  (max of 52 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_18!Beampipe_crotch_STL_10#10!ASCII_0#0:0 (G4TessellatedSolid) with AV_14!Beam_STL_6#6!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (-14.8662,-12.1879,-1323.04) by 944.42 um  (max of 3559 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
--
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
      issued by : G4PVPlacement::CheckOverlaps()
Overlap with volume already placed !
          Overlap is detected for volume AV_19!Tungsten_STL_11#11!ASCII_0#0:0 (G4TessellatedSolid) with AV_14!Beam_STL_6#6!ASCII_0#0:0 (G4TessellatedSolid)
          overlap at local point (-44.6705,1.14337,2069.84) by 3.08147 um  (max of 1403 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
  1. I think the complaint about the facets with wrong orientation persists, could you confirm if the shapes giving this problem before are the same?
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1001
      issued by : G4TessellatedSolid::SetSolidClosed()
Defects in solid: ASCII_shape_0xdde5530 - some facets have wrong orientation!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------


-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1001
      issued by : G4TessellatedSolid::SetSolidClosed()
Defects in solid: ASCII_shape_0xf00fe90 - some facets have wrong orientation!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

@aciarma
Copy link
Contributor Author

aciarma commented Feb 12, 2025

hello @atolosadelgado, on the above points:

  1. I fixed this
  2. It should be correct because they are 4 different parts of LumiCal (main, Instrumentation, Cooling and BackShield), but I did not do anything on that, I just moved the latest version in the MDI folder
  3. on my side if I do checkOverlap -c MDI_standalone_o1_v01.xml I get no overlaps, how did you get those warnings?
  4. on the facets orientation, I did not understood why this comes up... from CAD it does not seems that there are such problems, and I also tried to use tools I found online (trimesh python package) but it had no effect apparently.

@atolosadelgado
Copy link
Collaborator

hello @atolosadelgado, on the above points:

1. I fixed this

2. It should be correct because they are 4 different parts of LumiCal (main, Instrumentation, Cooling and BackShield), but I did not do anything on that, I just moved the latest version in the MDI folder

3. on my side if I do `checkOverlap -c MDI_standalone_o1_v01.xml` I get no overlaps, how did you get those warnings?

4. on the facets orientation, I did not understood why this comes up... from CAD it does not seems that there are such problems, and I also tried to use tools I found online (trimesh python package) but it had no effect apparently.

Hi @aciarma

thanks a lot for your quick response! The wrong facet orientation, if I remember correctly, happened at z=+/-1111mm. I will check again running with geantinos.

Regarding the overlaps, I run first few events with geantinos and Geant4 tracking already complained about it. Then, I check the overlaps using Geant4 with the following command:

ddsim --compactFile FCCee/MDI/compact/MDI_o1_v01/MDI_standalone_o1_v01.xml --runType run --macroFile utils/overlap.mac > overlapdump.txt

Please let me know if I can help further. Thanks for your quick reply!

@aciarma
Copy link
Contributor Author

aciarma commented Feb 12, 2025

Thank you, I see the same overlaps now. We are investigating a way to avoid this but it seems not trivial. Geometries are obtained from CAD where there are no overlaps, but once it is translated to STL they appear due to the facets not being aligned, and boolean operations on meshes are not working nicely. I will follow up on this.

(this is also why I decided to use DD4hep shapes for the central chamber)

@atolosadelgado
Copy link
Collaborator

Thank you, I see the same overlaps now. We are investigating a way to avoid this but it seems not trivial. Geometries are obtained from CAD where there are no overlaps, but once it is translated to STL they appear due to the facets not being aligned, and boolean operations on meshes are not working nicely. I will follow up on this.

(this is also why I decided to use DD4hep shapes for the central chamber)

Thank you very much for crosschecking! Please let me know if I can help further :)

@aciarma
Copy link
Contributor Author

aciarma commented Feb 14, 2025

We are trying different export strategies using STL, still we are observing small overlaps, now ~20um.
We are thinking of tapering a little bit the light materials to leave a small tolerance between touching volumes (would be filled by world volume air). Do you think it would be an acceptable solution?

AutoCAD Inventor can export also in OBJ of the ddsim supported formats, but when I try to run the overlap macro on the test file I get a crash. Is OBJ still supported? Or are there good formats other than those in the DDCAD/examples list?

@aciarma
Copy link
Contributor Author

aciarma commented Feb 17, 2025

ok I realized that the spider.obj file called by the OBJ example in DDCAD does not actually exist. Anyway, following that example I tried to read a simple OBJ file we generated with AutoCAD,

<detector id="1" name="Shape_OBJ" type="DD4hep_TestShape_Creator">
      <check vis="AlBeMet_vis">
        <shape type="CAD_MultiVolume" ref="${K4GEO}/FCCee/MDI/compact/MDI_o1_v01/stl_files/PROVE/prova1_stlOBJ.obj" unit="mm">
          <volume id="0"  name="v1" material="Gold" vis="AlBeMet_vis"/>
         </shape>
      </check>
    </detector>

but got the following error

Compact          ERROR ++ FAILED    to convert subdetector: Shape_OBJ: Cannot find a material referenced by name:191,191,191

where 191,191,191 I highly suspect it is the RGB color code of the volume (a light grey).

Is there a way to overwrite such fields? I defined Gold as material but it clearly did not work.
Also, why the Check_Shapes_OBJ_spider.xml exists but the .obj file does not? There was some problem with that format?

@atolosadelgado
Copy link
Collaborator

We are trying different export strategies using STL, still we are observing small overlaps, now ~20um. We are thinking of tapering a little bit the light materials to leave a small tolerance between touching volumes (would be filled by world volume air). Do you think it would be an acceptable solution?

AutoCAD Inventor can export also in OBJ of the ddsim supported formats, but when I try to run the overlap macro on the test file I get a crash. Is OBJ still supported? Or are there good formats other than those in the DDCAD/examples list?

Hi @aciarma

Sorry for the late reply! I believe DDCAD is built on top of ASSIMP, so it should support many formats [1].

If you could share the OBJ file privately, I'd be happy to take a look at it.

[1] https://github.com/assimp/assimp/blob/master/doc/Fileformats.md

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

Successfully merging this pull request may close these issues.

4 participants