D0: B-flavor Tagging

(Last revised: April 20, 2004 - Christos Leonidopoulos)

Introduction  - Class description (v00-00-80)

The B-flavor tagging class (CVS package: bflavor_tag) aims at providing users with the best educated guess for the initial-state flavor of B-mesons. Typically, the user will have reconstructed the B final state ("self-tagging" of the final state) and will then call the tagging class to get the answer for the flavor of the B "at production".

There is ongoing work on three separate tagging algorithms:
The first implementation of the class orders the tagging algorithms by dilution (i.e. SLT, SST, JetQ), and makes sequential calls to the different methods until one of them returns a non-zero answer (this will be the "best guess"). In addition, the class gives the user the option of obtaining a tag from individual tagging algorithms (e.g. "getSLTTag", "getOppJetQTag", "getSSTTag") for sub-tagging class testing.

The longer-term goal is to combine all (in principle, non-identical) answers from the different tagging methods (with different weights depending on the topology of the event) into a unique answer with an associated confidence level (with either a neural-net or the more traditional likelihood method implementation). This is something we are working on.

Do you feel that you want to contribute or have a good idea? Yes, we are currently accepting applications: please send me an email.

Supported input formats

The tagging class can run
(1) With the addition of a "BF_TRACK" branch that holds all the charged tracks for the event. Modified d0root-tuples have been produced for all LP03 dimuon data by Xiaojian Zhang (currently working on putting these changes in d0root_btag's CVS).
(2) This tag is designed for TMBTrees that have been produced with d0correct. If you are working with older TMBTrees (produced with p13/p14) you probably want to use an older tag.

Interface and access methods

A list of public access methods along with a brief description can be found here.

Installation - How to use

% setup D0RunII p14.06.00
% newrel -t p14.06.00 mywork_area
% cd mywork_area
% d0setwa

ln -s /d0dist/dist/releases/p14.06.00/tmb_analyze/macros macros
% cp macros/MakeTMBTreeClasses_so.C .
% root
root[] .x MakeTMBTreeClasses_so.C
(that takes a minute or two, don't be scared)
root[] .q


Note:
if you want to run on some of the latest common sample TMBTrees made by Vivek you probably need to add later versions of tmb_tree and tmb_analyze in your working area (see this link for details)
e.g.
% addpkg tmb_tree p14-br-19
% addpkg tmb_analyze p14-br-11
% ln -s tmb_analyze/macros macros
% cp macros/MakeTMBTreeClasses_so.C .
etc.
% addpkg bflavor_tag v00-00-80 (or later tag; this is the tagging code)

That's all you had to do! You can now run your code. If you need an example, steal the code from the bflavor_tag/macros/ directory:
% cp bflavor_tag/macros/run_example_TMBtrees.C . (this is an example of "user code")
% cp bflavor_tag/macros/run_example_TMBtrees.h .
% cp bflavor_tag/macros/Make_JPsi_TMB.C . (the "makefile")

Now it's time to run:

% root Make_JPsi_TMB.C

To see how the very same code works in an example where the user feeds the tagger with data, use run_example_TMBtrees_user.C(h) and Make_JPsi_TMB_user.C instead.
% cp bflavor_tag/macros/run_example_d0root_btag.C . (this is an example of "user code")
% cp bflavor_tag/macros/run_example_d0root_btag.h .
% cp bflavor_tag/macros/keepEvent.C . (continuation, I've put the B selection cuts in a separate file)
% cp bflavor_tag/macros/fit_mass_fraction.C . (root macro for fitting the B mass distribution)
% cp bflavor_tag/macros/Make_d0root_btag . (the "makefile")

Now it's time to run:

% root Make_d0root_btag.C

To see how the very same code works in an example where the user feeds the tagger with data, use run_example_d0root_btag_user.C(h) and Make_d0root_btag_user.C instead.
Some explanation of the makefile:
Make sure to put this line before the include stuff in your "makefile":
// this line screws up the include path - put it before we define the include's
gROOT->ProcessLine(".x MakeTMBTreeClasses_so.C");

Make sure to define the include path name:
TString incpath = gSystem->GetIncludePath();
incpath.Append(" -I$SRT_LOCAL/include -I$SRT_PUBLIC_CONTEXT/include");
gSystem->SetIncludePath(incpath.Data());

Add the following header file to your code/macro to be able to use the tagging class:
#include "bflavor_tag/BtaggerWrapper.hpp"

Using the tagging code in your macro:

Input/Mode TMBTree or d0root-tuple
User feeds tagger with data
#include:
#include "bflavor_tag/BtaggerWrapper.hpp"
Instantiation
// chain is pointer to input file
// (TMBTree or d0root-tuple)
Btagger * tagMe = Btagger(chain);

// instantiate with "0"
Btagger * tagMe = Btagger(0);
Setup
// phi-separation of reconstructed B from tagger (default)
tagMe->setSLT_dPhi_mode(); // or use tagMe->setSLT_dR_mode() for R-separation
tagMe->setJetQ_dPhi_mode(); // or use tagMe->setJetQ_dR_mode() for R-separation
// see the full list of public methods and more documentation here
Event loop
for(int i = 0; i != _nevents; ++i){
  
// set of BF_TRACK/fTrks indices
// used in B reconstruction
// (i.e. not to be used for //tagging)
tagMe->exclude(list_of_trks);

// set the z-position of the PV
 tagMe->setPVz(pv_z);
 
// get B flavor
int otherBcharge =
         tagMe->getBTag(B_phi, B_eta,
                        B_pt, B_mass);

} // event loop
 for(int i = 0; i != _nevents; ++i){

// empty list of tracks, muons from previous event
tagMe->clear_user_data();

// set the z-position of the PV

tagMe->setPVz(pv_z);

// loop over tracks:
// feed tagger with tracks not
// included in B reconstruction;
// The data format can be found
here
 for(int j = 0 ; j != _ntrks; ++j){
 Trk_data  trk = { eta, phi, chi2,
 pt, dca, dcaerr, zca, zcaerr, z,

 charge, nsmt_hits, nfct_hits };

 tagMe->push_back(trk);
 }

 // loop over muons:
 for(int j = 0 ; j != _nmuons; ++j){
 
 Muon_data  muon = {eta, phi, pt,
 dca, charge, quality, nseg };


 tagMe->push_back(muon);
 }

int otherBcharge =
     tagMe->getBTag(B_phi, B_eta,
                    B_pt, B_mass);


} // event loop

Performace: plots and tables

Under construction

Older plots and results (bflavor_tag on LP03 data):

Mass distribution for B signal events: paper quality plot, plot with fit details

Tagged events: mass distribution, performance summary

SLT-tagged events: mass distribution, performance summary

JetQ-tagged events: mass distribution, performance summary

SST-tagged events: mass distribution, performance summary

Comparison between SLT and JetQ tagging algorithms: here

Comparison between SLT and SST tagging algorithms: here

Comparison between JetQ and SST agging algorithms: here

Technical stuff:

Versioning history:

Here

Older versions of this page:

v00-00-70 (January 24, 2004)
v00-00-60 (January 20, 2004)
v00-00-55 (December 8, 2003)
v00-00-50 (December 8, 2003)
v00-00-41 (November 23, 2003)
v00-00-32 (October 17, 2003)
v00-00-20 (May 15, 2003)


Please send comments and corrections to  Christos Leonidopoulos