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

Detector Parameters Update: Central HD/LD MPGD #566

Closed
Chao1009 opened this issue Oct 12, 2023 · 7 comments
Closed

Detector Parameters Update: Central HD/LD MPGD #566

Chao1009 opened this issue Oct 12, 2023 · 7 comments

Comments

@Chao1009
Copy link
Contributor

Chao1009 commented Oct 12, 2023

A series of smaller issues from #552
det: new value from 2023/09/27 parameter table
sim: current simulation value as of 2023/10/11
template_var: from which we extract the sim value in compact files. Empty means we do not know.
stat: Correct, Missing, or Mismatched

Please implement the new detector parameters, and try to fill in the template_var for the Missing ones if you think it's important for future simulation/design comparison.

Here is the detailed report for this detector subsystem:

CENTRAL DETECTOR, HD MPGD 1, : 
                           det      sim                                                 template_var        stat
Length (cm)                2.5      NaN                                                        Empty     Missing
Inner Radius (cm)        7.014    7.014                                   {{ForwardMPGDLayer1_rmin}}     Correct
Outer Radius (cm)         50.0     50.0                                   {{ForwardMPGDLayer1_rmax}}     Correct
Offset from Center (cm)  148.0      NaN                                                        Empty     Missing
Physical Start (cm)      148.0  147.639                                   {{ForwardMPGDLayer1_zmin}}  Mismatched
Physical End (cm)        150.5  148.361  {{ForwardMPGDLayer1_zmin+ForwardMPGDEndcapLayer_thickness}}  Mismatched

CENTRAL DETECTOR, HD MPGD 2, : 
                           det      sim                                                 template_var        stat
Length (cm)                2.5      NaN                                                        Empty     Missing
Inner Radius (cm)        7.014    7.014                                   {{ForwardMPGDLayer2_rmin}}     Correct
Outer Radius (cm)         50.0     50.0                                   {{ForwardMPGDLayer2_rmax}}     Correct
Offset from Center (cm)  161.0      NaN                                                        Empty     Missing
Physical Start (cm)      161.0  160.639                                   {{ForwardMPGDLayer2_zmin}}  Mismatched
Physical End (cm)        163.5  161.361  {{ForwardMPGDLayer2_zmin+ForwardMPGDEndcapLayer_thickness}}  Mismatched

CENTRAL DETECTOR, LD MPGD 1, : 
                           det    sim               template_var        stat
Length (cm)                2.5    NaN                      Empty     Missing
Inner Radius (cm)        4.635  4.653  {{BackwardMPGDMod1_rmin}}  Mismatched
Outer Radius (cm)         50.0   50.0  {{BackwardMPGDMod1_rmax}}     Correct
Offset from Center (cm) -110.0    NaN                      Empty     Missing
Physical Start (cm)     -112.5 -110.0     -{{BackwardMPGD_zmin}}  Mismatched
Physical End (cm)       -110.0    NaN                      Empty     Missing

CENTRAL DETECTOR, LD MPGD 2, : 
                           det    sim                                   template_var        stat
Length (cm)                2.5    NaN                                          Empty     Missing
Inner Radius (cm)        4.635  4.635                      {{BackwardMPGDMod2_rmin}}     Correct
Outer Radius (cm)         50.0   50.0                      {{BackwardMPGDMod2_rmax}}     Correct
Offset from Center (cm) -120.0    NaN                                          Empty     Missing
Physical Start (cm)     -122.5 -120.0  -{{BackwardMPGD_zmin+BackwardMPGDMod_offset}}  Mismatched
Physical End (cm)       -120.0    NaN                                          Empty     Missing
@mposik1983
Copy link
Contributor

@Chao1009 Thanks for putting this together. I have a few clarifying questions:

  1. for some quantities the detector table lists envelopes for Physical Start and Physical End, but in simulation for example the variable ForwardMPGDLayer2_zmin+ForwardMPGDEndcapLayer_thickness refers to the thickness of the detector that is implemented in the simulation (not the envelope). So ForwardMPGDLayer2_zmin+ForwardMPGDEndcapLayer_thickness should fit within the Physical Start and Stop values given in the detector table. Should I define a variable in the compact file that specifies these envelopes?

  2. If the template variable needs to be changed or added, what file should I modify?

@Chao1009
Copy link
Contributor Author

@mposik1983 Thank you for the quick response.

  1. Yes, compact variables that can be directly compared to the detector geometry matrices would be perfect for future comparisons.
  2. The variables are defined in epic/templates/DetectorParameterTable.csv.jinja2. This template can be read as a csv file. You may update the template directly with a PR, or send us a list of the variables you would like to update.

@mposik1983
Copy link
Contributor

@Chao1009 I have updated the MPGD endcap disks and some of the values in the detector template file. Do you know how I can generate a csv file locally to verify that the new sim values match the detector ones?

@Chao1009
Copy link
Contributor Author

Chao1009 commented Nov 7, 2023

@mposik1983 Please follow the steps below to update the comparison report (the first 7 steps can be skipped if you have already set up the development environment):

  1. use eic-shell (https://github.com/eic/eic-shell)

  2. clone epic repository git clone git@github.com:eic/epic.git (here and below I'm assuming this repo is at ./epic under eic-shell)

  3. copy /opt/detector/setup.sh to a local folder (here and below I'm assuming it is ./local under eic-shell)

  4. modify ./local/setup.sh so ./local/lib (with full path) is added on top of the LD_LIBRARY_PATH and DETECTOR_PATH is set to ./epic (with full path)

  5. source ./local/setup.sh

  6. cd ./epic

  7. compile epic with cmake -S . -B build -DCMAKE_INSTALL_PREFIX=../local, and then cmake --build build --target install -j8
    The above steps are to set up a development environment so the constants in your development folder (./epic) are used.

  8. dump the constants with npdet_info dump ${DETECTOR_PATH}/epic_craterlake.xml | tee doc/constants.out

  9. make the detector parameter table with ./bin/make_detector_parameter_table > sim_table.csv
    Note this binary reads the template at templates/DetectorParameterTable.csv.jinja2 and the constants at doc/constants.out

  10. get the comparison report with ./bin/compare_detector_parameter_table https://eic.jlab.org/Geometry/Detector/Detector-20231031150001.html sim_table.csv --template templates/DetectorParameterTable.csv.jinja2 -v

Please let me know if you have any issues or questions. I can also help update the comparison with the merged PRs (using main branch).

@mposik1983
Copy link
Contributor

Thanks. I was able to create the constants.out, I renamed it to constants.toml because I think that is what the make_detector_parameter_table was looking for. When running make_detector_parameter_table > sim_table.csv I get the following error:
./bin/make_detector_parameter_table > sim_table.csv Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/toml/decoder.py", line 511, in loads ret = decoder.load_line(line, currentlevel, multikey, File "/usr/local/lib/python3.10/site-packages/toml/decoder.py", line 778, in load_line value, vtype = self.load_value(pair[1], strictly_valid) File "/usr/local/lib/python3.10/site-packages/toml/decoder.py", line 912, in load_value v = float(v) ValueError: could not convert string to float: '0.000 = -2.559005681*tesla'

@Chao1009
Copy link
Contributor Author

hmmm, I didn't encounter such an error. Let me try it again with a fresh new conainer.

@Chao1009
Copy link
Contributor Author

related PR: #593

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants