Moore Instructions for Run-3 triggers

This page is aim for setting up the environment to test your trigger line(s) for Run-3. In order to test the lines, two main information needs to be provided.

  1. The efficiency of your line.
  2. The rate of your line.

How to build Moore?

curl | python3 - stack

cd stack

make Moore (this will take some time)

git checkout bnoc_run3 /// this is spesific to bnoc-only decays, no need for it if you have any other decay of relevance..

cd ..

make MooreAnalysis

Where to add your line in Moore?

After you check out the bnoc branch: ### check the corresponding branch for your decay.

  • Create a new function or use the existing one with "make_(yourdecayname)"

  • Put your line in corresponding file under Hlt/Hlt2Conf/python/Hlt2Conf/lines, e.g., or

  • To book the Hlt2 line, use under bnoc directory with @register_line_builder and make sure you point out your own function with "make_(yourdecayname)".

e.g., let's do this for $B \to \phi \phi$:

def Bds_PhiPhi_line(name='Hlt2BnoC_BdsToPhiPhi_Line', prescale=1):

line_alg = BdsToVV.make_BdsToPhiPhi(process=PROCESS)
return HltLine (


algs=bnoc_prefilters() + upfront_reconstruction() + [line_alg],

How to check your signal efficiency?

In order to check your signal efficiiency, you need to run MooreAnalysis. To produce the MCDecayTree over your signal MC, you can use the "run_moore_with_tuples" function in HltEfficiencyChecker and the rest is similar to your option files you use for ganga.

An example to produce your MCDecayTree with your signal MC in Moore with your corresponding hlt line:

from Moore import options
from HltEfficiencyChecker.config import run_moore_with_tuples
from RecoConf.reconstruction_objects import reconstruction
from RecoConf.protoparticles import make_charged_protoparticles
import glob
from Moore import options, run_moore
from Hlt2Conf.lines.bnoc.hlt2_bnoc import hlt2_lines

decay = ( #### your own decay

"[${B_s0}B_s0 => "
"(phi(1020) => ${Kp0}K+ ${Km0}K-) "
"(phi(1020) => ${Kp1}K+ ${Km1}K-) ]CC"

options.set_input_from_testfiledb('Upgrade_BsPhiPhi_MD_FTv4_DIGI') ##(Upgrade_BsPhiPhi_MU_FTv4_DIGI') #### your own MC
options.evt_max = -1

options.input_type = 'ROOT'
options.input_raw_format = 0.3 #### 4.3 for DIGI

options.simulation = True
options.data_type = 'Upgrade'
options.dddb_tag = 'dddb-20180815' ## for MD : 'dddb-20190223'
options.conddb_tag = 'sim-20180530-vc-md100'
options.ntuple_file = "/eos/lhcb/user/o/oozcelik/Run3trigger/eff_ntuple_Bs2KKKK.root" ### your own directory you want to dump your ntuples.

###### your own trigger line to be pointed out

def hlt2_lines():
return [Bds_PhiPhi_line()]

options.lines_maker = hlt2_lines

from RecoConf.hlt1_tracking import default_ft_decoding_version
default_ft_decoding_version.global_bind(value=5) #value=2)

from RecoConf.global_tools import stateProvider_with_simplified_geom
with reconstruction.bind(from_file=False), make_charged_protoparticles.bind(enable_muon_id=True):

hlt1 = False, ###### if you need to test the hlt1, then the sequence should be different than run_moore_with_tuples ###
descriptor_template = decay,

Then the only thing you have to do is to run MooreAnalysis in roder to produce your ntuples .

MooreAnalysis /run

with the setup above, one can not access the reconstructed level information. To be able to do that, one must have a different configuration instead of red line above and then use DaVinci to analyse HLT line output.

First step is done by setting properties with Moore.run_moore to produce outputs

from RecoConf.reconstruction_objects import reconstruction

with reconstruction.bind(from_file=False):
config=run_moore(options, all_lines, public_tools)

and to read the output with DaVinci, a configuration file, which is similar to analyse Turbo data, is needed. This will produce ntuples with "DecayTree" and will have both the generated and the reconstructed level information. Find an example script attached at the bottom of the page.

Now you can run your options within the DaVinci runtime environment using lb-run:


NOTE: You can still produce your tuples with "DecayTree" (instead of FunTuple) but you need a specific DaVinci version to be compatible with it. In that case, it is "v54r1" to be used with the corresponding platform "x86_64_v3-centos7-gcc11-opt" .

How to check the rate of the background? (running with ganga)

$rate~ (R) = \mathcal {L }_{inst} \times \sigma (pp \to H) \times \mathcal {B}(H\to f) \times \varepsilon$

is the signal rate, where $\mathcal {L }_{inst}$ instantaneous luminosity at LHCb, $\sigma (pp \to H)$ is the cross section of the decay particle, $\mathcal {B}(H\to f)$ is its branching fraction to the final state particles and the $\varepsilon$ is the efficiency of your decay.

Although, if you want a real represntative of data, you should process the minbias MC events which used to estimate the rate of your HLT line.

Upgrade minimum bias MC bookkeeping paths

  • Unfiltered: sim+std://MC/Upgrade/Beam7000GeV-Upgrade-MagDown-Nu7.6-25ns-Pythia8/Sim09c-Up02/Reco-Up01/30000000/LDST
  • HLT1 filtered: sim+std://MC/Upgrade/Beam7000GeV-Upgrade-MagDown-Nu7.6-25ns-Pythia8/Sim09c-Up02/Reco-Up01/Trig0x52000000/30000000/LDST

Checkout the latest nightlies

lb-dev --platform x86_64_v2-centos7-gcc11-opt --nightly lhcb-master/latest MooreAnalysis /master

cd MooreAnalysisDev _master/

git lb-use Moore

##to check out the Moore with the master branch

git lb-checkout Moore/master Hlt

if you test your own trigger line - not deployed yet - then you need to create your own branch in Moore with the corresponding script(s) for your line.

git clone 
git checkout -b new_branch
git push origin new_branch

and then you can do

git lb-checkout Moore/new_branch Hlt

make ## to compile the environment

the rest will be very similar to job submission in ganga.

First, you have the option file. Find an example below :

splitter = SplitByFiles ()
splitter.filesPerJob = 15
splitter.bulksubmit = False
splitter.ignoremissing = True

j = Job( name = "MB-MD", splitter = splitter, comment="")

myApp = GaudiExec () = "/afs/"

j.application = myApp
j.application.platform = "x86_64_v2-centos7-gcc11-opt"
j.application.options = ["/afs/"] #### your file that points out the trigger line for rate calculation. find the example attached.

bkq = BKQuery("/MC/Upgrade/Beam7000GeV-Upgrade-MagDown-Nu7.6-25ns-Pythia8/Sim10aU1/30000000/DIGI")
ds = bkq.getDataset()
j.inputdata = ds
j.backend = Dirac()
j.backend.diracOpts = 'j.setTag(["/cvmfs/"])'
j.outputfiles = [DiracFile('*.root')]

then simply run it in ganga


there you go..

-- OzlemOzcelik - 2022-01-12

How to understand if your rate is ok?

Ideally, the rate computed with Moore Analysis should be similar to the expected signal rate. You can easily compute the expected signal rate taking into account the foreseen Luminosity for Run3, the cross section of your decay and the relative branching fraction. Some studies have already been performed, reported in this paper “Upgrade trigger selection studies” (

HLT1+HLT2 efficiency - also on ganga

It’s possible to extract also the efficiencies running over ganga. You need only to have a similar script to that of the rate, changing the option file and the bkpath. Keep in mind that the rate should be computed over the minbias sample, while you will need the exact path of your MC to compute the efficiencies.

You can basically extract the efficiencies of your HLT2 line alone (this means, if you check the guideline of MooreAnalysis, that your denominator is the default one, eg CRC, the Candidate Reco Children) or computing your HLT2 efficiency on top of the HLT1 requirements.

First of all, we need to have the HLT1 info in our tuples, for that you can change the last part of the script of the efficiency.

In principle, we need to add the HLT1 level information, provided by Allen:

from RecoConf.global_tools import stateProvider_with_simplified_geom with allen_sequence.bind(sequence=“hlt1_pp_default”), reconstruction.bind( from_file=False):

run_chained_hlt_with_tuples( options, decay, public_tools=[stateProvider_with_simplified_geom()])

To have the efficiency of HLT1 on top of the HLT2 you will need to Run MooreAnalysis over your entire produced ntuples, in this way:

MooreAnalysis/run MooreAnalysis/HltEfficiencyChecker/scripts/ Xic0_eff_computation.root —custom-denoms Hlt1TrackMVAs:Hlt1TrackMVADecision || Hlt1TwoTrackMVADecision --reconstructible-children=p,Km,Km,pip --legend-header=“Xi_{c}0#rightarrow p+ K- K-#pi+” --make-plots

Hlt1TrackMVAs:Hlt1TrackMVADecision || Hlt1TwoTrackMVADecision means that we are selecting both the HLT1 decision 1 track or two tracks, that are the most important for our studies.

You will have lots of plots in output, what you have to look is a plot with the name of your HLT2 line and the HLT1 requirement, like this:


FedericaOliva - 2022-01-23

Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt r1 manage 4.4 K 2022-01-18 - 16:08 OzlemOzcelik read the HLT output via DaVinci
Texttxt r1 manage 0.7 K 2022-01-18 - 15:25 OzlemOzcelik option files for ganga jobs
Texttxt r1 manage 2.4 K 2022-01-18 - 15:25 OzlemOzcelik option files for ganga jobs
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r9 - 2022-03-25 - OzlemOzcelik
    • 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-2022 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