The Tau Collections

The Tau Collections#

Warning

The examples on this page have not been updated to use r22 and ServiceX 3 yet.

Taus are complex jet-like objects that are reconstructed and calibrated with their own algorithms. They are a lot like jets, from a data model point-of-view.

from config import deliver_files
from config import sx_f
from func_adl_servicex_xaodr22 import FuncADLQueryPHYSLITE, cpp_float, cpp_vfloat

import matplotlib.pyplot as plt
import numpy as np
import uproot
import awkward as ak
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[1], line 1
----> 1 from config import deliver_files
      2 from config import sx_f
      3 from func_adl_servicex_xaodr22 import FuncADLQueryPHYSLITE, cpp_float, cpp_vfloat

ImportError: cannot import name 'deliver_files' from 'config' (/home/rjanusia/WorkingDirectory/IrisHep/xaod_usage/book/chapters/config.py)

By default we fetch tau-jets from the Tight working point (you can change the working point by passing the working_point argument).

query = FuncADLQueryPHYSLITE()
jets_per_event = query.Select(lambda e: e.TauJets())
jet_info_per_event = jets_per_event.Select(
    lambda jets: {
        'pt': jets.Select(lambda j: j.pt() / 1000),
    }
)

files = deliver_files(jet_info_per_event,sx_f)
[01/22/25 16:20:20] ERROR    Transform "sx_f" completed with failures: 1/1 files failed. Will not query_core.py:210
                             cache.                                                                                
                    ERROR    Transform Request id: 4790e2c7-b444-4137-9241-ae9d5aca3a3c           query_core.py:215
                    ERROR    More information of 'sx_f' HERE                                      query_core.py:224

taus = (ds
        .Select(lambda e: e.TauJets())
        .Select(lambda ts: {
            'pt': [t.pt()/1000.0 for t in ts],
            'eta': [t.eta() for t in ts],
            'phi': [t.phi() for t in ts],
        })
        .AsAwkwardArray()
        .value())
plt.hist(ak.flatten(taus.pt), bins=100, range=(0, 100))
plt.xlabel('Tau $p_T$ [GeV]')
plt.ylabel('Number of Taus')
_ = plt.title('Tau $p_T$ distribution for $Z\\rightarrow \\tau \\tau$ events')
../_images/1490b0a1ba82761bce4072b4ab069bd76acb1fbd1f20f494e1054c3b208f2ead.png

Calibration#

By default the taus we pulled from above are calibrated, and the best central value for the tau collection you request is returned. We use the standard approach to get both uncalibrated versions of the collection and systematic error variations.

To grab the raw jets (without calibration) we just set the uncalibrated_collection parameter to TauJets (there is very little reason one will do this normally):

raw_taus = (ds
            .Select(lambda e: e.TauJets(uncalibrated_collection="TauJets"))
            .Select(lambda ts: {
                'pt': [t.pt()/1000.0 for t in ts],
                'eta': [t.eta() for t in ts],
                'phi': [t.phi() for t in ts],
            })
            .AsAwkwardArray()
            .value())

The number of taus and the number of calibrated taus are quite different, so we’ll need to match them in \(\eta\) and \(\phi\):

raw_taus_matched = match_objects(taus, raw_taus)
plt.hist(ak.flatten(taus.pt-raw_taus_matched.pt), bins=100, range=(-10, 10))
plt.xlabel('$\Delta p_T$ for calibrated taus matched to their raw taus [GeV]')
plt.ylabel('Number of Taus')
_ = plt.title('The effect of tau calibration on tau $p_T$ in $Z\\rightarrow \\tau\\tau$ events')
../_images/ad8a773e06eaf237c7c521ae43fa9799d638a1bfb5b92e04e06f9ce9d3b66a42.png

If we instead want a particular systematic error, we need only name that error to get it back. Knowing what the names of the systematic errors, however, is not something that can be programmatically determined ahead of time. See the further information section at the end of this chapter to links to the ATLAS jet calibration info twiki.

sys_taus = (calib_tools.query_sys_error(ds, 'TAUS_TRUEHADTAU_SME_TES_DETECTOR__1up')
            .Select(lambda e: e.TauJets())
            .Select(lambda ts: {
                'pt': [t.pt()/1000.0 for t in ts],
                'eta': [t.eta() for t in ts],
                'phi': [t.phi() for t in ts],
            })
            .AsAwkwardArray()
            .value())
