NanoAODSchema
- class coffea.processor.NanoAODSchema(base_form, version='latest')[source]
Bases:
BaseSchemaNanoAOD schema builder
The NanoAOD schema is built from all branches found in the supplied file, based on the naming pattern of the branches. The following additional arrays are constructed:
Any branches named
n{name}are assumed to be counts branches and converted to offsetso{name}Any local index branches with names matching
{source}_{target}Idx*are converted to global indexes for the event chunk (postfixG)Any
nested_itemsare constructed, if the necessary branches are availableAny
special_itemsare constructed, if the necessary branches are available
From those arrays, NanoAOD collections are formed as collections of branches grouped by name, where:
one branch exists named
nameand no branches start withname_, interpreted as a single flat array;one branch exists named
name, one namedn{name}, and no branches start withname_, interpreted as a single jagged array;no branch exists named
{name}and many branches start withname_*, interpreted as a flat table; orone branch exists named
n{name}and many branches start withname_*, interpreted as a jagged table.
Collections are assigned mixin types according to the
mixinsmapping. All collections are then zipped into onebase.NanoEventsrecord and returned.There is a class-level variable
warn_missing_crossrefswhich will alter the behavior of NanoAODSchema. If warn_missing_crossrefs is true then when a missing global index cross-ref target is encountered a warning will be issued. Regardless, the cross-reference is dropped.Attributes Summary
Cross-references, where an index is to be interpreted with respect to another collection
Behaviors necessary to implement this schema
Default configuration for mixin types, based on the collection name.
Nested collections, where nesting is accomplished by assuming the target can be unflattened according to a source counts
Nested collections, where nesting is accomplished by a fixed-length set of indexers
Special arrays, where the callable and input arrays are specified in the value
Methods Summary
v5(base_form)Build the NanoEvents assuming NanoAODv5
v6(base_form)Build the NanoEvents assuming NanoAODv6
v7(base_form)Build the NanoEvents assuming NanoAODv7
Attributes Documentation
- all_cross_references = {'Electron_genPartIdx': 'GenPart', 'Electron_jetIdx': 'Jet', 'Electron_photonIdx': 'Photon', 'FatJet_genJetAK8Idx': 'GenJetAK8', 'FatJet_subJetIdx1': 'SubJet', 'FatJet_subJetIdx2': 'SubJet', 'FsrPhoton_muonIdx': 'Muon', 'GenPart_genPartIdxMother': 'GenPart', 'GenVisTau_genPartIdxMother': 'GenPart', 'Jet_electronIdx1': 'Electron', 'Jet_electronIdx2': 'Electron', 'Jet_genJetIdx': 'GenJet', 'Jet_muonIdx1': 'Muon', 'Jet_muonIdx2': 'Muon', 'LowPtElectron_electronIdx': 'Electron', 'LowPtElectron_genPartIdx': 'GenPart', 'LowPtElectron_photonIdx': 'Photon', 'Muon_fsrPhotonIdx': 'FsrPhoton', 'Muon_genPartIdx': 'GenPart', 'Muon_jetIdx': 'Jet', 'Photon_electronIdx': 'Electron', 'Photon_genPartIdx': 'GenPart', 'Photon_jetIdx': 'Jet', 'Tau_genPartIdx': 'GenPart', 'Tau_jetIdx': 'Jet'}
Cross-references, where an index is to be interpreted with respect to another collection
Each such cross-reference will be converted to a global indexer, so that arbitrarily sliced events can still resolve the indirection back the parent events
- behavior
Behaviors necessary to implement this schema
- mixins = {'CaloMET': 'MissingET', 'ChsMET': 'MissingET', 'Electron': 'Electron', 'FatJet': 'FatJet', 'FsrPhoton': 'FsrPhoton', 'GenDressedLepton': 'PtEtaPhiMCollection', 'GenIsolatedPhoton': 'PtEtaPhiMCollection', 'GenJet': 'PtEtaPhiMCollection', 'GenJetAK8': 'PtEtaPhiMCollection', 'GenMET': 'MissingET', 'GenPart': 'GenParticle', 'GenVisTau': 'GenVisTau', 'IsoTrack': 'PtEtaPhiMCollection', 'Jet': 'Jet', 'LHEPart': 'PtEtaPhiMCollection', 'LowPtElectron': 'LowPtElectron', 'MET': 'MissingET', 'METFixEE2017': 'MissingET', 'Muon': 'Muon', 'PV': 'Vertex', 'Photon': 'Photon', 'PuppiMET': 'MissingET', 'RawMET': 'MissingET', 'RawPuppiMET': 'MissingET', 'SV': 'SecondaryVertex', 'SoftActivityJet': 'PtEtaPhiMCollection', 'SubGenJetAK8': 'PtEtaPhiMCollection', 'SubJet': 'PtEtaPhiMCollection', 'Tau': 'Tau', 'TkMET': 'MissingET', 'TrigObj': 'PtEtaPhiMCollection'}
Default configuration for mixin types, based on the collection name.
The types are implemented in the
coffea.nanoevents.methods.nanoaodmodule.
- nested_index_items = {'FatJet_pFCandsIdxG': ('FatJet_nConstituents', 'FatJetPFCands'), 'GenFatJet_pFCandsIdxG': ('GenJetAK8_nConstituents', 'GenFatJetCands'), 'GenJet_pFCandsIdxG': ('GenJet_nConstituents', 'GenJetCands'), 'Jet_pFCandsIdxG': ('Jet_nConstituents', 'JetPFCands')}
Nested collections, where nesting is accomplished by assuming the target can be unflattened according to a source counts
- nested_items = {'FatJet_subJetIdxG': ['FatJet_subJetIdx1G', 'FatJet_subJetIdx2G'], 'Jet_electronIdxG': ['Jet_electronIdx1G', 'Jet_electronIdx2G'], 'Jet_muonIdxG': ['Jet_muonIdx1G', 'Jet_muonIdx2G']}
Nested collections, where nesting is accomplished by a fixed-length set of indexers
- special_items = {'GenPart_childrenIdxG': (<function children_form>, ('oGenPart', 'GenPart_genPartIdxMotherG')), 'GenPart_distinctChildrenDeepIdxG': (<function distinctChildrenDeep_form>, ('oGenPart', 'GenPart_genPartIdxMotherG', 'GenPart_pdgId')), 'GenPart_distinctChildrenIdxG': (<function children_form>, ('oGenPart', 'GenPart_distinctParentIdxG')), 'GenPart_distinctParentIdxG': (<function distinctParent_form>, ('GenPart_genPartIdxMotherG', 'GenPart_pdgId'))}
Special arrays, where the callable and input arrays are specified in the value
- warn_missing_crossrefs = True
Methods Documentation