rest-for-physics / detectorlib

It is used to define a detector readout topology, and access gas or other detector properties. It also implements processes including routines for event reconstruction from real detector data, and/or emulation of different physical response effects, such as electron diffusion.
GNU General Public License v3.0
3 stars 4 forks source link

Avoid invoking hardcoded process names when accessing analysis tree observables #47

Open jgalan opened 2 years ago

jgalan commented 2 years ago

As it was pointed out at rest-for-physics/tracklib#13 the process TRestDetectorSingleChannelAnalysisProcess access the analysis tree this way:

    map<int, Double_t> sAna_max_amplitude_map =
        fAnalysisTree->GetObservableValue<map<int, Double_t>>("sAna_max_amplitude_map");
    map<int, Double_t> sAna_thr_integral_map =
        fAnalysisTree->GetObservableValue<map<int, Double_t>>("sAna_thr_integral_map");
    Double_t sAna_PeakAmplitudeIntegral =
        fAnalysisTree->GetObservableValue<Double_t>("sAna_PeakAmplitudeIntegral");
    Double_t sAna_ThresholdIntegral = fAnalysisTree->GetObservableValue<Double_t>("sAna_ThresholdIntegral");
    Double_t sAna_NumberOfGoodSignals = fAnalysisTree->GetObservableValue<int>("sAna_NumberOfGoodSignals");

The process name sAna_ could be eventually changed by the user, or even the data processing chain could evolve and get more complex, implementing more than one TRestRawSignalAnalysisProcess.

I am not sure why this needs to be done at this process, however, being the input event a TRestDetectorSignalEvent (which still keeps the daqId value) it seems that all those map values could be directly extracted/calculated from the input event itself. Isn't? The threshold integral should usually be the same as the total integral, and the number of good signals the total number of signals at TRestDetectorSignalEvent.

nkx111 commented 2 years ago

I agree it is not a good approach.

If in some cases we must retrieve observables from previous process, maybe we shall call the process's method, instead of fAnalysisTree?