Add id scale factor by rdataframe

Dear expert,

I am trying to use RDataFrame class to add scale factor according to the leptons’ pt and eta. Those scale factors are stored in a TH2D[1]2016LegacyReReco_ElectronMedium_Fall17V2.root (11.0 KB)
. I wrote a simple code[2] (2.7 KB)
to do this. But I met error:
error: variable ‘electron_id_sf’ cannot be implicitly captured in a lambda with no capture-default specified
How can I solve this problem?

Thanks you,

_ROOT Version:6.16/00
_Platform:CentOS 7 on lxplus
_Compiler:gcc 4.8.5

@eguiraud can you please take a look?

Thank you in advance,

as the error message says, you have to capture electron_id_sf in your lambda to be able to use it from its body:

auto cut = [electron_id_sf](ints& lepton_pdg_ids, doubles& lepton_pts, doubles& lepton_etas) {

See e.g. the “Variable Capture with Lambdas” section here.


Sorry for late reply. It works.
Thank you, eguiraud.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.