I follow the examples in df102_NanoAODDimuonAnalysis.py and f007_snapshot.py, and I try to save a snapshot before making the plots keeping only di-muon mass and muon pt
import ROOT
df = ROOT.RDataFrame("Events", "root://eospublic.cern.ch//eos/opendata/cms/derived-data/AOD2NanoAODOutreachTool/Run2012BC_DoubleMuParked_Muons.root")
df_sel= df.Filter("nMuon == 2", "Events with exactly two muons").Filter("Muon_charge[0] != Muon_charge[1]", "Muons with opposite charge")
df_mass = df_sel.Define("Dimuon_mass", "std::sqrt(2*Muon_pt[0]*Muon_pt[1]*(std::cosh(Muon_eta[0]-Muon_eta[1])-std::cos(Muon_phi[0]-Muon_phi[1])))")
#select branches
branchList = ROOT.vector('string')()
for attr in ['pt']:
branchList.push_back('Muon_{}'.format(attr))
branchList.push_back('Dimuon_mass')
# skim samples before running the analysis:
df_mass.Snapshot('Events','./df_dimu.root',branchList)
Error in <TBranch::TBranch>: Illegal leaf: Muon_pt/Muon_pt[nMuon]/F If this is a variable size C array it’s possible that the branch holding the size is not available.
How I can save arrays
PS: Can I save all arrays from the pattern Muon_*
? (relevant for other datasets with more branches)
ROOT Version: 6.14/09
Platform: centos7
Compiler: gcc7