XENONnT / straxen

Streaming analysis for XENON
BSD 3-Clause "New" or "Revised" License
19 stars 33 forks source link

let xedocs handles the seg partition #1369

Closed GiovanniVolta closed 2 months ago

GiovanniVolta commented 2 months ago

Before you submit this PR: make sure to put all operations-related information in a wiki-note, a PR should be about code and is publicly accessible

What does the code in this PR do / what does it improve?

Changed how to handle the TPC partition for AB and CD SEG.

Can you briefly describe how it works?

The partition AB is distinguished from CD based on a linear and a radial cut on the (xy) plane. The values are take from xedocs+corection repo.

Right now this PR depends on PR#273 in correction and PR#120 in xedocs

Can you give a minimal working example (or illustrate with a figure)?

You have to be on the specific xedocs and correction branches for run the following code

PATH_TO_REPO = 'path_to_correction'
st.set_config({'single_electron_gain_partition': f'objects-to-dict://xedocs://single_electron_gain_partition?run_id=plugin.run_id&version=v1&region=linear&region=circular&as_list=True&sort=region&key_attr=region&value_attr=value&db=local_folder&db__path={PATH_TO_REPO}'})

linear, circular, run_ok = [], [], []
for r in tqdm.tqdm(runs):
        plugin = st.get_single_plugin(f'0{r}', 'corrected_areas')
        linear.append(plugin.single_electron_gain_partition['linear'])
        circular.append(plugin.single_electron_gain_partition['circular'])
        run_ok.append(r)

immagine

Please include the following if applicable:

GiovanniVolta commented 2 months ago

The code works as desired; however, for the ONLINE version, we need to fix the URLconfig for the single_electron_gain_partition. Right now gives the following error:

/home/gvolta/XENONnT/straxen/straxen/corrections_services.py:472: UserWarning: CMT version global_ONLINE is not compatible with this straxen version! CMT global_ONLINE is missing these corrections: single_electron_gain_partition
  warnings.warn(msg, UserWarning)

I need the help of @LuisSanchez25 to fix this.

dachengx commented 2 months ago

Please make sure that the SR0 results will not be affected.

LuisSanchez25 commented 2 months ago

2 things about this, the URL seems to be pointing to CMT is that intentional? Also, I mentioned it also on another pull request but we do not need a new schema, the current avg_se_gain is already designed to deal with paritions

GiovanniVolta commented 2 months ago

the URL seems to be pointing to CMT is that intentional?

I copied and pasted from another URL. I need help fixing it for the ONLINE processing.

mentioned it also on another pull request but we do not need a new schema, the current avg_se_gain is already designed to deal with paritions

Yes, we need this. The avg_se_gain and the partitioning are two different things. One tells you which SEG to use in AB or CD, and the other defines what AB is and what CD is based on radial and linear cuts in the (x,y) plane. Please explain to me if I am wrong.