TWiki> LHCb Web>LHCbTrigger>HltEfficiency (revision 10)EditAttachPDF

How to measure the trigger efficiency

This is valid from DaVinci v24r5

Introduction

This page explains the best ways to determine if an event has passed the Hlt, and how.

Why not use Hlt1Global and Hlt2Global

The Hlt flow is set up such that all events with Hlt1Global=1 are passed to Hlt2 and all events with Hlt2Global=1 go to storage. Hence in the real data you will only see events with Hlt1Global=1 and Hlt2Global=1. So why not ask the same for MC?

This simply won't work. Hlt1 and Hlt2 contain a lot of lines that do nothing but help the debugging and the monitoring of the data. For instance all events that go to the express stream (=prompt reconstruction of a few Hz) are in there. It is proposed that at nominal luminosity we send to the express stream a few Hz of events that contain a J/psi and a beam gas interaction. The rate of such events will of course depend on vacuum conditions and we might decide to prescale or throttle that rate at any time. We will also add and remove commissioning lines as we need them (even on MC in DaVinci), without warning and without renaming the HltSettings. The Global Hlt2 efficiency might thus change in various Hlt version with little warning (except a cryptic note in some release.notes).

You will never be able to take that into account in MC. In the MC the concept of "rate" does not apply. How do we throttle a line to a rate of 10 Hz? Compared to what?

Presently on MC you will have to run the HLT yourself. But soon we will provide signal MC where the HLT has already been applied (but not rejecting events). But it will not be exactly the same HLT as online. We will not apply any prescale Prescale may change with run conditions and are easy to recover. If you relay on a prescaled line, you will have to make the data/MC normalisation yourself. That's easy enough

In principle all you care about is the efficiency of the physics lines. There are two scenarios:

  • Either you care about trigger biases (most likely) and therefore you want to concentrate on some well defined lines. In that case look at the appropriate lines.
  • Or you don't care and are happy to take into account all lines. Look at the trigger bits.

Hlt Lines

This is the simple situation. You just want to know if you have passed a given line, or a given set of lines. Suppose you want to know what Hlt2UnbiasedJPsi has decided.
  • In an nTuple : In DecayTreeTuple or EventTuple fill TupleToolTrigger with option VerboseHlt2 = True. This is done in $HLTSELCHECKERROOT/options/Hlt2EventTuple.py.
  • In C++ :
bool found = false ;
if( exist<LHCb::HltDecReports>( LHCb::HltDecReportsLocation::Default ) ){ 
  const LHCb::HltDecReports* decReports = get<LHCb::HltDecReports>( LHCb::HltDecReportsLocation::Default );
  for(LHCb::HltDecReports::Container::const_iterator it=decReports->begin(); it!=decReports->end();++it){
    if ( "Hlt2UnbiasedJPsiDecision" == it->first ) found = it->second.decision() ;   // passed ?
  }
} else Warning("No HltDecReports at "+LHCb::HltDecReportsLocation::Default,StatusCode::FAILURE,1);
The HltDecReports will be written into the DST. Make sure you also have them on your MicroDst.
  • In a filter:
from Configurables import LoKi__HDRFilter   as HltFilter
MySequencer.Members += [ HltFilter( 'HltPassFilter', Code="HLT_PASS('Hlt2UnbiasedJPsiDecision')" ) ]

Note that under 'Code' you can use HLT_PASS which expects the name of an Hlt line, or you can use eg. "HLT_PASS_RE('Hlt1.*Hadron.*Decision')" which passes if there is at least one line matching the regular expression Hlt1.*Hadron.*Decision which accepted the event. Note that you can also do boolean AND and OR, eg

Code ="HLT_PASS('Hlt2UnbiasedJPsiDecision') & !HLT_PASS('Hlt2IncMuTrack4JpsiDecision')"
would give you events passing Hlt2UnbiasedJPsiDecision, but not passing Hlt2IncMuTrack4JpsiDecision (provided such events are in your input).

Then there is the equivalent for L0DU, and for ODIN.

