eic / ip6

ARCHIVED - DD4hep Geometry Description of the IP6 Beamline
https://github.com/eic/epic
0 stars 3 forks source link

Implement B0 PbWO4 ecal #24

Closed rahmans1 closed 1 year ago

rahmans1 commented 1 year ago

Is your feature request related to a problem? Please describe. For the B0, either a PbWO4 EMCAL OR the preshower will be used. We will need to look at the performance of both. So when one runs a simulation with the full Far-Forward geometry, one can comment out the one not in use in the “far_forward.xml” file. Right now there is no implementation of the EMCAL in the far forward region.

Describe the solution you'd like Comment from @ajentsch For the B0 EMCAL, I would recommend looking at both the current ZDC and B0_tracker XML files to see how the geometry is setup, and reference the tutorials as needed. As a starting point, you can take the B0 tracker geometry, only use one layer, change the active material to PbWO4, change the length to the correct crystal length (like 10cm or something), adjust the segmentation to match the transverse size (2.5cm x 2.5cm, I think), and then ensure the readout/detector type is set to be a calorimeter (right now it’s set to be a tracker). Comment from @rahmans1 The B0 tracker is implemented as an assembly of trapezoids. The ZDC implementation has an envelope volume with modules placed inside. We can follow either template but depending on the number of modules, the first approach may be slow down simulation performance according to @wdconinc.

Additional context Excerpt from ECCE proposal In addition, a PbWO4 calorimeter will be positioned behind the fourth tracking layer at 683 cm from IP. The calorimeter constructed from 10 cm long 2x2 cm2 PbWO4 crystals and positioned to leave 7 cm for the readout system.

rahmans1 commented 1 year ago

@michael-pitt @ajentsch I have put in a initial template for the B0 ECal ( xml file and constructor. It's basically a copy of the homogeneous calorimeter under epic repository. I have chosen nominal placeholder values for the parametrization and will need some help to tune them to expected values. Here's how the system in the PR looks currently. Segmentation B0ECalPacMan

As you can see, there are still some issues with the parametrization. I had some ideas but haven't had the time to pursue them. I am going to focus on the B0 tracker tomorrow. So, if anyone wants to take a shot at fixing the B0 ECal parametrization tomorrow, they are more than welcome to.

I tried to divide the pacman into inner and outer radial sectors with the inner radius going full azimuth while the outer radius covering some angular span. Each ring is populated by the cuboid modules but as you can see it's not populating the inner radial sector properly and leaving gaps. We can pursue the following remedies:

1) Tweak the disk constructor. The relevant functions are in this case add_disk and fill_rectangle in the constructor.

2) Tweak the xml (play around with radial boundaries) and see if we can use the existing disk constructor to get a close enough layout.

3) Add individual modules in the xml if the position of the modules are known previously. In this case, under placements in the xml file, I believe we can add individual modules instead of a disc constructor using the following recipe. The key would be to figure out the relevant rotations and positions with respect to the global reference frame beforehand for individual modules so that it takes the pacman shape.

         <individuals
            x="<user_defined_x>"
            y="<user_defined_y>"
            z="<user_defined_z>"
            rotx="<user_defined_rotx>"
            roty="<user_defined_roty>"
            rotz="<user_defined_rotz>"
            envelope="true"
            sector="1">
          <module
            sizex="B0ECal_CrystalModule_width"
            sizey="B0ECal_CrystalModule_width"
            sizez="B0ECal_CrystalModule_length"
            vis="GreenVis"
            material="PbWO4"/>
          <wrapper
            thickness="B0ECal_CrystalModule_wrap"
            material="Epoxy"
            vis="GrayVis"/>
        </individuals>

I think 3 is the least ideal solution. So, I would attempt 1 or 2 before I try 3.

wdconinc commented 1 year ago

Can you modify add_rectangle take an additional optional argument that does not fill rectangles entirely in the ring, but allows filling with rectangles where the inner corner is in a ring?

rahmans1 commented 1 year ago

Can you modify add_rectangle take an additional optional argument that does not fill rectangles entirely in the ring, but allows filling with rectangles where the inner corner is in a ring?

Sure. I can try that.

rahmans1 commented 1 year ago

Slight improvement after playing around with constructor. No more gaps between inner and outer radial sector. However, the inner radial sector modules are not covering full azimuth as intended. SlightImprovement Fill

rahmans1 commented 1 year ago

Ok. Got it to a stage where it may be possible to run some test sims. Minor overlap of modules with envelope inner radius for now.

Steps: 1) Start eicshell

./eic-shell

2) Clone and checkout ip6 branch

git clone https://github.com/eic/ip6
cd ip6
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=install
cmake --build build
cmake --install build
cd ..

3) Clone epic

git clone https://github.com/eic/epic
cd epic

4) Build epic and setup environment

cmake -B build -S . -DCMAKE_INSTALL_PREFIX=install
cmake --build build
cmake --install build
cd install/share/epic
ln -s ../../../../ip6/install ip6
cd ../../..
source install/setup.sh

4) At this point, you can export geometry to view

dd_web_display --export $DETECTOR_PATH/$DETECTOR_CONFIG.xml

fullazimuthinnersector

5) To run test sims, I created a steering file called minimal.py with following content

from DDSim.DD4hepSimulation import DD4hepSimulation
from g4units import mm, GeV, MeV, mrad
SIM = DD4hepSimulation()

SIM.enableGun = True
SIM.gun.thetaMin = 6*mrad
SIM.gun.thetaMax = 22*mrad
SIM.gun.momentumMin = 275*GeV
SIM.gun.momentumMax = 275*GeV
SIM.gun.distribution = 'cos(theta)'
SIM.gun.particle = 'proton'
SIM.outputFile = 'result.edm4hep.root'

Note by default the ip6 field is set to 275 GeV setting. If you want to run a different momentum, you will need to change the gun momentum in the steering file and the field in ip6.xml under ip6 folder on line 17.

Then you have to recompile. After that you should be able to run ddsim

ddsim --steeringFile minimal.py -G -N 100 --compactFile $DETECTOR_PATH/$DETECTOR_CONFIG.xml

6) This will create the result.edm4hep.root file. Open it and you can plot quantities like calorimeter hits

B0ECalHits