3.4.5. Flavor tagging#

How can we distinguish between a B0 and a B¯0? This is not as simple as the case where we have a B+ vs a B and can just consider the charge of the particles. Yet determining this “flavor” of the B meson is crucial to look into CP violation.

This is where the Flavor Tagger comes in. Used in an analysis, where we have reconstructed a signal Bsig, the Flavor Tagger looks at the ROE of the Bsig (i.e. at the Btag) and applies machine learning techniques (also called multivariate analysis) to determine the flavor of the Btag. In this lesson we will not train this model ourselves, but rather use pre-computed weights. So where do we get them?

Luckily, such sets of weights are contained in the conditions database. That means that we only need to use a specific global tag (if you forgot what that is, consult this page again: Conditions Database Overview).

Exercise

Add a line to your previous steering file that adds the latest global tag. For this you need to call the prepend_globaltag method of the basf2.conditions object (which is an instance of the ConditionsConfiguration class). To get the latest analysis global tag, you can call modularAnalysis.getAnalysisGlobaltag.

Solution

Simply add this to the top of your steering file:

Good! Now we have the weights and we have already created the ROE, so we can start right away!

Exercise

Call the flavorTagger.flavorTagger function (you need to specify your path and your particle list).

Solution

Remember to import the module:

and call the function:

Exercise

Add the the flavorTagger.flavor_tagging variable collection to your output variables

Solution

Exercise

Run your steering file!

Solution

This is the full steering file at this point:

Good! Now let’s talk about the output of the flavor tagger. This is the value qr, where q=1 corresponds to a B¯0 and q=+1 to B0. r is called the dilution factor. It’s 0 if the algorighm can’t decide between both options for q and 1 if the algorithm is certain about it’s decision.

The variable FBDT_qrCombined is the qr result of one of the models of the Flavor Tagger (a fast boosted decision tree). It can also be NaN to signal that not a single charged track in the ROE was found, so that the algorithm can’t work.

Note

In releases before release-05, a value of ±2 was used instead of NaN.

Part of the variables you just added was also qrMC for the “true” (MC level) flavor of the Btag. It can take the numbers ±1, as well as 0 (no flavor defined in the MC) and ±2 (some problems with MC matching in the ROE).

That means that we can check how well our flavor tagger performed by comparing it to FBDT_qrCombined!

Exercise (optional)

Plot a histogram of FBDT_qrCombined and qrMC.

Exercise

Only consider candidates with clearly defined MC level flavor tag. Compare the output of qrMC to that of FBDT_qrCombined.

Hint

For clearly defined MC flavor tag, you only have to distinguish between qrMC == 0 and qrMC == 1. For these two cases you can then plot the distribution of FBDT_qrCombined.

Solution

You can clearly see that the flavor tagger is by no means perfect, but definitely allows to do better than just guessing!

Key points

  • The flavor tagger is used to discriminate between Btag0 and B¯tag0

  • The output is of the form ±1 times the confidence between 0 and 1.

Stuck? We can help!

If you get stuck or have any questions to the online book material, the #starterkit-workshop channel in our chat is full of nice people who will provide fast help.

Refer to Collaborative Tools. for other places to get help if you have specific or detailed questions about your own analysis.

Improving things!

If you know how to do it, we recommend you to report bugs and other requests with GitLab. Make sure to use the documentation-training label of the basf2 project.

If you just want to give very quick feedback, use the last box “Quick feedback”.

Please make sure to be as precise as possible to make it easier for us to fix things! So for example:

If you are familiar with git and want to create your first merge request for the software, take a look at How to contribute. We’d be happy to have you on the team!

Quick feedback!

Authors of this lesson

Kilian Lieret