from Configurables import LoKi__L0Filter as L0Filter
filter = L0Filter('myName', Code = "L0_CHANNEL('Hadron')" )

requires the L0 'Hadron' channel to have accepted the event, and again you can do logical AND and OR like in the Hlt case. In addition there is L0_DECISION which just checks for the overall L0 decision.

  • In a stripping line:
The filter is already declared to StrippingLine. You can do

MBMicroBiasLine  = StrippingLine( "MBMicroBias"
                                  , HLT = "HLT_PASS_RE('Hlt1MBMicro.*Decision')"
                                  , checkPV = False
                                  , prescale = 1
                                  , postscale = 1)

  • In gaudipython:
HltReport = evt['Hlt/DecReports'] 
If not HltReport.decReport('Hlt1MBMicroBiasRZVeloDecision').decision() : continue

Routing (aka Trigger) bits

The trigger sets a certain number of bits according to what should happen to the events after the processing in the event filter farm. These bits are set using the HltFilter described above. According to the bit set, the event goes into the monitoring farm, or the express stream. They all go into the main stream. The list is to be found in method configureRoutingBits in HltConf.Configuration. They are printed out at the end of the trigger running:
      HltRoutingBitsWriter                                        SUCCESS Number of counters : 27
       |    Counter                                      |     #     |    sum     | mean/eff^* | rms/err^*  |     min     |     max     |
       | "00:( ODIN_BXTYP == LHCb.ODIN.Beam1 ) | ( ODIN_B|       200 |          0 |     0.0000 |     0.0000 |      0.0000 |      0.0000 |
       | "01:( ODIN_BXTYP == LHCb.ODIN.Beam2 ) | ( ODIN_B|       200 |          0 |     0.0000 |     0.0000 |      0.0000 |      0.0000 |
       | "08:L0_DECISION_PHYSICS"                        |       200 |        144 |    0.72000 |    0.44900 |      0.0000 |      1.0000 |
       | "09:L0_CHANNEL_RE('B?gas')"                     |       200 |          0 |     0.0000 |     0.0000 |      0.0000 |      0.0000 |
       | "10:L0_CHANNEL('CALO')|L0_CHANNEL('MUON,minbias'|       200 |          0 |     0.0000 |     0.0000 |      0.0000 |      0.0000 |
       | "11:L0_CHANNEL('Photon')|L0_CHANNEL('Hadron')|L0|       200 |        138 |    0.69000 |    0.46249 |      0.0000 |      1.0000 |
       |*"32:HLT_PASS('Hlt1Global')"                     |       200 |        144 |(  72.0000 +- 3.17490  )%|   -------   |   -------   |
       |*"33:HLT_PASS_SUBSTR('Hlt1Lumi')"                |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"34:HLT_PASS_RE('Hlt1(?!Lumi).*Decision')"      |       200 |        144 |(  72.0000 +- 3.17490  )%|   -------   |   -------   |
       |*"35:HLT_PASS_SUBSTR('Hlt1Velo')"                |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"36:scale(HLT_PASS_RE('Hlt2Express.*Decision')|H|       200 |          1 |( 0.500000 +- 0.498748 )%|   -------   |   -------   |
       |*"37:HLT_PASS('Hlt1ODINPhysicsDecision')"        |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"38:HLT_PASS('Hlt1ODINTechnicalDecision')"      |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"39:HLT_PASS_SUBSTR('Hlt1L0')"                  |       200 |        144 |(  72.0000 +- 3.17490  )%|   -------   |   -------   |
       |*"40:HLT_PASS_RE('Hlt1.*Hadron.*Decision')"      |       200 |         19 |(  9.50000 +- 2.07334  )%|   -------   |   -------   |
       |*"41:HLT_PASS_RE('Hlt1.*SingleMuon.*Decision')"  |       200 |         22 |(  11.0000 +- 2.21246  )%|   -------   |   -------   |
       |*"42:HLT_PASS_RE('Hlt1.*DiMuon.*Decision')"      |       200 |         25 |(  12.5000 +- 2.33854  )%|   -------   |   -------   |
       |*"43:HLT_PASS_RE('Hlt1.*MuTrack.*Decision')"     |       200 |         18 |(  9.00000 +- 2.02361  )%|   -------   |   -------   |
       |*"44:HLT_PASS_RE('Hlt1.*Electron.*Decision')"    |       200 |          7 |(  3.50000 +- 1.29952  )%|   -------   |   -------   |
       |*"45:HLT_PASS_RE('Hlt1.*Pho.*Decision')"         |       200 |          3 |(  1.50000 +- 0.859506 )%|   -------   |   -------   |
       |*"46:HLT_PASS_RE('Hlt1(?!ODIN)(?!L0)(?!Lumi)(?!Te|       200 |         61 |(  30.5000 +- 3.25557  )%|   -------   |   -------   |
       |*"47:HLT_PASS_RE('Hlt1MBMicroBias.*Decision')"   |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"48:HLT_PASS('Hlt1MBNoBiasDecision')"           |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"49:HLT_PASS_SUBSTR('Hlt1BeamGas')"             |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"64:HLT_PASS('Hlt2Global')"                     |       200 |         34 |(  17.0000 +- 2.65612  )%|   -------   |   -------   |
       |*"65:HLT_PASS('Hlt2DebugEventDecision')"         |       200 |          0 |(  0.00000 +- 0.500000 )%|   -------   |   -------   |
       |*"66:HLT_PASS_RE('Hlt2(?!Transparent).*Decision')|       200 |         34 |(  17.0000 +- 2.65612  )%|   -------   |   -------   |