sys_taus_matched = match_objects(taus, sys_taus)
plt.hist(ak.flatten(taus.pt-sys_taus_matched.pt), bins=100, range=(-5, 5))
plt.xlabel(r'$\Delta p_T$ for calibrated taus matched to their $\phi-\eta$ raw taus [GeV]')
plt.ylabel('Number of Taus')
plt.yscale('log')
_ = plt.title(r'The effect of a tau calibration sys error on tau $p_T$ in $Z\rightarrow \tau\tau$ events')
../_images/c5c77bf409d3ae64e8f67ca69f3532738f6e97854903dbc6e9359afb2a8091ab.png

The Datamodel#

The data model when this documentation was last built was:

from func_adl_servicex_xaodr21.xAOD.taujet_v3 import TauJet_v3
help(TauJet_v3)
Help on class TauJet_v3 in module func_adl_servicex_xaodr21.xAOD.taujet_v3:

class TauJet_v3(builtins.object)
 |  A class
 |  
 |  Methods defined here:
 |  
 |  ROIWord(self) -> 'int'
 |      A method
 |  
 |  allTauTrackLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_tautrack_v1___.vector_ElementLink_DataVector_xAOD_TauTrack_v1___'
 |      A method
 |  
 |  allTauTrackLinksNonConst(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_tautrack_v1___.vector_ElementLink_DataVector_xAOD_TauTrack_v1___'
 |      A method
 |  
 |  charge(self) -> 'float'
 |      A method
 |  
 |  chargedPFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  chargedPFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  clearDecorations(self) -> 'bool'
 |      A method
 |  
 |  cluster(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.iparticle.IParticle'
 |      A method
 |  
 |  clusterLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_iparticle___.vector_ElementLink_DataVector_xAOD_IParticle___'
 |      A method
 |  
 |  e(self) -> 'float'
 |      A method
 |  
 |  eta(self) -> 'float'
 |      A method
 |  
 |  etaDetectorAxis(self) -> 'float'
 |      A method
 |  
 |  etaFinalCalib(self) -> 'float'
 |      A method
 |  
 |  etaIntermediateAxis(self) -> 'float'
 |      A method
 |  
 |  etaJetSeed(self) -> 'float'
 |      A method
 |  
 |  etaPanTauCellBased(self) -> 'float'
 |      A method
 |  
 |  etaPanTauCellBasedProto(self) -> 'float'
 |      A method
 |  
 |  etaTauEnergyScale(self) -> 'float'
 |      A method
 |  
 |  etaTauEtaCalib(self) -> 'float'
 |      A method
 |  
 |  etaTrigCaloOnly(self) -> 'float'
 |      A method
 |  
 |  hadronicPFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  hadronicPFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  hasNonConstStore(self) -> 'bool'
 |      A method
 |  
 |  hasStore(self) -> 'bool'
 |      A method
 |  
 |  index(self) -> 'int'
 |      A method
 |  
 |  jet(self) -> 'func_adl_servicex_xaodr21.xAOD.jet_v1.Jet_v1'
 |      A method
 |  
 |  jetLink(self) -> 'func_adl_servicex_xaodr21.elementlink_datavector_xaod_jet_v1__.ElementLink_DataVector_xAOD_Jet_v1__'
 |      A method
 |  
 |  m(self) -> 'float'
 |      A method
 |  
 |  mDetectorAxis(self) -> 'float'
 |      A method
 |  
 |  mFinalCalib(self) -> 'float'
 |      A method
 |  
 |  mIntermediateAxis(self) -> 'float'
 |      A method
 |  
 |  mJetSeed(self) -> 'float'
 |      A method
 |  
 |  mPanTauCellBased(self) -> 'float'
 |      A method
 |  
 |  mPanTauCellBasedProto(self) -> 'float'
 |      A method
 |  
 |  mTauEnergyScale(self) -> 'float'
 |      A method
 |  
 |  mTauEtaCalib(self) -> 'float'
 |      A method
 |  
 |  mTrigCaloOnly(self) -> 'float'
 |      A method
 |  
 |  nAllTracks(self) -> 'int'
 |      A method
 |  
 |  nChargedPFOs(self) -> 'int'
 |      A method
 |  
 |  nClusters(self) -> 'int'
 |      A method
 |  
 |  nHadronicPFOs(self) -> 'int'
 |      A method
 |  
 |  nNeutralPFOs(self) -> 'int'
 |      A method
 |  
 |  nPi0PFOs(self) -> 'int'
 |      A method
 |  
 |  nPi0s(self) -> 'int'
 |      A method
 |  
 |  nProtoChargedPFOs(self) -> 'int'
 |      A method
 |  
 |  nProtoNeutralPFOs(self) -> 'int'
 |      A method
 |  
 |  nProtoPi0PFOs(self) -> 'int'
 |      A method
 |  
 |  nShotPFOs(self) -> 'int'
 |      A method
 |  
 |  nTracksCharged(self) -> 'int'
 |      A method
 |  
 |  nTracksIsolation(self) -> 'int'
 |      A method
 |  
 |  nTracksWithMask(self, classification: 'int') -> 'int'
 |      A method
 |  
 |  neutralPFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  neutralPFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  p4(self) -> 'func_adl_servicex_xaodr21.tlorentzvector.TLorentzVector'
 |      A method
 |  
 |  phi(self) -> 'float'
 |      A method
 |  
 |  phiDetectorAxis(self) -> 'float'
 |      A method
 |  
 |  phiFinalCalib(self) -> 'float'
 |      A method
 |  
 |  phiIntermediateAxis(self) -> 'float'
 |      A method
 |  
 |  phiJetSeed(self) -> 'float'
 |      A method
 |  
 |  phiPanTauCellBased(self) -> 'float'
 |      A method
 |  
 |  phiPanTauCellBasedProto(self) -> 'float'
 |      A method
 |  
 |  phiTauEnergyScale(self) -> 'float'
 |      A method
 |  
 |  phiTauEtaCalib(self) -> 'float'
 |      A method
 |  
 |  phiTrigCaloOnly(self) -> 'float'
 |      A method
 |  
 |  pi0(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.iparticle.IParticle'
 |      A method
 |  
 |  pi0ConeDR(self) -> 'float'
 |      A method
 |  
 |  pi0Links(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_iparticle___.vector_ElementLink_DataVector_xAOD_IParticle___'
 |      A method
 |  
 |  pi0PFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  pi0PFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  protoChargedPFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  protoChargedPFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  protoNeutralPFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  protoNeutralPFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  protoPi0PFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  protoPi0PFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  pt(self) -> 'float'
 |      A method
 |  
 |  ptDetectorAxis(self) -> 'float'
 |      A method
 |  
 |  ptFinalCalib(self) -> 'float'
 |      A method
 |  
 |  ptIntermediateAxis(self) -> 'float'
 |      A method
 |  
 |  ptJetSeed(self) -> 'float'
 |      A method
 |  
 |  ptPanTauCellBased(self) -> 'float'
 |      A method
 |  
 |  ptPanTauCellBasedProto(self) -> 'float'
 |      A method
 |  
 |  ptTauEnergyScale(self) -> 'float'
 |      A method
 |  
 |  ptTauEtaCalib(self) -> 'float'
 |      A method
 |  
 |  ptTrigCaloOnly(self) -> 'float'
 |      A method
 |  
 |  rapidity(self) -> 'float'
 |      A method
 |  
 |  secondaryVertex(self) -> 'func_adl_servicex_xaodr21.xAOD.vertex_v1.Vertex_v1'
 |      A method
 |  
 |  secondaryVertexLink(self) -> 'func_adl_servicex_xaodr21.elementlink_datavector_xaod_vertex_v1__.ElementLink_DataVector_xAOD_Vertex_v1__'
 |      A method
 |  
 |  shotPFO(self, i: 'int') -> 'func_adl_servicex_xaodr21.xAOD.pfo_v1.PFO_v1'
 |      A method
 |  
 |  shotPFOLinks(self) -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_pfo_v1___.vector_ElementLink_DataVector_xAOD_PFO_v1___'
 |      A method
 |  
 |  tauTrackLinksWithMask(self, noname_arg: 'int') -> 'func_adl_servicex_xaodr21.vector_elementlink_datavector_xaod_tautrack_v1___.vector_ElementLink_DataVector_xAOD_TauTrack_v1___'
 |      A method
 |  
 |  trackFilterProngs(self) -> 'int'
 |      A method
 |  
 |  trackFilterQuality(self) -> 'int'
 |      A method
 |  
 |  trackWithMask(self, i: 'int', mask: 'int', container_index: 'int') -> 'func_adl_servicex_xaodr21.xAOD.tautrack_v1.TauTrack_v1'
 |      A method
 |  
 |  usingPrivateStore(self) -> 'bool'
 |      A method
 |  
 |  usingStandaloneStore(self) -> 'bool'
 |      A method
 |  
 |  vertex(self) -> 'func_adl_servicex_xaodr21.xAOD.vertex_v1.Vertex_v1'
 |      A method
 |  
 |  vertexLink(self) -> 'func_adl_servicex_xaodr21.elementlink_datavector_xaod_vertex_v1__.ElementLink_DataVector_xAOD_Vertex_v1__'
 |      A method
 |  
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |  
 |  auxdataConst
 |      A method
 |  
 |  isAvailable
 |      A method
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)

Further Information#