# Presentation: 415384

## B-ID code implementation

- Basics of implementation
- Tagger implementation
- Package overview
- More information:
- http://www-d0.fnal.gov/nikhef/muonbtag/codechange/

## Old implementation

- ReadEvent

- bcjet_reco

- bcjet_analyze

- vertexTag

- eTag

- impTag

- calls

- bcJet

- modifies

## New implementation

- bcjet_reco

- eTagReco

- impTagReco

- vertexTagReco

- muTagReco

- ReadEvent

- bcjet_reco

- bcjet_analyze

- bcJetInit

- bcJetFinish

- Steered by rcp

- JetChunk

- determines

- eTagChunk

- creates

- creates

- creates

- creates

- impTagChunk

- vertexTagChunk

- muTagChunk

- bcJetChunk

- creates

## Framework

- bcJetReco steered by bcJetReco.rcp
- Tells which packages to run
- Starts with bcJetInit, finalizes with bcJetFinish

- _bcJetReco.rcp_
- string PackageName = "Controller"
- string Packages = "init mutag etag finish"
- RCP init   = <bcjetreco bcJetInit>
- RCP finish = <bcjetreco bcJetFinish>
- RCP mutag  = <bc_muTagreco bc_muTagreco>
- RCP etag = <bc_eTagreco bc_eTagreco>

## bcJetInit

- Figures out which JetChunk to use
- Steered by bcJetInit.rcp file
- Reads RCP used for Jet reconstruction
- Initializes EventUtilities object with correct JetChunkSelector

- _bcJetInit.rcp_
- string PackageName = "bcJetInit"
- RCP ClusterAlgorithm = <calreco CalCone07>

## EventUtilities

- Singleton object used for event access
- Offers functions which extract the correct tag- and jetchunks
- Most important:
- THandle<JetChunk> getJetChunk(Event)
- Taggers must call above function to get correct JetChunk _ _

## bcJetFinish

- Final step in bcjet reconstruction
- Creates bcJetChunk
- Reads in each chunk made by each tagger
- Associates tag with correct jet
- Creates bcJet and stores associated tags

## Tagger implementation

- xTagReco
- analyzes Jets & xChunk
- creates one tag per Jet
- Tag can hold multiple physics objects
- Inserts xTagChunk in event
- xTagChunk must hold ChunkID of parent JetChunk
- xTagChunk needs function with signature:
- xTagIndex getxTagIndex(const Jet& jet) const;
- returns a LinkIndex to xtag in chunk belonging to jet

## Requirements on bcjet_analyze

- Blocks in bcjet_analyze have to be adapted to new bcJet
- Instead of calling properties of Jet, now call properties of tag

- void BlockMuon::accumulate(...) {
- 	vector<muTag> mutags;
- 	bcjet.getMuTags(mutags);
- 	if( mutags.size() == 0 ) return;
- 	muTag tag = mutags.front();
- 	int tagged = (tag.getBJetProbability() > 0.5) ? 1 : 0;
- 	AccumulateInt("Tagd", tagged);
- 	AccumulateFloat("Px", tag.muon().px());
- }

## Package overview

_*bcjetreco*_
- bcJetInit
- bcJetFinish

_*bcjet_utilities*_
- EventUtilities
- bcJetUtilities

_*bcjet_evt*_
- bcJet
- bcJetChunk
- xTag
- xTagChunk

_*bc_xTagreco*_
- bcXTagreco
- RegbcXTagReco

_*bcjet_analyze*_
- bcJetAnalyze
- BlockX

## Multiple JetChunks

- ReadEvent

- bcjet_reco 2

- bcjet_analyze

- JetReco 1

- JetReco 2

- bcjet_reco 1

- bcjet_reco 1

- eTagReco

- bcJetInit 1

- bcJetFinish

- bcjet_reco 2

- muTagReco

- bcJetInit 2

- bcJetFinish

- bcJetChunk 1

- bcJetChunk 2

## Packages involved

- All released in t01.39.00
- Framework packages
- bcjetreco, bcjet_utilities, bcjet_evt
- Tagger packages
- bc_eTagreco, bc_impTagreco, bc_likeTagreco, bc_muTagreco, bc_vtxTagreco
- Analysis package
- bcjet_analyze

## Current status & plans

- Implementation in t01.39.00 works fine
- Some small bugs need to be ironed out
*Crash in muon analyze code?*
- Preparing a release involving all taggers and good B-ID for p09