Filter Tools in AOD


A few Filter tools have been gathered into the AnalysisUtils and McParticleUtils packages to ease the day-to-day selection work.

The aim of these tools is to fully integrate into the already existing PhysicsAnalysis framework of tools as well as to reuse the machinery developped within the AnalysisSelection methods. Up to now, a few basic classes have been developped.

C++ classes

  • IFilterCuts : this is the top level class to handle the copy of filter options between various (and a priori different) filters
  • IFilter : this is a pure abstract base class which declare the pure virtual method isAccepted(const T * element) to be implemented by the child classes
  • MomentumFilter : selects elements on px, py, pz, E, eta, phi, mass and pt (minimum and maximum required values can be set on each). Beware that no check against inconsistencies between requirements is made.
  • PdgIdFilter : selects elements on their particle data group identity (can match strictly or not the elements' sign).
  • CategoryIdFilter : selects elements based on their ownership to a group of particles (leptons, untagged jets,...).
  • ChargeFilter : selects elements on their charge
  • IParticleFilter : inherits from MomentumFilter, PdgIdFilter and ChargeFilter. So it gathers all their features.
  • McVtxFilter : selects HepMC::GenParticles which match a given decay pattern. The decay pattern is modelled via a simple std::string following a shell-like syntax :
    • "23->-5+5" : to select Z bosons decaying into b-bbar pairs,
    • "23-> -11|-13+11|13" : to select Z bosons decaying into pairs of leptons (electrons or muons),
    • "23->" : to select Z bosons decaying into anything,
    • "->-11+11" : to select anything which decays into a pair of electrons.

Use cases


  • This filter class is exercised by the McAodFilter algorithm within the TruthParticleID/McParticleAlgs package. In fact, this filter class is wrapped by an AlgTool - McVtxFilterTool - to expose its relevant interface at the job option level.
  • This algorithm selects GenParticles from a GenEvent and stores them into a slimmed GenEvent
  • The particular particles/decay vertices one is looking for can be modified at the job option level :
# McAodFilter
McAodFilter  = Algorithm( "McAodFilter" )

# Filters
# WARNING : Please note that for the moment one should ALWAYS add the
# filters for orphan particles (like the gamma in the below line) at the
# END of the list of filters (this is explained in the McAODFilter.cxx file)

# Filter which looks for Z0 decaying into a b and a bbar
McAodFilter.McVtxFilterTool.DecayPatterns  = [ "23 -> -5 + 5" ]

# Filter looking for a Z0 decaying either into a e+e- pair or a muon pair
McAodFilter.McVtxFilterTool.DecayPatterns += [ "23 -> -11|-13 + 11|13" ]

# New feature : you can now write decay patterns directly with PDG-IDs
# you can enable this parsing mode by prepending <#id> (without the braces)
# to the decay pattern
# this is the decay pattern for a t->W+ b
McAodFilter.McVtxFilterTool.DecayPatterns += [ "6 -> 24 + 5" ]

# Filter looking for a (stable, ie:no end_vertex) gamma
# Hopefully a cut in pT would/should be applied in a coming version
McAodFilter.McVtxFilterTool.DecayPatterns += [ "->22" ]

  • McAODFilter holds a collection of McVtxFilterTool
  • at execute() stage, each filter is applied on all GenVertex of the GenEvent
  • each matching vertex is flagged to be recorded later on.


  • This filter class is exercised by the AnalysisExamples/FilterExample algorithm
  • FilterExample has an IParticleFilter for each collection type (light jets, b-jets, electrons,...) : easy selection of particle by flavour/type:
//Create a filter of electrons
AnalysisUtils::Selection<PdgIdFilter<ParticleBase> > eleFilter;
eleFilter.setPdgId( PDG::e_minus );
// loose cut on sign: selects both e+ and e-
eleFilter.setMatchSign( false );

// Create a filter of leptons
AnalysisUtils::Selection<PdgIdFilter<ParticleBase> > leptFilter;
ParticleCandidateList pdgIds; pdgIds.addLeptons();
leptFilter.setPdgIds( pdgIds );
  • Pt threshold cut :
// Create a IParticleFilter to select jets
AnalysisUtils::Selection<IParticleFilter> filter;
filter.setPtMin( 60.*GeV );
std::vector<ParticleJet*> myJets;
filter.getObjects( jets, myJets );
  • mass window selection :
// Create an IParticleFilter to select bosons in a +/- 20 GeV mass window
AnalysisUtils::Selection<IParticleFilter> zFilter;
zFilter.setMassMin( (90.-20.) * GeV );
zFilter.setMassMax( (90.+20.) * GeV );

-- SebastienBinet - 17 Feb 2005 -- SebastienBinet - 25 Mar 2006

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2006-03-25 - SebastienBinet
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback