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

[IDEA] Adding the detailed version of the muon system. #322

Merged
merged 40 commits into from
Jul 8, 2024

Conversation

mahmoudali2
Copy link
Contributor

@mahmoudali2 mahmoudali2 commented Feb 16, 2024

BEGINRELEASENOTES

  • Define the first draft of the detailed muon system, which depend on mosaics of 50 * 50 cm^2 mRWELL chambers.
  • Define a suitable XML for the new detailed version.
  • Describe µRWELL materials.
  • Add the parameters of the muon system into the full IDEA implementation.

ENDRELEASENOTES

Copy link
Contributor

@BrieucF BrieucF left a comment

Choose a reason for hiding this comment

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

Hi Mahmoud, thanks a lot for this! Here are already a few comments. Can you also try to run the overlap check?

create a geant4 macro named overlap.mac with this inside:
/geometry/test/run
exit

Then run the overlap checker with this: 
ddsim --compactFile ./compact/simple_detector.xml --runType run --part.userParticleHandler='' --macroFile overlap.mac >> overlapDump.txt

Copy link
Contributor

Choose a reason for hiding this comment

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

I propose to remove references to IDEA in this README, the detector builder is quite generic and could be used for other implementation. e.g. IDEA Muon System --> µRWELL Based Muon System

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Brieuc, I have edited the code after checking all the overlaps, and now it's clean.. I'm attaching the overlapDump file.
overlapDump-151.txt

detector/muonSystem/muonSystem_v00.cpp Outdated Show resolved Hide resolved
detector/muonSystem/README.md Outdated Show resolved Hide resolved
FCCee/IDEA/compact/IDEA_o1_v02/detailedMuonSystem_v00.xml Outdated Show resolved Hide resolved
detector/muonSystem/muonSystem_v00.cpp Outdated Show resolved Hide resolved
FCCee/IDEA/compact/IDEA_o1_v02/detailedMuonSystem_v00.xml Outdated Show resolved Hide resolved
<detectors>

<!-- mRWELL envelope -->
<detector name="muonSystem1" type="muonSystem_o1_v00" vis="MuonVisEnv" id="51" readout="mRWELLChamberReadout">
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and in other places: the "id" should be defined in DectDimensions_IDEA_o1_v01.xml and called here (see and modify

<constant name="DetID_Yoke_Barrel" value=" 13"/>
)

Copy link
Contributor

Choose a reason for hiding this comment

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

I also suspect this should crash as it is now (did you try running it with ddsim?) because we have 4 bits for system in the readout which only allows to have "id's" from 0 to 15.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the 9 muon system layers IDs to the DectDimensions_IDEA_o1_v01.xml, and ddsim run without crashes even if the system has 4 bits. Isn't the 4 bits in that case only for the muon system, since for example I have here 9 detectors (layers)? since also every sub-detector has its own readout description?

detector/muonSystem/muonSystem_v00.cpp Outdated Show resolved Hide resolved
detector/muonSystem/muonSystem_v00.cpp Outdated Show resolved Hide resolved
@mahmoudali2
Copy link
Contributor Author

New modification in the builder and the compact file to avoid all the overlap cases, I have introduced a new way to organize the different sides in the same layer, the following photo (X-Y plane) is an example for barrel sides overlapping and avoiding touching each others:
barrel-side-overlap
The same in encap, with creating unusual shapes by boolean operations UnionSolid (The only solution I got to solve the overlap with the mother volume):
endcap-overlapping
...
And every layer (1 detector layer + 1 yoke layer "if present") has an independent mother volume in the shape of Polyhedra to avoid overlapping with each other:
layer
....
Overall the complete muon system:
muon

@BrieucF BrieucF changed the title [IDEA] Adding the first draft of the detailed version of the IDEA muon system. [IDEA] Adding the detailed version of the muon system. May 16, 2024
Copy link
Contributor

@BrieucF BrieucF left a comment

Choose a reason for hiding this comment

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

Hi Mahmoud, this is fantastic! Tahnks! Here is a first batch of comment.
Can you also update FCCee/IDEA/compact/README.md under IDEA_o1_v02 with something like:
"Based on o1_v01 but with a detailed description of the vertex detector, drift chamber and muon system, a place holder solenoid and the endplate absorber. Missing: SiWrapper, calorimeter."?

I am also a bit puzzled by the fact of having one detID per layer but I guess having one detID for the whole barrel and one for the whole endcap would imply a complete refactoring of the code?

detector/muonSystem/README.md Outdated Show resolved Hide resolved
detector/muonSystem/README.md Outdated Show resolved Hide resolved
detector/muonSystem/muonSystemMuRWELL_o1_v01.cpp Outdated Show resolved Hide resolved
FCCee/IDEA/compact/IDEA_o1_v03/materials_o1_v02.xml Outdated Show resolved Hide resolved
detector/muonSystem/muonSystemMuRWELL_o1_v01.cpp Outdated Show resolved Hide resolved
detector/muonSystem/muonSystemMuRWELL_o1_v01.cpp Outdated Show resolved Hide resolved

