You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking at CMS MiniAOD files using uproot and in principle it works fine for many cases (non-CMS branches of course), but there is one particular case where the uproot flattening loses some information:
when there are 2D arrays (i.e. array in array) both dimensions are flattened together and the 2D index becomes 1D.
The problem is that the 1st layer index actually corresponds to an important feature (the bunch-crossing [BX] number), whereas the second is just the index in the array. Given that not all events have an equal number of BX filled (and the # of objects differs) one cannot restore the BX index after flattening.
(By the way, is there a way to display the full branch name for show? this is quite inconvenient for long branch names (as they typically are in MiniAOD..)
I actually found a potentially useful branch (the last in the show output which is the vector of ints): 'l1tMuonBXVector_gmtStage2Digis_Muon_RECO.obj.itrs_'
I get the impression that this iters gets incremented in the element after the element that had content.
If that is true (more a CMS-specific question) then I can probably decode the first-level index from iters (need to think about an elegant way to do that with ak).
But it would be nice from uproot to somehow also give a handle on the index it decoded.
P.s. here is the CMS internal file /eos/cms/tier0/store/data/Run2022C/SingleMuon/MINIAOD/PromptReco-v1/000/355/872/00000/0fa8e1c9-699c-48b8-8622-1c42f7c0dfaa.root
Somehow these branches are not in the OpenData release unfortunately.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm looking at CMS MiniAOD files using uproot and in principle it works fine for many cases (non-CMS branches of course), but there is one particular case where the uproot flattening loses some information:
when there are 2D arrays (i.e. array in array) both dimensions are flattened together and the 2D index becomes 1D.
The problem is that the 1st layer index actually corresponds to an important feature (the bunch-crossing [BX] number), whereas the second is just the index in the array. Given that not all events have an equal number of BX filled (and the # of objects differs) one cannot restore the BX index after flattening.
Example of C++ analysis code: https://github.com/lathomas/JetMETStudies/blob/master/JMEAnalyzer/plugins/JMEAnalyzer.cc#L859-L872
Printout of uproot's
show
:(By the way, is there a way to display the full branch name for show? this is quite inconvenient for long branch names (as they typically are in MiniAOD..)
Example processing in uproot:
Open arrays
Print out
pt
:I actually found a potentially useful branch (the last in the
show
output which is the vector of ints):'l1tMuonBXVector_gmtStage2Digis_Muon_RECO.obj.itrs_'
It contains:
When I print out both
pt
and thisiters
:I get the impression that this
iters
gets incremented in the element after the element that had content.If that is true (more a CMS-specific question) then I can probably decode the first-level index from
iters
(need to think about an elegant way to do that withak
).But it would be nice from
uproot
to somehow also give a handle on the index it decoded.P.s. here is the CMS internal file
/eos/cms/tier0/store/data/Run2022C/SingleMuon/MINIAOD/PromptReco-v1/000/355/872/00000/0fa8e1c9-699c-48b8-8622-1c42f7c0dfaa.root
Somehow these branches are not in the OpenData release unfortunately.
Beta Was this translation helpful? Give feedback.
All reactions