Saving Observables satisfying specific conditions

REST version : v2.3.11
REST commit : 4ab9ea42

Hi,
I am trying to collect several observables in my process that satisfy specific conditions:


            // getting the total(!)deposited energy from the Geant4
            Double_t g4_TotalEdeposited = fAnalysisTree->GetObservableValue<Double_t>("g4Ana_totalEdep");
            // getting the total(!)primary energy from the Geant4
            Double_t g4_TotalEprimary = fAnalysisTree->GetObservableValue<Double_t>("g4Ana_energyPrimary");
            // Total energy registered by Micromegas Module(s)
            Double_t TotalEregisteredByMM = totE_XZ + totE_YZ;
            // + Checking if we need to apply Energy threshold at the first place
            if (fApplyEThreshold == "ON" ){
                // Writing only the events with abs diff < N_sigmas*diff_sigma value of the difference distribution b/w g4_TotalEprimary and TotalEregisteredByMM 
                if (TMath::Abs(TotalEregisteredByMM * fGain_for_E_threshold - g4_TotalEprimary) < fN_sigmas * fDiff_sigma)
                {
                    ***
                    more code
                    ***

                    // saving observables
                    // Total E registered by MM (with noise!) 
                    SetObservableValue("totalEregisteredByMM", TotalEregisteredByMM * fGain_for_E_threshold);
                    // Total E deposited inside the gas volume on the Geant4 level
                    SetObservableValue("g4_TotalEdeposited", g4_TotalEdeposited);
                    // Primary E of the particle on the Geant4 level
                    SetObservableValue("g4_TotalEprimary", g4_TotalEprimary);
                }
......

I would expect that if additional conditions are applied, the number of entries in the appropriate leaves for these observables will differ from the total number of entries in the input file.
But unfortunately, it’s not the case; the number of entries is the same as in the input.

Moreover, for example, g4_TotalEprimary is a direct copy of the primary energy from the Geant4AnalysisProcess (g4Ana_energyPrimary), so even if all of the entries are saved, I will expect the spectrum shape to be the same. Yet, it’s not the case either:
image
image

Do I have to create my own trees/leaves to save such information and not use SetObservableValue?

Thank you in advance for any suggestions!

Sorry, my bad

I misinterpreted the architecture of Trees.

1 Like

Sorry for not replying earlier, there was an issue with notifications