for (int rectangle = 0; rectangle < (numRectangles + 1); ++rectangle) {

double rectangleEnvX = detectorVolumeThickness/4.5; // dividing by 4.5 gets the best thickness for the recatngle to avoid any overlap ~ in our case the uRWELL the best rectangle thickness is 26.667 mm which is 120/4.5.
Copy link
Contributor

Choose a reason for hiding this comment

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

This /4.5 seems awfully fine-tuned? Or is this OK also for other thinknesses?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @andresailer, I have changed the parameters, and now it is OK with other thicknesses to. Whatever the chamber dimensions the user will put in the compact file, It will work. I have made the variable detectorVolumeThickness is determined by the builder depending on the chamber dimensions and the overlap angle, instead before it was determined by the user.

// // B A R R E L //
// ----------------------------------------------------------------------------------------------------

if (numBarrelDetectorLayers > 0){
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it makes sense to split this into a barrel and an endcap constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the barrel last layer is enclosing all the endcap layers inside, we preferred to keep them in the same builder. Both Barrel and Endcap are sharing some common variables like numSides of the main polygon shape. and the length of the last layer of the barrel depending on the total thickness of the endcap detector. And to distinguish between the collection hits of barrel and endcap, a bit-field component has been defined. Maybe we might tend to separate them in the future if needed.


int numBarrelLayer = 1;
double barrelLayerRMin = radius - detectorVolumeThickness/2.0; // have to be changed depends on xml impementation
double barrelLayerRMax = radius + 1.5 * detectorVolumeThickness;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this 1.5 factor always correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, since the detector volume was centered in the 0.25 of the thickness of that volume. But I have also changed it in the new commits, and I centered it in the middle instead.

double angle_clearance = 0.0; // 0.02 works good but needs the detector volume thick to be more than 60 mm. // it's less than 1 degree, we use the clearnce to avoid overlapping

double sideLength = 2 * radius * std::tan(shapeAngle_radians);
double sideLength2 = 2 * (radius + 1.5 * detectorVolumeThickness) * std::tan(shapeAngle_radians);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the 2 signify?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's coming from the formula to calculate the polygon side length Side Length a. a = 2r tan(π/n).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you mean the number 2 in sideLength2 and other variable as well, that represents here the trapezoid's parallel sides lengths. just to distinguish between the two sides lengths.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, yes I mean the 2 in sideLength2, can you please add what you wrote as a comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I Have added the comments.

@mahmoudali2
Copy link
Contributor Author

Thanks @BrieucF and @andresailer for your comments,
I have refactored all the builder, and here are the main updates:

  • Looping over layers, which led to having all the muon-system layers represented by just one detector in the xml.
  • Decreasing the number of parameters inserted by the user --> that made the code more automized and made the xml smaller and simpler.
  • Refactoring the bit-field of the muon-system, and having all the muon hits in one collection called MuonSystemcollection, and you can distinguish between the barrel hits and the endcap hits by their different bit field section type if type = 0 --> Barrel Hits, if type = 1 --> Positive Endcap Hits, and type = -1 --> Negative Endcap Hits.
  • The ability to make multiple layers and still the last barrel layer will enclose all the endcap layers inside.
    Let me know if you have any more comments.

detector/muonSystem/README.md Outdated Show resolved Hide resolved
FCCee/IDEA/compact/README.md Outdated Show resolved Hide resolved
<readouts>
<readout name="MuonSystemCollection">
<segmentation type="CartesianGridYZ" grid_size_y="1.2*mm" grid_size_z="1.2*mm"/> <!-- Depending on strip pitch 1.4 mm -->
<id>system:5,type:2,layer:4,chamber:15,slice:1,y:-10,z:-10</id> <!-- The bit field is divided into 2^5 systems(IDEA sub-detectors), 2^2 types(Barrel Muon System, positive endcap, and negative endcap"), 2^4 layers(number of layers in barrel for example) ,2^15 chambers(the number of muRWELL chambers in every layer), 2^1 slice(number of sensitive layers inside every chambers), and 2^10 y&z strips in every sensitive layer-->
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<id>system:5,type:2,layer:4,chamber:15,slice:1,y:-10,z:-10</id> <!-- The bit field is divided into 2^5 systems(IDEA sub-detectors), 2^2 types(Barrel Muon System, positive endcap, and negative endcap"), 2^4 layers(number of layers in barrel for example) ,2^15 chambers(the number of muRWELL chambers in every layer), 2^1 slice(number of sensitive layers inside every chambers), and 2^10 y&z strips in every sensitive layer-->
<id>system:5,type:2,layer:4,chamber:15,slice:1,y:-10,z:-10</id> <!-- The bit field is divided into 2^5 systems(IDEA sub-detectors), 2^2 types(0 = Barrel Muon System, +1 = positive endcap and -1 = negative endcap"), 2^4 layers(number of layers in barrel for example) ,2^15 chambers(the number of muRWELL chambers in every layer), 2^1 slice(number of sensitive layers inside every chambers), and 2^10 y&z strips in every sensitive layer-->
```?
I'd also propose to change `type` to `side`, but it is not a strong request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm afraid using side instead of type would cause confusion with the detector side variable that I use to determine the polygon shape sides.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok! But can you still say in the xml which value is given to barrel/endcap etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I just added it in the last commit

<composite n="0.40" ref="CF4"/>
</material>

<material name="G4_Fe" state="solid">
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these materials still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's the material of the uRWELL.

dd4hep::Transform3D unionTransform2(unionRot, unionPos2);

//Combining two shapes by UnionSolid: the first shape is centralized and the second transform around the first..
dd4hep::UnionSolid barrelAndPositiveEndcap(BarrelEnv, EndcapEnv, unionTransform);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a cylinder would be more performant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cylinder will cause overlaps with different layers, and sub-detectors before the muon-system (in our case is DR-Calo).

dd4hep::Rotation3D barrelUnionRot(dd4hep::RotationY(0.0 * dd4hep::degree));
dd4hep::Transform3D barrelUnionTransform(barrelUnionRot, barrelUnionPos);

dd4hep::UnionSolid barrelUnion(BarrelEnvWithoutLastLayer, BarrelLastLayerEnv, barrelUnionTransform);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a cylinder would be more performant?

dd4hep::Transform3D boxTransform(boxRot, boxPos);

//Combining two shapes by UnionSolid: the first shape is centralized and the second transform around the first..
dd4hep::UnionSolid endcapDetectorSideEnvelope(endcapDetectorSideTrap, endcapDetectorSideBox, boxTransform);
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a cylinder would be more performant?

dd4hep::Volume sideVol2(sideName, sideEnvelope2, mat);

double angle_degrees = shapeAngle * side; // Calculate the angle for each side
double angle_radians = angle_degrees * M_PI / 180.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

to avoid confusion I would suggest to work on angle natural units of dd4hep. In addition, conversion of deg <-> rad can be done using ROOT factosTMath::DegToRad()

Copy link
Contributor

@atolosadelgado atolosadelgado left a comment

Choose a reason for hiding this comment

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

Overall it is good, here are minimal comments, @BrieucF can tell if they can be ignored :)

@BrieucF
Copy link
Contributor

BrieucF commented Jul 8, 2024

I'd say the baseline is to implement them all :-P if some are causing problems or require significant change we de-discuss ;-)

mahmoudali2 and others added 4 commits July 8, 2024 16:08
Co-authored-by: Brieuc Francois <brieuc.francois@cern.ch>
Co-authored-by: Brieuc Francois <brieuc.francois@cern.ch>
@mahmoudali2
Copy link
Contributor Author

Hi @atolosadelgado , Thanks very much for your comments, here are some clarifications;

  • For the materials you mentioned in IDEA V02, it's now removed. I have removed all updates on muon-system from the V02, and just added it to V03. Also no more hex-names, but G4_Fe is needed for the yokes.
  • Replacing union solids with cylinders will cause overlaps between the muon-system and other sub-detectors especially the DR-Calo. the idea of using union solid is to combine the different layers mother volumes together since there is no specific shapes that can describe the MS-barrel which is combination of two different polyhedra with different z-lengths(photo attached).
Screenshot 2024-07-05 at 17 41 22 The same case for all the muon-system, which is 3 combinations of 3 different polyhedra: Screenshot 2024-07-05 at 17 44 25

@atolosadelgado
Copy link
Contributor

Hi @atolosadelgado , Thanks very much for your comments, here are some clarifications;

* For the materials you mentioned in IDEA V02, it's now removed. I have removed all updates on muon-system from the V02, and just added it to V03. Also no more hex-names, but G4_Fe is needed for the yokes.

* Replacing union solids with cylinders will cause overlaps between the muon-system and other sub-detectors especially the DR-Calo. the idea of using union solid is to combine the different layers mother volumes together since there is no specific shapes that can describe the MS-barrel which is combination of two different polyhedra with different z-lengths(photo attached).

Screenshot 2024-07-05 at 17 41 22 The same case for all the muon-system, which is 3 combinations of 3 different polyhedra: Screenshot 2024-07-05 at 17 44 25

I had a chat with Brieuc, and these are minor comments which can be ignored

@BrieucF
Copy link
Contributor

BrieucF commented Jul 8, 2024

Thanks a lot Mahmoud, and congratulations!
To be investigated for v02:

  • use assembly instead of union
  • understand if we need all the extra material definition (e.g. redefining the isotope content of Calcium)

@BrieucF BrieucF merged commit 2e1bba2 into key4hep:main Jul 8, 2024
4 of 6 checks passed
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.

None yet

4 participants