Bits 46 (Hlt1 physics) and 66 (Hlt2 physics) are the most interesting.

  • Hence you can get them by using the same pattern in an HltFilter.
  • You also have them in your nTuple, as above.
  • Finally you can read them in C++ from the raw event:

#include "Kernel/ReadRoutingBits.h"  // in HltInterfaces

  if (exist<LHCb::RawEvent>(LHCb::RawEventLocation::Default)){
    LHCb::RawEvent* rawEvent = get<LHCb::RawEvent>(LHCb::RawEventLocation::Default);
    std::vector<unsigned int> yes = Hlt::firedRoutingBits(rawEvent);
  }
yes will be a vector of all bits that have fired. For instance you can search for 66. Warning: Do this only on events that pass L0, or the result might be unpredictable.

Which Setting?

If you do TCKsh and the 'listConfigurations()' (see [TCK] page) you can read it off from the printout.

That will tell you the setting from which it was made at the time it was made, ie. there is no guarantee if you run the same setting in a different release that it will give you the same thing -- it may not even be working anymore. The aim is that it will still do qualitatively the same thing, but if you get something a bit different don't be surprised. The underlying problem is that a setting is not a 'complete' specification of the configuration. If you want that, use a TCK.

And you may be able to run DaVinci with a TCK, but again, if you run more than just the HLT you will run into trouble. Much better to run Moore.

So the TCK is the only 'complete' record of 'everything'. But that makes it also (by construction) only suitable for a given release of the code, because as soon as one property in one component changes its name, it doesn't match the 'complete' record any more. But you can find 'everything' back there that is settable by a property.

So what do I do?

To reproduce a CK in DaVinci, you need the setting (see above), and a version of DaVinci not too different from the version of Moore that is running this setting in the pit. Take the one based on the same Hlt and Rec projects. Then if you're paranoid check also the tag of the HltSettings package and use the same. You might need to getpack.

Run it

DaVinci().Hlt = True
DaVinci().HltThresholdSettings = 'Physics_320Vis_300L0_10Hlt1_Aug09'  ## Hlt1 for MC09
Since about DaVinci v25, the L0 configuration used is explicitly required to match the configuration for the HLT settings specified, and will stop execution if they don't. So in many cases you will also need:
DaVinci().ReplaceL0BanksWithEmulated = True

-- PatrickSKoppenburg - 25-Nov-2009

Edit | Attach | Watch | Print version | History: r14 | r12 < r11 < r10 < r9 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r10 - 2011-01-24 - PatrickSKoppenburg
 
    • 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-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback