What would be the best way to store per process energy deposition?

Hello,

I am working on an analysis to measure how much energy is deposited for each process inside the sensitive volume. I can access this information iterating over the hits of the event.

I have done this analysis using Python and for each event I can store information of the processes+track_particle that deposits energy inside the sensitive volume. I store this information in a dataframe/dictionary.

Example one event information (energy of hits in sensitive vol normalized to sensitive energy)

{'ionIoni': 0.7512570874090487,
   'eIoni': 0.15449390579821592,
   'e-Step': 0.0291899424502861,
   'msc': 0.0015273534828027515,
   'hIoni_proton': 0.06346100303596942,
   'TRansportation_proton': 6.354713290923283e-05,
   'TRansportation_e-': 7.1606907678093594e-06}

I think it would be useful to have this analysis inside REST however I see some problems that I would like to discuss.

In my opinion its useful to have (at least have an option to) process+particle information instead of just process, sometimes you want this combined, sometimes you don’t.

However I cannot know with anticipation how many “labels” there are (items like ‘TRansportation_e-’) so I cannot have N observables (double) that take values between 0 and 1 (like the ones we use to check if there is a photoelectric process etc.). For example there could be a process+particle like ‘TRansportation_pi+’ which is rare but possible.

Maybe we should store this information using a map (or something similar), but I think it would be very annoying to deal with too. Also we could have one process that “scans” all events to get a list of all possible labels, set those to 0 in the analysis tree and then iterate again over all events to fill those.

I think it would be useful to have this analysis in REST, what do you think?

Just use map as observable. For example:

TRestEvent* TRestXXXProcess::ProcessEvent(TRestEvent* evInput) {
...
map<string, double> processEnergyDepos;
processEnergyDepos["ionIoni"]=0.7512570874090487;
processEnergyDepos["eIoni"]=0.15449390579821592;
processEnergyDepos["e-Step"]=0.0291899424502861;
...
SetObservableValue("processEDep", processEnergyDepos);
...
}

To retrieve this information for one specific event, you can do in restRoot:
AnalysisTree->Scan("xxx_processEDep.first:xxx_processEDep.second","eventID=5")

Then you will get some thing similar to the following(this is the signal baseline analysis from TRestRawSignalAnalysisProcess, where we also don’t know with anticipation how many signals there will be in an event):

***********************************************  
*    Row   * Instance * sAna_base * sAna_base *  
***********************************************  
*        1 *        0 *       137 * 10.303882 *  
*        1 *        1 *       139 * 8.5901338 *  
*        1 *        2 *       141 * 10.707007 *  
*        1 *        3 *       143 * 7.6482939 *  
*        1 *        4 *       145 * 16.269529 *  
*        1 *        5 *       264 * 9.6548640 *  
*        1 *        6 *       266 * 8.0639692 *  
*        1 *        7 *       268 * 8.7707696 *  
*        1 *        8 *       270 * 10.894053 *  
***********************************************  

Here “first” means the key of the map entry, and “second” means the value of the map entry. I believe this is similar with Python dataframe/dictionary

1 Like

Thanks for your response! I will try that