NanoAODSchema
- class coffea.nanoevents.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.The same holds for
error_missing_events_id. If error_missing_events_id is true, then when the ‘run’, ‘event’, or ‘luminosityBlock’ fields are missing, an exception will be thrown; if it is false, just a warning will be issued.Attributes Summary
Cross-references, where an index is to be interpreted with respect to another collection
List of NanoAOD event IDs
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
behavior()Behaviors necessary to implement this schema (dict)
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
- error_missing_event_ids = True
- event_ids = ['run', 'luminosityBlock', 'event']
List of NanoAOD event IDs
- 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
- classmethod v5(base_form)[source]
Build the NanoEvents assuming NanoAODv5
- Returns:
out – Schema assuming NanoAODv5
- Return type:
- classmethod v6(base_form)[source]
Build the NanoEvents assuming NanoAODv6
- Returns:
out – Schema assuming NanoAODv6
- Return type: