TisTosParticleTagger DVAlgorithm

This is an algorithm added to Phys/TisTosTobbing since v5r0 (you also need Phys/DaVinciInterfaces v2r5; use DaVinci v25r7 and higher). Chris Thomas and Vava contributed early prototypes for this code. You can make the code work with older releases - see at the bottom.

It has two possible uses:

  1. as Particle Filter to pass only Particles which satisfy the TisTos criteria. This feature was not in the original v5r0 release; use v5r1 or higher.
  2. as Event filter based on TisTos requirements
  3. as Tagger of Particles stored on TES with TisTos results added to ExtraInfo of the Particle. Once such information is added, the tagged Particles can be filtered later on with INFO() Loki Hybrid function. This method is not allowed in Hlt2 or stripping.

There are two properties which must be set by the user every time the Algorithm is configured; InputLocations for location of signal particles (this is done automatically for you if you use Juan's Selection framework) and TisTosSpecs for definition of TisTos criteria.

Table of Contents

TisTosSpecs property

It is of type std::map<std::string,int>. The string specifies the "Trigger Input" either via specific trigger line name or via regex expression to be matched against legal trigger names for given event.

The string also specifies TisTos requirement to be imposed, which can be either TOS, TIS or TUS. TUS = "Trigger Used Signal", this condition is satisfied by a trigger candidate which is fully (i.e. TOS) or partially (i.e. TPS) contained within the signal. The Trigger Input and TisTos requriment are separated by "%" character.

The int specifies int-key to be used when saving the TisTos result in ExtraInfo of analyzed Particle. Do not use this feature unless you are using method 3 (can't use it in Hlt & Stripping). Set this number to 0.

from Configurables import TisTosParticleTagger
myTagger = TisTosParticleTagger("MyTagger")
myTagger.InputLocations = [ "/Event/Phys/StdLooseJpsi2MuMu" ]
myTagger.TisTosSpecs = { "Hlt1.*Hadron.*Decision%TUS":0, "Hlt1.*Mu.*Decision%TOS":0 }
DaVinci().UserAlgorithms = [ myTagger ]

By default setFilterPassed(true) is set only if at least one TisTos requirement is satisfied for at least one input Particle. You can set

myTagger.PassOnAll = TRUE 
to always pass the event independently of TisTos results (this turns the algorithm into pure Particle Tagger with no Event filtering). This also changes which Particles are saved in the output container. By default only the particles which satisfy at least one TosTos criterion are saved. Once PassOnAll is set to true then all particles are saved (thus the input and output containers become identical). This may be useful if you use method 3 and need to bind execution of the Tagger in the input/output chain (e.g. used in Hlt2).

If the trigger names are given with no regex special characters, you can speed up the algorithm by setting:

myTagger.NoRegex = TRUE
(an example of regex special characters - ".*").

Using TisTosParticleTagger as particle filter (Method 1)

In this example (run on Dimuon stream) we select /Event/Dimuon/Phys/DiMuonIncLine/Particles which are TOS with respect to Hlt1 DiMuon triggers:

from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence

from Configurables import TisTosParticleTagger
_myTagger = TisTosParticleTagger("MyTagger")
_myTagger.TisTosSpecs = { "Hlt1.*DiMuon.*Decision%TOS":0 }
selMyDimuon = Selection("SelDimuonTriggered", Algorithm = _myTagger, 
 RequiredSelections =[AutomaticData(Location="/Event/Dimuon/Phys/DiMuonIncLine")])
selSequence = SelectionSequence( "seqSelDimuonTriggered",  TopSelection=selMyDimuon )

from Configurables import DaVinci
DaVinci().UserAlgorithms = [selSequence]
Using this on MDSTs requires additional set-up options - see here.

See also "Using in Hlt2 context" section.

Filtering on stored TisTos results in Particle ExtraInfo (Method 3)

This is based on tips from Vanya.

The only reason why you would sometimes need to filter via method 3) rather than 1) is that you may want to CombineParticles with criterion less stringent than all Particles satisfying the TisTos criteria (e.g. you may require that at least one satisfies them - see example below).

Use int-keys above 10000 (reserved for users) but not too large to stay within legal int values. If you use "0" then the Particles will not be tagged (use this if you want to use the algorithm as event filter only). It is fine to use the same int-key with more than one "Trigger Input" - in that case the result stored is an OR between all specs for the same int-key. Here is an example of adding TisTosParticleTagger to DaVinci sequence:

from Configurables import TisTosParticleTagger
myTagger = TisTosParticleTagger("MyTagger")
myTagger.InputLocations = [ "/Event/Phys/StdLooseJpsi2MuMu" ]
myTagger.TisTosSpecs = { "Hlt1.*Hadron.*Decision%TUS":12345, "Hlt1.*Mu.*Decision%TOS":22246 }
DaVinci().UserAlgorithms = [ myTagger ]

Once you execute the Tagger you can filter the tagged Particles with LoKi functor INFO. Here is an example to work together with the example given above. It will select only those StdLooseJpsi2MuMu candidates which were used in Hlt1 Hadron triggers (TUS). The subselection will appear under 'Phys/HadronTUSJPsi'.

from Configurables import FilterDesktop
_hadronTUSFilter = FilterDesktop('HadronTUSFilter')
_hadronTUSFilter.Code = " 0 < INFO( 12345, 0.0 ) "

from PhysSelPython.Wrappers import AutomaticData, DataOnDemand, Selection, SelectionSequence
SelStdLooseJPsi = DataOnDemand(Location = "Phys/StdLooseJpsi2MuMu")

hadronTUSJPsi = Selection(name = 'HadronTUSJPsi',
    Algorithm = _hadronTUSFilter,
    RequiredSelections = [ SelStdLooseJPsi])
SomeSelSeq = SelectionSequence('SomeSel',TopSelection = hadronTUSJPsi )
DaVinci().UserAlgorithms += [ SomeSelSeq.sequence() ]

You can also filter combinations in CombineParticles:

_JPsiAndX = CombineParticles("JPsiAndX")
_JPsiAndX.Preambulo = [ " HadTUS = 0.1 < INFO( 12345, 0.0 ) " ]
_JPsiAndX.Code = " 0 < ANUM( HadTUS ) "

Here we requested that at least one of the daughter particles is "Hlt1.*Hadron.*Decision%TUS". To require at least two we would have cut:

_JPsiAndX.Code = " 1 < ANUM( HadTUS ) "

Notice that you can combine Particle selections which were tagger and not tagged with TisTos info here.

In these examples we filtered the Particles which were specified as input to TisTosParticleTagger, thus a mixture of Particles which passed or failed the specified TisTos criteria. You can also filter the output Particle container from the TisTosParticleTagger which (by default) contains only Particles which satisified at least one specified TisTos criterion. When using the output container In case of single TisTos requirement, there is no need to filter on ExtraInfo in a separate step (thus set ExtraInfo index to zero).

Using in Hlt2 context

The TisTosParticleTagger will automatically switch to "TriggerTisTosInHlt" tool instead of offline "TriggerTisTos" when placed in Hlt sequence (it checks OnOffline tool online() method). You can TisTos Hlt1 trigger decisions with respect to Hlt2 particles when using it in Hlt.

In Hlt2 you are likely to filter on the output container of TisTosParticleTagger (Method 1). For Hlt1 in 1Track configuration you should simply require Hlt1 TOS in your filter (see an example below). If 2-Track triggers make a come back in Hlt1, you can filter twice for the best speed up. First filter single-track Particles to produce Hlt1 TUS (see also "Tightening TUS criterion" below).Then create their combinations and require Hlt1 TOS for the final combination.

Here is an example from Chris Thomas (and Alex Shires) how to use TisTosParticleTagger in Hlt2 code ('unfiltered' is a generic Hlt2 container - e.g. the two-body topo combinatorics).

             from Configurables import TisTosParticleTagger
             TOSInputParticlesFilter = TisTosParticleTagger("TOSInputParticlesFilter")
             TOSInputParticlesFilter.TisTosSpecs = { "Hlt1Track.*Decision%TOS":0 }
             # keep next 4 lines only if you are sure the Hlt1 trigger candidates do not contain calo hits
             # (do not use e.g. with Hlt1 Ecal lines)
             TOSInputParticlesFilter.ProjectTracksToCalo = FALSE
             TOSInputParticlesFilter.CaloClustForCharged = FALSE
             TOSInputParticlesFilter.CaloClustForNeutral = FALSE
             TOSInputParticlesFilter.TOSFrac = { 4:0.0, 5:0.0 }

             # uncomment next line if you use "TUS" filtering instead of "TOS"     
             # TOSInputParticlesFilter.CompositeTPSviaPartialTOSonly = TRUE

             TOSInputParticlesFilter.InputLocations = [unfiltered.outputSelection() ]
             _tosfiltered = bindMembers("Filtered", [ unfiltered, TOSInputParticlesFilter ])

             # dummy filter needed for Hlt2Line if TisTosParticleTagger is the last filter in the line
            _filterdesktop = Hlt2Member(FilterDesktop, 'Filter', 
                   InputLocations=[_tosfiltered], Code="ALL")
            _seqTOSfiltered = bindMembers('FilteredWithTOS',[_tosfiltered, _filterdesktop])

Using to TisTos L0 trigger

You need to force L0TriggerTisTos tool to be used via:

myTagger.TriggerTisTosName= "L0TriggerTisTos"
myTagger.TisTosSpecs = { "L0.*Muon.*Decision%TIS":0 }

Using to TisTos any TES container of Tracks, Vertecies or Particles

You need to force TESTisTos tool to be used via:

myTagger.TriggerTisTosName= "TESTisTos"
myTagger.TisTosSpecs = { "/Event/Dimuon/Phys/DimuonIncLine/Particles%TOS":0 }

Please notice that using this method you can align your Particles with inclusive stripping lines. Just dial their TES location in the "Trigger Input".

Tightening TUS criterion

The default TUS behavior is that TUS is true if any part of the trigger candidate is not TIS (by default <1% of hits shared with signal). This will pass your Hlt2 tracks which have good overlap with e.g. any of the two-Tracks selected by DiHadron line but also all the clones which have little overlap but more than 1%. There is a way to change this behavior and require that TUS is True only if there was good (i.e. TOS-type) overlap with part of the trigger object. For example, let us assume that signal is single Hlt2 track and trigger candidate is a Track-pair selected by Hlt1 DiHadron line. In more restrictive method TUS would be true only if one of the two trigger tracks was TOS (>70% hit sharing) with respect to the Hlt2 track. (Of course, the whole pair will never be TOS with respect to the signal consisting of only one Track). To activate this option do:

myTagger.CompositeTPSviaPartialTOSonly = TRUE
This can provide even bigger rejections than default TUS.

Making the TisTos tool faster

Considerable amount of CPU is spent in the TisTos tool by collecting calorimeter hits from the signal since this activates projection of Tracks into caloriemeters and Calo reco on demand. If you want to TisTos based on tracking detectors only do:

myTagger.ProjectTracksToCalo = FALSE
myTagger.CaloClustForCharged = FALSE
myTagger.CaloClustForNeutral = FALSE
myTagger.TOSFrac = { 4:0.0, 5:0.0 }

Executing in DEBUG mode to see the TisTos results in log file

Just putting the algorithm in the DEBUG OutputLevel will start printing a lot of staff from the TriggerTisTos tool itself. To suppress the latter do:

myTagger.OutputLevel = 2
from Configurables import TriggerTisTos
myTagger.TriggerTisTosTool.OutputLevel = 3

Making it work with older releases

Phys/TisTosTobbing v5r0 will work with older releases but you will need to do some gymnastics to merge necessary changes in Phys/DaVinciInterfaces v2r5 with the version of this library compatibile with your release. For example for. DaVinci v25r6 you need to "getpack Phys/DaVinciInterfaces v2r4". Somewhere else getpack "getpack Phys/DaVinciInterfaces v2r5 and manually copy ITisTos.h IParticleTisTos.h ITriggerSelectionTisTos and ITriggerTisTos between Kernel subdirectories. For the tool to work in GaudiPython, you will also need to edit files in dict/ (make sure that all the lines containing TisTos from the new version are present).

-- TomaszSkwarnicki - 9-Aug-2010 (Last update 6-Dec-2010)

Edit | Attach | Watch | Print version | History: r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r9 - 2010-12-06 - TomaszSkwarnicki
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

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